From 9b9fd8d255cdb0af15d474a291ab1fa7c4c82957 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Wed, 8 May 2024 19:23:05 +0200 Subject: [PATCH] Converted dupMap and noMerge to vectors. --- .../src/PurgeDuplicate.cc | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc b/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc index 07408442a26cf..eda71fc83b209 100644 --- a/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc +++ b/L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc @@ -184,19 +184,11 @@ void PurgeDuplicate::execute(std::vector& 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> dupMap(numStublists, vector(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 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 @@ -286,8 +278,8 @@ void PurgeDuplicate::execute(std::vector& 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; } } } @@ -295,15 +287,15 @@ void PurgeDuplicate::execute(std::vector& outputtracks, unsigned int iSec // 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) && @@ -316,7 +308,7 @@ void PurgeDuplicate::execute(std::vector& 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;