Skip to content
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

Fix sorting in TTUTrackingAlg (11_1_X) #31430

Merged
merged 3 commits into from Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions L1Trigger/RPCTechnicalTrigger/interface/TTUTrackingAlg.h
Expand Up @@ -125,22 +125,6 @@ class TTUTrackingAlg : public TTULogic {

std::vector<std::unique_ptr<Seed>> m_initialseeds;

struct CompareSeeds {
bool operator()(const Seed* a, const Seed* b) {
//std::cout << (*a).m_sectorId << " " << (*b).m_sectorId << " "
//<< (*a).m_stationId << " " << (*b).m_stationId << std::endl;
return ((*a).m_sectorId == (*b).m_sectorId) && ((*a).m_stationId == (*b).m_stationId);
}
};

struct SortBySector {
bool operator()(const Seed* a, const Seed* b) { return ((*a).m_sectorId <= (*b).m_sectorId); }
};

struct SortByLayer {
bool operator()(const Seed* a, const Seed* b) { return ((*a).m_stationId <= (*b).m_stationId); }
};

inline void print(const std::vector<Seed*>& seeds) {
std::vector<Seed*>::const_iterator itr;
for (itr = seeds.begin(); itr != seeds.end(); ++itr)
Expand Down
12 changes: 9 additions & 3 deletions L1Trigger/RPCTechnicalTrigger/src/TTUTrackingAlg.cc
Expand Up @@ -224,10 +224,16 @@ void TTUTrackingAlg::ghostBuster(Track* currentTrk) {

std::vector<Seed*>::iterator seedItr;

std::sort(currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortBySector());
std::sort(currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortByLayer());
std::sort(currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), [](const Seed* a, const Seed* b) {
if (a->m_sectorId == b->m_sectorId) {
return a->m_stationId < b->m_stationId;
}
return a->m_sectorId < b->m_sectorId;
});

seedItr = std::unique(currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), CompareSeeds());
seedItr = std::unique(currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), [](const Seed* a, const Seed* b) {
return a->m_sectorId == b->m_sectorId and a->m_stationId == b->m_stationId;
});

currentTrk->m_seeds.resize(seedItr - currentTrk->m_seeds.begin());

Expand Down