Skip to content

Commit

Permalink
Merge pull request #44936 from aehart/array_fix_14_0_X
Browse files Browse the repository at this point in the history
[14_0_X] Removed variable-length arrays
  • Loading branch information
cmsbuild authored May 14, 2024
2 parents 36a3799 + 9b9fd8d commit d8e5329
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,11 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec
}
}

// Initialize all-false 2D array of tracks being duplicates to other tracks
bool dupMap[numStublists][numStublists]; // Ends up symmetric
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
for (unsigned int jtrk = 0; jtrk < numStublists; jtrk++) {
dupMap[itrk][jtrk] = false;
}
}
// Initialize all-false 2D vector of tracks being duplicates to other tracks
vector<vector<bool>> dupMap(numStublists, vector<bool>(numStublists, false));

// Used to check if a track is in two bins, is not a duplicate in either bin, so is sent out twice
bool noMerge[numStublists];
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
noMerge[itrk] = false;
}
vector<bool> noMerge(numStublists, false);

// Find duplicates; Fill dupMap by looping over all pairs of "tracks"
// numStublists-1 since last track has no other to compare to
Expand Down Expand Up @@ -286,24 +278,24 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec

// Fill duplicate map
if (nShareLay >= settings_.minIndStubs()) { // For number of shared stub merge condition
dupMap[itrk][jtrk] = true;
dupMap[jtrk][itrk] = true;
dupMap.at(itrk).at(jtrk) = true;
dupMap.at(jtrk).at(itrk) = true;
}
}
}

// Check to see if the track is a duplicate
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
for (unsigned int jtrk = 0; jtrk < numStublists; jtrk++) {
if (dupMap[itrk][jtrk]) {
noMerge[itrk] = true;
if (dupMap.at(itrk).at(jtrk)) {
noMerge.at(itrk) = true;
}
}
}

// If the track isn't a duplicate, and if it's in more than one bin, and it is not in the proper rinv or phi bin, then mark it so it won't be sent to output
for (unsigned int itrk = 0; itrk < numStublists; itrk++) {
if (noMerge[itrk] == false) {
if (!noMerge.at(itrk)) {
if (((findOverlapRinvBins(inputtracklets_[itrk]).size() > 1) &&
(findRinvBin(inputtracklets_[itrk]) != bin)) ||
((findOverlapPhiBins(inputtracklets_[itrk]).size() > 1) &&
Expand All @@ -316,7 +308,7 @@ void PurgeDuplicate::execute(std::vector<Track>& outputtracks, unsigned int iSec
for (unsigned int itrk = 0; itrk < numStublists - 1; itrk++) {
for (unsigned int jtrk = itrk + 1; jtrk < numStublists; jtrk++) {
// Merge a track with its first duplicate found.
if (dupMap[itrk][jtrk]) {
if (dupMap.at(itrk).at(jtrk)) {
// Set preferred track based on seed rank
int preftrk;
int rejetrk;
Expand Down

0 comments on commit d8e5329

Please sign in to comment.