From dbad6fb7bdae52e957c722f7b4d28fd25916ec8a Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Thu, 22 Sep 2022 18:48:04 +0200
Subject: [PATCH] PixelCalibAlgs: Remove dependency on old EventInfo.

Remove dependency on old EventInfo.
---
 .../InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt |  2 +-
 .../PixelCalibAlgs/src/HitMapBuilder.cxx         | 11 +++--------
 .../PixelCalibAlgs/src/OccupancyMapMaker.cxx     | 16 ++++------------
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt
index 20da9b781a0c..0f17da4051e5 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt
@@ -14,7 +14,7 @@ atlas_add_library( PixelCalibAlgsLib
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
    LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps CxxUtils GaudiKernel InDetConditionsSummaryService 
    InDetPrepRawData InDetReadoutGeometry PixelGeoModelLib PixelReadoutGeometryLib PixelConditionsData StoreGateLib
-   PRIVATE_LINK_LIBRARIES AthenaPoolUtilities EventInfo InDetIdentifier InDetRawData )
+   PRIVATE_LINK_LIBRARIES AthenaPoolUtilities InDetIdentifier InDetRawData )
 
 atlas_add_component( PixelCalibAlgs
    src/components/*.cxx
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/HitMapBuilder.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/HitMapBuilder.cxx
index 2e17c82269d9..39504c68db08 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/HitMapBuilder.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/HitMapBuilder.cxx
@@ -18,9 +18,6 @@
 #include "InDetReadoutGeometry/SiDetectorElement.h"
 #include "InDetReadoutGeometry/SiDetectorElementCollection.h"
 
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
-
 // geometry
 #include "InDetIdentifier/PixelID.h"
 
@@ -366,14 +363,12 @@ StatusCode HitMapBuilder::registerHistograms() {
 StatusCode HitMapBuilder::execute() {
   ATH_MSG_DEBUG( "Executing HitMapBuilder" );
 
-  // retrieve EventInfo
-  const EventInfo* eventInfo;
-  ATH_CHECK( evtStore()->retrieve(eventInfo) );
+  const EventContext& ctx = Gaudi::Hive::currentContext();
 
   // check LB is in allowed range
-  int LB =  static_cast<int>(eventInfo->event_ID()->lumi_block());
+  int LB =  static_cast<int>(ctx.eventID().lumi_block());
   if ((LB < m_evt_lbMin) || (m_evt_lbMax >= m_evt_lbMin && LB > m_evt_lbMax)) {
-    ATH_MSG_VERBOSE("Event in lumiblock " << eventInfo->event_ID()->lumi_block() << " not in selected range [" << m_evt_lbMin << "," << m_evt_lbMax << "] => skipped");
+    ATH_MSG_VERBOSE("Event in lumiblock " << LB << " not in selected range [" << m_evt_lbMin << "," << m_evt_lbMax << "] => skipped");
     return StatusCode::SUCCESS;
   }
 
diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OccupancyMapMaker.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OccupancyMapMaker.cxx
index 1f305fedccc5..ce73f85e122d 100755
--- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OccupancyMapMaker.cxx
+++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OccupancyMapMaker.cxx
@@ -11,8 +11,6 @@
 
 // EDM
 #include "InDetRawData/PixelRDO_Container.h"
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
 
 // geometry
 #include "InDetIdentifier/PixelID.h"
@@ -301,25 +299,19 @@ StatusCode OccupancyMapMaker::registerHistograms(){
 StatusCode OccupancyMapMaker::execute(){
   ATH_MSG_DEBUG( "Executing OccupancyMapMaker" );
 
-  // retrieve EventInfo
-  const EventInfo* eventInfo;
-  StatusCode sc = evtStore()->retrieve(eventInfo);
-  if( !sc.isSuccess() ){
-    ATH_MSG_FATAL("Unable to retrieve event info");
-    return StatusCode::FAILURE;
-  } ATH_MSG_DEBUG("Event info retrieved");
+  const EventContext& ctx = Gaudi::Hive::currentContext();
 
   // check LB is in allowed range
-  unsigned int LB =  eventInfo->event_ID()->lumi_block();
+  unsigned int LB =  ctx.eventID().lumi_block();
   if( (LB < m_evt_lbMin) || (m_evt_lbMax >= m_evt_lbMin && LB > m_evt_lbMax) ){
-    ATH_MSG_VERBOSE("Event in lumiblock " << eventInfo->event_ID()->lumi_block() <<
+    ATH_MSG_VERBOSE("Event in lumiblock " << LB <<
 		    " not in selected range [" << m_evt_lbMin << "," << m_evt_lbMax << "] => skipped");    
     return StatusCode::SUCCESS;
   }
 
   // retrieve PixelRDO container
   const PixelRDO_Container* pixelRDOs = nullptr;
-  sc = evtStore()->retrieve(pixelRDOs, m_pixelRDOKey);
+  StatusCode sc = evtStore()->retrieve(pixelRDOs, m_pixelRDOKey);
   if( !sc.isSuccess() ){
     ATH_MSG_FATAL( "Unable to retrieve pixel RDO container at " << m_pixelRDOKey );
     return StatusCode::FAILURE;
-- 
GitLab