From 2d40ea7f40c269cd2e56a813b9bbefcafc328b09 Mon Sep 17 00:00:00 2001
From: Debo <debottam.bakshi.gupta@cern.ch>
Date: Mon, 31 May 2021 15:39:15 +0200
Subject: [PATCH 1/2] resolving bugs in track_index assignment and updating
 references

---
 .../src/TrigEgammaFastElectronReAlgo.cxx      | 16 +++--
 .../share/ref_RDOtoRDOTrig_v1Dev_build.ref    | 66 ++++++++-----------
 .../share/ref_data_v1Dev_build.ref            | 24 +++++--
 3 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx b/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
index 98657294d5e5..810fa8cf772c 100644
--- a/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
+++ b/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
@@ -156,16 +156,17 @@ StatusCode TrigEgammaFastElectronReAlgo::execute(const EventContext& ctx) const
 
 
   // loop over tracks
-  unsigned int track_index=0;
-  for(const auto trkIter:(*tracks))
+  for(unsigned int track_index = 0; track_index < tracks->size(); track_index++)
   {
+    const xAOD::TrackParticle_v1* trkIter = (*tracks)[track_index];
     ATH_MSG_DEBUG("Track loop starts");
     ATH_MSG_VERBOSE("AlgoId = " << (trkIter)->patternRecoInfo());
     ATH_MSG_VERBOSE("At perigee:");
     ATH_MSG_DEBUG(" Pt  = " << std::abs((trkIter)->pt())); 
     ATH_MSG_DEBUG(" phi = " << std::abs((trkIter)->phi0()));
     ATH_MSG_DEBUG(" eta = " << std::abs((trkIter)->eta())); 
-    ATH_MSG_DEBUG(" z0  = " << std::abs((trkIter)->z0()));  
+    ATH_MSG_DEBUG(" z0  = " << std::abs((trkIter)->z0()));
+    ATH_MSG_DEBUG(" d0  = " << std::abs((trkIter)->d0()));  
     // ============================================= //
     // Pt cut
     float trkPt = std::abs((trkIter)->pt());
@@ -193,7 +194,8 @@ StatusCode TrigEgammaFastElectronReAlgo::execute(const EventContext& ctx) const
         calotrkdeta_noextrap_mon.push_back(calotrkdeta_noextrap);
       }
     }else {
-      ATH_MSG_DEBUG("Apply cuts");
+
+      ATH_MSG_DEBUG("Apply cuts on track with index: "<<track_index);
       if(trkPt < m_trackPtthr){
         ATH_MSG_DEBUG("Failed track pt cut " << trkPt);
         continue;
@@ -247,7 +249,9 @@ StatusCode TrigEgammaFastElectronReAlgo::execute(const EventContext& ctx) const
         (probably a safe assumption for large pT) and that track parameters
         at perigee give better estimates of angular quantities */
       ElementLink<xAOD::TrackParticleContainer> trackEL = ElementLink<xAOD::TrackParticleContainer> (*tracks, track_index);
-      
+      ATH_MSG_DEBUG("pT of trackEL: "<<(*trackEL)->pt());     
+      ATH_MSG_DEBUG("Perinting track_index: "<<track_index);
+
       ATH_MSG_DEBUG("REGTEST: TrigElectron: cluster index = " << clusEL.index() <<
                 " track = "     << trkIter << " eta = " <<  etaAtCalo << " phi = " << phiAtCalo << 
                 " deta = " << dEtaCalo << "dphi = " << dPhiCalo);
@@ -266,9 +270,9 @@ StatusCode TrigEgammaFastElectronReAlgo::execute(const EventContext& ctx) const
                 << " phiAtCalo = " << phiAtCalo << " phiAtCalo = " << trigElec->trkPhiAtCalo()
                 );
       calotrkdeta_noextrap_mon.push_back(calotrkdeta_noextrap);
+     
     }
     
-    track_index++;
   }
 
 
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index a74dc953d95f..6398cc826fb3 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -1551,19 +1551,17 @@ HLT_e26_lhloose_L1EM22VHI:
     3: 4
     4: 4
 HLT_e26_lhloose_lrtloose_L1EM22VHI:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 5
     1: 2
     2: 2
     3: 2
-    4: 1
   stepFeatures:
     0: 5
-    1: 2
+    1: 3
     2: 2
     3: 2
-    4: 1
 HLT_e26_lhmedium_L1EM15VH:
   eventCount: 4
   stepCounts:
@@ -1593,19 +1591,17 @@ HLT_e26_lhmedium_L1EM22VHI:
     3: 4
     4: 4
 HLT_e26_lhmedium_lrtloose_L1EM22VHI:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 5
     1: 2
     2: 2
     3: 2
-    4: 1
   stepFeatures:
     0: 5
-    1: 2
+    1: 3
     2: 2
     3: 2
-    4: 1
 HLT_e26_lhmedium_mu8noL1_L1EM22VHI:
   eventCount: 2
   stepCounts:
@@ -2069,19 +2065,17 @@ HLT_e26_lhtight_ivartight_L1EM22VHI:
     3: 4
     4: 3
 HLT_e26_lhtight_lrtloose_L1EM22VHI:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 5
     1: 2
     2: 2
     3: 2
-    4: 1
   stepFeatures:
     0: 5
-    1: 2
+    1: 3
     2: 2
     3: 2
-    4: 1
 HLT_e26_lhtight_nod0_L1EM22VHI:
   eventCount: 4
   stepCounts:
@@ -2281,19 +2275,17 @@ HLT_e5_lhloose_L1EM3:
     3: 23
     4: 6
 HLT_e5_lhloose_lrtloose_L1EM3:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 18
-    1: 14
-    2: 11
-    3: 11
-    4: 1
+    1: 16
+    2: 12
+    3: 12
   stepFeatures:
     0: 63
-    1: 185
-    2: 14
-    3: 13
-    4: 1
+    1: 267
+    2: 22
+    3: 21
 HLT_e5_lhloose_noringer_L1EM3:
   eventCount: 6
   stepCounts:
@@ -2323,19 +2315,17 @@ HLT_e5_lhmedium_L1EM3:
     3: 22
     4: 4
 HLT_e5_lhmedium_lrtmedium_L1EM3:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 18
-    1: 14
-    2: 11
-    3: 11
-    4: 1
+    1: 16
+    2: 12
+    3: 12
   stepFeatures:
     0: 60
-    1: 160
-    2: 14
-    3: 13
-    4: 1
+    1: 241
+    2: 21
+    3: 20
 HLT_e5_lhmedium_noringer_L1EM3:
   eventCount: 4
   stepCounts:
@@ -2403,19 +2393,17 @@ HLT_e5_lhtight_gsf_L1EM3:
     3: 22
     4: 4
 HLT_e5_lhtight_lrttight_L1EM3:
-  eventCount: 1
+  eventCount: 0
   stepCounts:
     0: 18
-    1: 14
-    2: 11
-    3: 11
-    4: 1
+    1: 16
+    2: 12
+    3: 12
   stepFeatures:
     0: 59
-    1: 145
-    2: 14
-    3: 13
-    4: 1
+    1: 226
+    2: 21
+    3: 20
 HLT_e5_lhtight_nod0_L1EM3:
   eventCount: 4
   stepCounts:
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index ec2f885117b2..56c66c94bd1d 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -1037,10 +1037,14 @@ HLT_e5_lhloose_lrtloose_L1EM3:
   eventCount: 0
   stepCounts:
     0: 10
-    1: 3
+    1: 5
+    2: 2
+    3: 2
   stepFeatures:
     0: 19
-    1: 4
+    1: 12
+    2: 3
+    3: 3
 HLT_e5_lhloose_noringer_L1EM3:
   eventCount: 0
   stepCounts:
@@ -1069,10 +1073,14 @@ HLT_e5_lhmedium_lrtmedium_L1EM3:
   eventCount: 0
   stepCounts:
     0: 10
-    1: 2
+    1: 5
+    2: 2
+    3: 2
   stepFeatures:
     0: 21
-    1: 3
+    1: 11
+    2: 3
+    3: 3
 HLT_e5_lhmedium_noringer_L1EM3:
   eventCount: 0
   stepCounts:
@@ -1129,10 +1137,14 @@ HLT_e5_lhtight_lrttight_L1EM3:
   eventCount: 0
   stepCounts:
     0: 9
-    1: 2
+    1: 5
+    2: 2
+    3: 2
   stepFeatures:
     0: 17
-    1: 3
+    1: 9
+    2: 3
+    3: 3
 HLT_e5_lhtight_nod0_L1EM3:
   eventCount: 0
   stepCounts:
-- 
GitLab


From 653bb74a858617de7c480fc3b9e7187f99e4ade8 Mon Sep 17 00:00:00 2001
From: Debo <debottam.bakshi.gupta@cern.ch>
Date: Tue, 1 Jun 2021 08:49:49 +0200
Subject: [PATCH 2/2] reducing debug messages

---
 .../TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx       | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx b/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
index 810fa8cf772c..0b6851f9dc25 100644
--- a/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
+++ b/Trigger/TrigAlgorithms/TrigEgammaFastRec/src/TrigEgammaFastElectronReAlgo.cxx
@@ -250,7 +250,6 @@ StatusCode TrigEgammaFastElectronReAlgo::execute(const EventContext& ctx) const
         at perigee give better estimates of angular quantities */
       ElementLink<xAOD::TrackParticleContainer> trackEL = ElementLink<xAOD::TrackParticleContainer> (*tracks, track_index);
       ATH_MSG_DEBUG("pT of trackEL: "<<(*trackEL)->pt());     
-      ATH_MSG_DEBUG("Perinting track_index: "<<track_index);
 
       ATH_MSG_DEBUG("REGTEST: TrigElectron: cluster index = " << clusEL.index() <<
                 " track = "     << trkIter << " eta = " <<  etaAtCalo << " phi = " << phiAtCalo << 
-- 
GitLab