Skip to content

Simplify LST input & output#252

Open
VourMa wants to merge 5 commits intomasterfrom
simplifyLSTInputOutput
Open

Simplify LST input & output#252
VourMa wants to merge 5 commits intomasterfrom
simplifyLSTInputOutput

Conversation

@VourMa
Copy link
Copy Markdown
Collaborator

@VourMa VourMa commented Apr 6, 2026

Commits d35a0eb to 43379c7 are fully technical, resulting in the same physics performance (validation plots here) and the following timing reduction (baseline timing vs. PR timing):

  • hltInitialStepSeedTracksLST: 4.6 → 0 ms (-100%);
  • hltInputLST: 18.5 → 16.7 ms (-10%);
  • LSTOutputConverter: 67.9 → 55.0 ms (-19%).

Commit 8f4f2fa applies a physics change for the new tracking baseline (validation plots here) and the following timing reduction (baseline timing vs. PR timing):

  • hltInitialStepSeeds: 31.8 → 6.5 ms (-80%).

I have removed the commit where the LSTOutputConverter products are completely removed (it will have to wait for #227).

VourMa added 5 commits April 6, 2026 10:54
Add flags for tracking/seeding production

Conditional creation of products

Per-iteration heap allocations moved out of the loop

Remove unnecessary OT hit loop + sort for pLS candidates

Seed creator initiation out of the loop
@VourMa VourMa force-pushed the simplifyLSTInputOutput branch from 72ae121 to 8f4f2fa Compare April 6, 2026 21:35
@VourMa VourMa changed the title Simplify lst input output Simplify LST input & output Apr 7, 2026
Comment on lines +52 to +55
edm::EDPutTokenT<TrajectorySeedCollection> trajectorySeedpLSPutToken_;
edm::EDPutTokenT<TrackCandidateCollection> trackCandidatePutToken_;
edm::EDPutTokenT<TrackCandidateCollection> trackCandidatepTCPutToken_;
edm::EDPutTokenT<TrackCandidateCollection> trackCandidateT4T5TCPutToken_;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these could still be const if you fold the initialization to the constructor initializer list

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make these collections be produced conditionally. Unless I am missing some trick, to do that I would have to add them to the constructor (and not the constructor initializer list), and hence they cannot be made const. Or maybe I misunderstood your comment?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check with git grep --cached -2 "\? [^$]*consumes[^$]*" for existing patterns.
It will be token_(flag ? consumes() : defaultConstructed )

using Hit = SeedingHitSet::ConstRecHitPointer;
std::vector<Hit> hitsForSeed;
GlobalTrackingRegion region;
seedCreator_->init(region, iSetup, nullptr);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a large saving? The interface of SeedCreator to making seeds is non-const

virtual void makeSeed(TrajectorySeedCollection& seedCollection, const SeedingHitSet& hits) = 0;

I'd rather figure out how to make this seed making call const before moving the init outside the use loop

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timing gain is really minor:

LSTOutputConverter: 55.0 → 54.6 ms (-1%)

I think it makes sense to drop this change, if we suspect it could cause issues.

Comment on lines +135 to +141
std::vector<Hit> hits;
for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
TrackingRecHitRef refHit = proto.recHit(iHit);
if (refHit->isValid())
hits.push_back((Hit)&(*refHit));
}
sort(hits.begin(), hits.end(), HitLessByRadius());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorting and invalid hit filtering should probably be configurable and done regardless of removeOTRechits_

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are a direct copy from:

std::vector<Hit> hits;
for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
TrackingRecHitRef refHit = proto.recHit(iHit);
if (refHit->isValid())
hits.push_back((Hit) & (*refHit));
}
sort(hits.begin(), hits.end(), HitLessByRadius());

so this part just replicates the behavior from the code below.

Would you like me to test what happens if I don't apply this sorting+filtering?

The only case that this sorting+filtering is not applied is when useProtoTrackKinematics and not removeOTRechits_. But I wouldn't like to change this general behavior, as it will have effects to the Run 3 reconstruction potentially.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implied that after my updates removeOTRechits_ can be set to false, then we'd likely want to have the same filtering and sorting still present here

Comment on lines +150 to +154
if (hits.size() > 2) {
SeedFromProtoTrack seedFromProtoTrack(config_, proto, SeedingHitSet(hits), es);
if (seedFromProtoTrack.isValid())
(*result).push_back(seedFromProtoTrack.trajectorySeed());
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a part of debugging the efficiency loss: please check if this part ever fails to produce seeds (IIUC the number of pixel hits is still expected to be at least 3, the question is if the SeedFromProtoTrack construction sometimes makes invalid seeds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants