-
Notifications
You must be signed in to change notification settings - Fork 2
updates to handle pLS with OT hits #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
78bc043
d542cfc
0d234e8
de615eb
5c7738a
12314fe
5e6353c
2d7eb5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ | |
| #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" | ||
| #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" | ||
|
|
||
| #include <ranges> | ||
|
|
||
| class LSTOutputConverter : public edm::stream::EDProducer<> { | ||
| public: | ||
| explicit LSTOutputConverter(edm::ParameterSet const& iConfig); | ||
|
|
@@ -40,6 +42,8 @@ class LSTOutputConverter : public edm::stream::EDProducer<> { | |
| const edm::EDGetTokenT<TrajectorySeedCollection> lstPixelSeedToken_; | ||
| const bool includeT5s_; | ||
| const bool includeNonpLSTSs_; | ||
| const bool dropOTHitsPurePLS_; | ||
| const int maxITHitsToDropOTHitsPurePLS_; | ||
| const bool produceSeeds_; | ||
| const bool produceTrackCandidates_; | ||
| const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> mfToken_; | ||
|
|
@@ -68,6 +72,8 @@ LSTOutputConverter::LSTOutputConverter(edm::ParameterSet const& iConfig) | |
| lstPixelSeedToken_{consumes(iConfig.getParameter<edm::InputTag>("lstPixelSeeds"))}, | ||
| includeT5s_(iConfig.getParameter<bool>("includeT5s")), | ||
| includeNonpLSTSs_(iConfig.getParameter<bool>("includeNonpLSTSs")), | ||
| dropOTHitsPurePLS_(iConfig.getParameter<bool>("dropOTHitsPurePLS")), | ||
| maxITHitsToDropOTHitsPurePLS_(iConfig.getParameter<int>("maxITHitsToDropOTHitsPurePLS")), | ||
| produceSeeds_(iConfig.getParameter<bool>("produceSeeds")), | ||
| produceTrackCandidates_(iConfig.getParameter<bool>("produceTrackCandidates")), | ||
| mfToken_(esConsumes()), | ||
|
|
@@ -110,6 +116,8 @@ void LSTOutputConverter::fillDescriptions(edm::ConfigurationDescriptions& descri | |
| desc.add<edm::InputTag>("lstPixelSeeds", edm::InputTag("lstInputProducer")); | ||
| desc.add<bool>("includeT5s", true); | ||
| desc.add<bool>("includeNonpLSTSs", false); | ||
| desc.add<bool>("dropOTHitsPurePLS", false); | ||
| desc.add<int>("maxITHitsToDropOTHitsPurePLS", 3); | ||
| desc.add<bool>("produceSeeds", true); | ||
| desc.add<bool>("produceTrackCandidates", true); | ||
| desc.add("propagatorAlong", edm::ESInputTag{"", "PropagatorWithMaterial"}); | ||
|
|
@@ -167,16 +175,21 @@ void LSTOutputConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSet | |
| for (unsigned int i = 0; i < nTrackCandidates; i++) { | ||
| auto iType = lstOutput_view.trackCandidateType()[i]; | ||
| bool const isT5orT4 = (iType == lst::LSTObjType::T5 || iType == lst::LSTObjType::T4); | ||
| LogDebug("LSTOutputConverter") << " cand " << i << " " << iType << " " << lstOutput_view.pixelSeedIndex()[i]; | ||
| const auto iSeed = lstOutput_view.pixelSeedIndex()[i]; | ||
| const bool dropHitsOTpL = | ||
| iType == lst::LSTObjType::pLS && dropOTHitsPurePLS_ && | ||
| std::prev(pixelSeeds[iSeed].recHits().end())->geographicalId().subdetId() > PixelSubdetector::PixelEndcap && | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think they are ordered at least on this scale (meaning IT and OT are not interspersed). |
||
| std::ranges::count_if(pixelSeeds[iSeed].recHits(), [](const auto& h) { | ||
| return h.geographicalId().subdetId() <= PixelSubdetector::PixelEndcap; | ||
| }) <= maxITHitsToDropOTHitsPurePLS_; | ||
| LogDebug("LSTOutputConverter") << " cand " << i << " " << iType << " " << iSeed; | ||
| TrajectorySeed seed; | ||
| edm::RefToBase<TrajectorySeed> seedRef; | ||
| if (!isT5orT4) { | ||
| seed = pixelSeeds[lstOutput_view.pixelSeedIndex()[i]]; | ||
| seedRef = {pixelSeedsRBP, lstOutput_view.pixelSeedIndex()[i]}; | ||
| } | ||
|
|
||
| edm::OwnVector<TrackingRecHit> recHits; | ||
| if (!isT5orT4) { | ||
| if (!isT5orT4 && !dropHitsOTpL) { | ||
| seed = pixelSeeds[iSeed]; | ||
| seedRef = {pixelSeedsRBP, iSeed}; | ||
|
|
||
| for (auto const& hit : seed.recHits()) | ||
| recHits.push_back(hit.clone()); | ||
| } | ||
|
|
@@ -189,7 +202,14 @@ void LSTOutputConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSet | |
| unsigned int hitIdx = lstOutput_view.hitIndices()[i][layerSlot][hitSlot]; | ||
| if (hitIdx == lst::kTCEmptyHitIdx) | ||
| continue; | ||
| recHits.push_back(OTHits[hitIdx]->clone()); | ||
| bool hitOK = true; | ||
| for (auto const& hit : recHits) | ||
| if (hit.sharesInput(OTHits[hitIdx], TrackingRecHit::all)) { | ||
| hitOK = false; | ||
| break; | ||
| } | ||
|
Comment on lines
+206
to
+210
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you remind me what cases is this supposed to catch?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for pLS OT hits overlapping with the T3/4/5 hits |
||
| if (hitOK) | ||
| recHits.push_back(OTHits[hitIdx]->clone()); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -212,9 +232,7 @@ void LSTOutputConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSet | |
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| if (iType != lst::LSTObjType::pLS) { | ||
| // For T5/T4: makeSeed is needed whenever seeds or TCs are produced, since the resulting | ||
| // seed is the only source of initial state for T5/T4 track candidates. | ||
| // For other pT objects: makeSeed is only needed for seed output. | ||
|
|
@@ -264,11 +282,27 @@ void LSTOutputConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSet | |
| LogDebug("LSTOutputConverter") << "Created a seed with " << trajectorySeed.nHits() << " " << ss.detId() << " " | ||
| << ss.pt() << " " << ss.parameters().vector() << " " << ss.error(0); | ||
| } | ||
| } else { | ||
| if (produceSeeds_) { | ||
| outputTS.emplace_back(seed); | ||
| outputpLSTS.emplace_back(seed); | ||
| } else if (produceSeeds_) { // if (iType == lst::LSTObjType::pLS) | ||
| if (dropHitsOTpL) { // true if need to drop OT hits | ||
| using Hit = SeedingHitSet::ConstRecHitPointer; | ||
| std::vector<Hit> hitsForSeed; | ||
|
Comment on lines
+287
to
+288
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now defined outside the loop. I suggest to use |
||
| hitsForSeed.reserve(std::ranges::size(pixelSeeds[iSeed].recHits())); | ||
| for (auto const& hit : pixelSeeds[iSeed].recHits()) { | ||
| if (hit.geographicalId().subdetId() > PixelSubdetector::PixelEndcap) | ||
| continue; | ||
| hitsForSeed.emplace_back(dynamic_cast<Hit>(&hit)); | ||
| recHits.push_back(hit.clone()); | ||
| } | ||
| GlobalTrackingRegion region; | ||
| seedCreator_->init(region, iSetup, nullptr); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks like the origin of my problem. Thanks! |
||
| seedCreator_->makeSeed(seeds, hitsForSeed); | ||
| if (seeds.empty()) | ||
| edm::LogInfo("LSTOutputConverter") << "failed to convert a pLS object to a seed" << i << iSeed; | ||
| seed = seeds[0]; | ||
| seedRef = edm::RefToBase<TrajectorySeed>(edm::Ref(outputTSRP, outputTS.size())); | ||
| } | ||
|
Comment on lines
+286
to
303
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is done only when |
||
| outputTS.emplace_back(seed); | ||
| outputpLSTS.emplace_back(seed); | ||
| } | ||
|
|
||
| if (!produceTrackCandidates_) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How was this decided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mostly mental optimization is:
So, the result is 3.