From fd5c3b997ba2decd0a4a93e41af4c4df81cfe74f Mon Sep 17 00:00:00 2001 From: Daniel Ally Date: Mon, 16 Dec 2024 21:01:12 +0100 Subject: [PATCH] Swtiched from killing to merging to improve efficiency --- .../src/PurgeDuplicate.cc | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc b/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc index 6aa852fb93717..6eb2ae5c069e8 100644 --- a/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc +++ b/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc @@ -333,6 +333,42 @@ void PurgeDuplicate::execute(std::vector& outputtracks, unsigned int iSec trackBinInfo[seedRankIdx[preftrk]] = true; trackBinInfo[seedRankIdx[rejetrk]] = true; } else { + // Get a merged stub list + std::vector newStubList; + std::vector stubsTrk1 = sortedinputstublists_[preftrk]; + std::vector stubsTrk2 = sortedinputstublists_[rejetrk]; + std::vector stubsTrk1indices; + std::vector stubsTrk2indices; + for (unsigned int stub1it = 0; stub1it < stubsTrk1.size(); stub1it++) { + stubsTrk1indices.push_back(stubsTrk1[stub1it]->l1tstub()->uniqueIndex()); + } + for (unsigned int stub2it = 0; stub2it < stubsTrk2.size(); stub2it++) { + stubsTrk2indices.push_back(stubsTrk2[stub2it]->l1tstub()->uniqueIndex()); + } + newStubList = stubsTrk1; + for (unsigned int stub2it = 0; stub2it < stubsTrk2.size(); stub2it++) { + if (find(stubsTrk1indices.begin(), stubsTrk1indices.end(), stubsTrk2indices[stub2it]) == + stubsTrk1indices.end()) { + newStubList.push_back(stubsTrk2[stub2it]); + } + } + // Overwrite stublist of preferred track with merged list + sortedinputstublists_[preftrk] = newStubList; + + std::vector> newStubidsList; + std::vector> stubidsTrk1 = sortedmergedstubidslists_[preftrk]; + std::vector> stubidsTrk2 = sortedmergedstubidslists_[rejetrk]; + newStubidsList = stubidsTrk1; + + for (unsigned int stub2it = 0; stub2it < stubsTrk2.size(); stub2it++) { + if (find(stubsTrk1indices.begin(), stubsTrk1indices.end(), stubsTrk2indices[stub2it]) == + stubsTrk1indices.end()) { + newStubidsList.push_back(stubidsTrk2[stub2it]); + } + } + // Overwrite stubidslist of preferred track with merged list + sortedmergedstubidslists_[preftrk] = newStubidsList; + // Mark that rejected track has been merged into another track trackInfo[seedRankIdx[jtrk]].second = true; }