From 61a0539f9712d39376a4bacfcb7fc6e6af2f46d6 Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Fri, 12 Apr 2024 15:09:34 -0400
Subject: [PATCH 1/2] TrigT1CaloSim: Use Accessor, etc instead of auxdata().

Replace auxdata, etc. with Accessor classes.
Moving to deprecate these usages in the Athena build.
---
 .../TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx       | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx b/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx
index 486fe3e0a72d..c480eeac5d1d 100755
--- a/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx
+++ b/Trigger/TrigT1/TrigT1CaloSim/src/Run2TriggerTowerMaker.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // ================================================
@@ -25,6 +25,7 @@
 #include "TileConditions/TileInfo.h"
 
 #include "xAODEventInfo/EventInfo.h"
+#include "AthContainers/Decorator.h"
 
 //For getting TriggerTowers from BS
 #include "TrigT1CaloByteStream/ITrigT1CaloDataAccessV2.h"
@@ -401,11 +402,11 @@ namespace LVL1 {
     // decorate the overlay TTs to indicate if they have been used or not 
     char decor_ttNotUsedInOverlay = 0;
     char decor_ttUsedInOverlay = 1;
-    std::string decor_name = "addedToSignal";
+    static const SG::Decorator<char> decor ("addedToSignal");
     for (auto tt:*overlayDataTTs) {
       // Let's exclude all dead and disabled towers
       if (IsGoodTower(tt,m_deadChannelsContaineroverlay,m_disabledTowersContaineroverlay)) {
-        tt->auxdecor<char>(decor_name) = decor_ttNotUsedInOverlay;
+        decor(*tt) = decor_ttNotUsedInOverlay;
         overlayMap.insert( std::make_pair( tt->coolId() , tt ) );
       }
     }
@@ -432,7 +433,7 @@ namespace LVL1 {
         ATH_CHECK( addOverlay(bcid,mu,tt,(*match).second) );
         
         // Let the overlay TT know that it has been used
-        (*match).second->auxdecor<char>(decor_name) = decor_ttUsedInOverlay;
+        decor(*match->second) = decor_ttUsedInOverlay;
         
       } // end of match
     } // end of loop over primary TTs 
@@ -440,7 +441,7 @@ namespace LVL1 {
     // Now we need to add all overlay TTs that have not been used so far
     for (Itr i=overlayMap.begin();i!=overlayMap.end();++i) {
       xAOD::TriggerTower* tt = (*i).second;
-      if (tt->auxdataConst<char>(decor_name) == decor_ttNotUsedInOverlay) {
+      if (decor(*tt) == decor_ttNotUsedInOverlay) {
         // Ensure that LUT vectors are the same size as the primary TTs 
         std::vector<uint8_t> overlay_lut_cp(sizeOfPrimaryLUT,0.);
         std::vector<uint8_t> overlay_lut_jep(sizeOfPrimaryLUT,0.);
-- 
GitLab


From ba3c01936b677a8ffc1cc8bfb8bdef597ada062f Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Fri, 12 Apr 2024 16:15:48 -0400
Subject: [PATCH 2/2] TrigT1Monitoring: Use Accessor, etc instead of auxdata().

Replace auxdata, etc. with Accessor classes.
Moving to deprecate these usages in the Athena build.
---
 .../src/CalorimeterL1CaloMon.cxx              | 24 ++++++++++++-------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/Trigger/TrigT1/TrigT1Monitoring/src/CalorimeterL1CaloMon.cxx b/Trigger/TrigT1/TrigT1Monitoring/src/CalorimeterL1CaloMon.cxx
index 742af38fb83a..6767d5fc4827 100644
--- a/Trigger/TrigT1/TrigT1Monitoring/src/CalorimeterL1CaloMon.cxx
+++ b/Trigger/TrigT1/TrigT1Monitoring/src/CalorimeterL1CaloMon.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
 // ********************************************************************
@@ -29,6 +29,7 @@
 #include "CaloIdentifier/CaloCell_ID.h"
 
 #include "Identifier/Identifier.h"
+#include "AthContainers/ConstAccessor.h"
 
 #include "TrigT1CaloCalibConditions/L1CaloCoolChannelId.h"
 #include "TrigT1CaloCalibToolInterfaces/IL1CaloMonitoringCaloTool.h"
@@ -749,6 +750,11 @@ StatusCode CalorimeterL1CaloMon::fillHistograms()
   double em_L1CaloE_CP = 0;
   double had_L1CaloE_CP = 0;
 
+  static const SG::ConstAccessor< std::vector<float> >
+    CaloCellEnergyByLayerAcc("CaloCellEnergyByLayer");
+  static const SG::ConstAccessor< std::vector<float> >
+    CaloCellETByLayerAcc("CaloCellETByLayer");
+
   for (; ttIterator != ttIteratorEnd; ++ttIterator) {
     double eta = (*ttIterator)->eta();
     double absEta = fabs(eta);
@@ -775,15 +781,15 @@ StatusCode CalorimeterL1CaloMon::fillHistograms()
 
       
       if (absEta < 3.2) {
-        if ( tt->isAvailable< std::vector<float> > ("CaloCellEnergyByLayer") ) {
-          for (float e : tt->auxdataConst< std::vector<float> > ("CaloCellEnergyByLayer")) {
+        if ( CaloCellEnergyByLayerAcc.isAvailable(*tt) ) {
+          for (float e : CaloCellEnergyByLayerAcc(*tt)) {
             em_caloE += e;
           }
           em_caloE = em_caloE / cosh(eta); 
         }
       } else {  // FCal: need to use different method due to large variation in cell eta 
-        if ( tt->isAvailable< std::vector<float> > ("CaloCellETByLayer") ) {
-          for (float et : tt->auxdataConst< std::vector<float> > ("CaloCellETByLayer")) {
+        if ( CaloCellETByLayerAcc.isAvailable(*tt) ) {
+          for (float et : CaloCellETByLayerAcc(*tt)) {
             em_caloE += et;
           }
         }
@@ -961,15 +967,15 @@ StatusCode CalorimeterL1CaloMon::fillHistograms()
       had_L1CaloE_CP = int(0.5*(tt->cpET())); // CP scale hardcoded for now, but this should be updated to be taken automatically
        
       if (absEta < 3.2) {
-        if ( tt->isAvailable< std::vector<float> > ("CaloCellEnergyByLayer") ) {
-          for (float e : tt->auxdataConst< std::vector<float> > ("CaloCellEnergyByLayer")) {
+        if ( CaloCellEnergyByLayerAcc.isAvailable(*tt) ) {
+          for (float e : CaloCellEnergyByLayerAcc(*tt)) {
             had_caloE += e;
           }
           had_caloE = had_caloE / cosh(eta);
         }
       } else {  // FCal: need to use different method due to large variation in cell eta 
-        if ( tt->isAvailable< std::vector<float> > ("CaloCellETByLayer") ) {
-          for (float et : tt->auxdataConst< std::vector<float> > ("CaloCellETByLayer")) {
+        if ( CaloCellETByLayerAcc.isAvailable(*tt) ) {
+          for (float et : CaloCellETByLayerAcc(*tt)) {
             had_caloE += et;
           }
         }
-- 
GitLab