From b87f07ed1c5a8147f1cb9bb592aaf123a6fbf09b Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Thu, 11 Aug 2022 15:52:03 +0000
Subject: [PATCH] L1: merge back and front used strip flags to a single array

---
 reco/L1/L1Algo/L1Algo.cxx          |  7 ++-----
 reco/L1/L1Algo/L1Algo.h            |  3 +--
 reco/L1/L1Algo/L1CATrackFinder.cxx | 15 +++++++--------
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx
index 067ab935ad..ab40e8f3e4 100644
--- a/reco/L1/L1Algo/L1Algo.cxx
+++ b/reco/L1/L1Algo/L1Algo.cxx
@@ -135,11 +135,8 @@ void L1Algo::SetData(L1Vector<L1Hit>& Hits_, int nStrips_, L1Vector<unsigned cha
   }
 #endif
 
-  fStripToTrackF.clear();
-  fStripToTrackF.reserve(fNstrips);
-
-  fStripToTrackB.clear();
-  fStripToTrackB.reserve(fNstrips);
+  fStripToTrack.clear();
+  fStripToTrack.reserve(fNstrips);
 
   fHitFirstTriplet.reset(nHits);
   fHitNtriplets.reset(nHits);
diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h
index 433458ff01..60c760139c 100644
--- a/reco/L1/L1Algo/L1Algo.h
+++ b/reco/L1/L1Algo/L1Algo.h
@@ -295,8 +295,7 @@ public:
   L1Vector<omp_lock_t> fStripToTrackLock {"L1Algo::fStripToTrackLock"};
 #endif
 
-  L1Vector<int> fStripToTrackF {"L1Algo::fStripToTrack"};  // strip to track pointers
-  L1Vector<int> fStripToTrackB {"L1Algo::fStripToTrack"};  // strip to track pointers
+  L1Vector<int> fStripToTrack {"L1Algo::fStripToTrack"};  // strip to track pointers
 
   int fNThreads {0};
   bool fUseHitErrors {true};
diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx
index 3ba76b49f8..db648d2fac 100644
--- a/reco/L1/L1Algo/L1CATrackFinder.cxx
+++ b/reco/L1/L1Algo/L1CATrackFinder.cxx
@@ -2069,8 +2069,7 @@ void L1Algo::CATrackFinder()
         fTrackCandidates[i].clear();
       }
 
-      fStripToTrackF.reset(fNstrips, -1);
-      fStripToTrackB.reset(fNstrips, -1);
+      fStripToTrack.reset(fNstrips, -1);
 
       //== Loop over triplets with the required level, find and store track candidates
 
@@ -2207,7 +2206,7 @@ void L1Algo::CATrackFinder()
 #ifdef _OPENMP
                 omp_set_lock(&fStripToTrackLock[h.f]);
 #endif
-                int& stripF = (fStripToTrackF)[h.f];
+                int& stripF = (fStripToTrack)[h.f];
                 if ((stripF >= 0) && (stripF != tr.fID)) {  // strip is used by other candidate
                   const auto& other = fTrackCandidates[TrackId2Thread(stripF)][TrackId2Track(stripF)];
                   if (!other.fIsAlive && L1Branch::compareCand(tr, other)) { stripF = tr.fID; }
@@ -2228,7 +2227,7 @@ void L1Algo::CATrackFinder()
 #ifdef _OPENMP
                 omp_set_lock(&fStripToTrackLock[h.b]);
 #endif
-                int& stripB = (fStripToTrackB)[h.b];
+                int& stripB = (fStripToTrack)[h.b];
                 if ((stripB >= 0) && (stripB != tr.fID)) {  // strip is used by other candidate
                   const auto& other = fTrackCandidates[TrackId2Thread(stripB)][TrackId2Track(stripB)];
                   if (!other.fIsAlive && L1Branch::compareCand(tr, other)) { stripB = tr.fID; }
@@ -2258,14 +2257,14 @@ void L1Algo::CATrackFinder()
             tr.fIsAlive = true;
             for (int iHit = 0; tr.fIsAlive && (iHit < (int) tr.fHits.size()); ++iHit) {
               const L1Hit& h = (*vHits)[tr.fHits[iHit]];
-              tr.fIsAlive    = tr.fIsAlive && ((fStripToTrackF)[h.f] == tr.fID) && ((fStripToTrackB)[h.b] == tr.fID);
+              tr.fIsAlive    = tr.fIsAlive && ((fStripToTrack)[h.f] == tr.fID) && ((fStripToTrack)[h.b] == tr.fID);
             }
 
             if (!tr.fIsAlive) {  // release strips
               for (int iHit = 0; (iHit < (int) tr.fHits.size()); ++iHit) {
                 const L1Hit& h = (*vHits)[tr.fHits[iHit]];
-                if (fStripToTrackF[h.f] == tr.fID) { fStripToTrackF[h.f] = -1; }
-                if (fStripToTrackB[h.b] == tr.fID) { fStripToTrackB[h.b] = -1; }
+                if (fStripToTrack[h.f] == tr.fID) { fStripToTrack[h.f] = -1; }
+                if (fStripToTrack[h.b] == tr.fID) { fStripToTrack[h.b] = -1; }
               }
             }
             else {
@@ -2299,7 +2298,7 @@ void L1Algo::CATrackFinder()
             for (L1Vector<L1HitIndex_t>::iterator phIt = tr.fHits.begin();  /// used strips are marked
                  phIt != tr.fHits.end(); ++phIt) {
               const L1Hit& h = (((*vHits))[*phIt]);
-              if (((fStripToTrackB)[h.b] != tr.fID) || ((fStripToTrackF)[h.f] != tr.fID)) {
+              if (((fStripToTrack)[h.b] != tr.fID) || ((fStripToTrack)[h.f] != tr.fID)) {
                 check = 0;
                 break;
               }
-- 
GitLab