From b67f03499795d0aad4cb0adc15b3d9e08a2d57a2 Mon Sep 17 00:00:00 2001 From: Scott Snyder <scott.snyder@cern.ch> Date: Tue, 27 Sep 2022 16:37:08 +0200 Subject: [PATCH] SCT_CalibAlgs: Remove dependency on old EventInfo. SCT_CalibAlgs: Remove dependency on old EventInfo. Remove dependency on old EventInfo. --- .../SCT_CalibAlgs/CMakeLists.txt | 6 ++--- .../SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h | 4 +--- .../SCT_CalibAlgs/SCTCalibWriteTool.h | 3 --- .../SCT_CalibAlgs/src/SCTCalib.cxx | 22 ++++--------------- .../SCT_CalibAlgs/src/SCTCalibWriteTool.cxx | 15 ++----------- .../SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx | 5 +---- .../SCT_CalibAlgs/src/SCT_CalibHvTool.cxx | 9 ++++---- .../SCT_CalibAlgs/src/SCT_CalibHvTool.h | 4 +--- .../SCT_CalibAlgs/src/SCT_CalibUtilities.cxx | 17 +------------- .../SCT_CalibAlgs/src/SCT_CalibUtilities.h | 4 +--- 10 files changed, 18 insertions(+), 71 deletions(-) diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/CMakeLists.txt index c6967953099f..4c857683a4c1 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( SCT_CalibAlgs ) @@ -13,12 +13,12 @@ atlas_add_component( SCT_CalibAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib AthenaPoolUtilities Identifier EventInfo GaudiKernel InDetIdentifier SCT_CablingLib InDetRawData InDetReadoutGeometry SCT_ReadoutGeometry PathResolver InDetConditionsSummaryService SCT_ConditionsToolsLib RegistrationServicesLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib AthenaPoolUtilities Identifier GaudiKernel InDetIdentifier SCT_CablingLib InDetRawData InDetReadoutGeometry SCT_ReadoutGeometry PathResolver InDetConditionsSummaryService SCT_ConditionsToolsLib RegistrationServicesLib ) atlas_add_test( SCT_CalibUtilities_test SOURCES test/SCT_CalibUtilities_test.cxx src/SCT_CalibUtilities.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} EventInfo InDetIdentifier + LINK_LIBRARIES ${Boost_LIBRARIES} InDetIdentifier POST_EXEC_SCRIPT "nopost.sh" ) diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h index e976c1167608..963f0751d484 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalib.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -30,7 +30,6 @@ #include "Identifier/Identifier.h" #include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadHandleKey.h" -#include "xAODEventInfo/EventInfo.h" //InnerDetector #include "InDetIdentifier/SCT_ID.h" @@ -95,7 +94,6 @@ class SCTCalib : public AthAlgorithm { const SCT_ID* m_pSCTHelper{nullptr}; SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; - SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this, "EventInfoKey", "EventInfo", ""}; ToolHandle<SCTCalibWriteTool> m_pCalibWriteTool{this, "SCTCalibWriteTool", "SCTCalibWriteTool", "Tool to write out data from calibration loop"}; ToolHandle<ISCT_ConfigurationConditionsTool> m_ConfigurationConditionsTool{this, "SCT_ConfigurationConditionsTool", "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool", "Tool to retrieve SCT Configuration"}; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h index 554aba045845..7c74eb5697ac 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/SCT_CalibAlgs/SCTCalibWriteTool.h @@ -22,7 +22,6 @@ #include "AthenaKernel/IIOVDbSvc.h" #include "AthenaKernel/IAthenaOutputStreamTool.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "EventInfo/EventInfo.h" #include "Identifier/Identifier.h" #include "InDetConditionsSummaryService/InDetHierarchy.h" #include "StoreGate/ReadHandleKey.h" @@ -155,8 +154,6 @@ class SCTCalibWriteTool : public AthAlgTool { StatusCode wrapUpLorentzAngle(); private: - SG::ReadHandleKey<EventInfo> m_eventInfoKey{this, "EventInfo", "ByteStreamEventInfo"}; - int stringToInt(const std::string& s) const; StatusCode streamOutCondObjects(const std::string& foldername); diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx index 97da28a3a76b..421ac9f607c3 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalib.cxx @@ -31,10 +31,6 @@ //InnerDetector #include "InDetReadoutGeometry/SiDetectorElement.h" -//infrastructure -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - //Gaudi #include "GaudiKernel/IEventProcessor.h" @@ -195,8 +191,6 @@ StatusCode SCTCalib::initialize() { if (m_readBS) { ATH_MSG_INFO("------------> Reading from ByteStream <-------------"); m_calibEvtInfoTool->setSource("BS"); - ATH_CHECK(m_eventInfoKey.initialize()); - ATH_MSG_INFO("m_eventInfoKey.initialize() was successful"); } //--- Open HIST @@ -245,7 +239,6 @@ StatusCode SCTCalib::initialize() { m_calibEvtInfoTool->setTimeStamp(m_runStartTime, m_runEndTime); m_calibEvtInfoTool->setRunNumber(m_runNumber); m_calibEvtInfoTool->setEventNumber(m_eventNumber); - ATH_CHECK(m_eventInfoKey.initialize()); } //--- Booking histograms for hitmaps @@ -262,8 +255,6 @@ StatusCode SCTCalib::initialize() { m_calibEvtInfoTool->setTimeStamp(m_runStartTime, m_runEndTime); m_calibEvtInfoTool->setRunNumber(m_runNumber); m_calibEvtInfoTool->setEventNumber(m_eventNumber); - ATH_CHECK(m_eventInfoKey.initialize()); - ATH_MSG_DEBUG("m_eventInfoKey.initialize() was successful"); if (m_doNoisyStrip) { m_calibLbTool->read("./SCTLB.root"); } @@ -310,15 +301,10 @@ StatusCode SCTCalib::execute() { const bool majorityIsGoodOrUnused{(m_useMajority and m_MajorityConditionsTool->isGood()) or !m_useMajority}; if (m_readBS) { - ATH_MSG_DEBUG("in execute(): m_eventInfoKey = " << m_eventInfoKey); - SG::ReadHandle<xAOD::EventInfo> evt(m_eventInfoKey); - if (not evt.isValid()) { - ATH_MSG_FATAL("Unable to get the EventInfo"); - return StatusCode::FAILURE; - } //--- TimeStamp/LB range analyzed - const int timeStamp{static_cast<int>(evt->timeStamp())}; - const int lumiBlock{static_cast<int>(evt->lumiBlock())}; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const int timeStamp{static_cast<int>(ctx.eventID().time_stamp())}; + const int lumiBlock{static_cast<int>(ctx.eventID().lumi_block())}; int timeStampBeginOld; int timeStampEndOld; m_calibEvtInfoTool->getTimeStamps(timeStampBeginOld, timeStampEndOld); @@ -330,7 +316,7 @@ StatusCode SCTCalib::execute() { m_calibEvtInfoTool->setLumiBlock(lumiBlock); m_calibEvtInfoTool->setTimeStamp(timeStamp); if (m_doHitMapsLB and majorityIsGoodOrUnused) { - m_calibLbTool->setLb(evt->lumiBlock()); + m_calibLbTool->setLb(ctx.eventID().lumi_block()); } } diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx index 9d748e402d6c..4bc4bd324631 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCTCalibWriteTool.cxx @@ -21,10 +21,6 @@ #include "Identifier/IdentifierHash.h" #include "InDetIdentifier/SCT_ID.h" -// Event Info -#include "EventInfo/EventID.h" -#include "EventInfo/EventType.h" - //path resolver to find the file #include "PathResolver/PathResolver.h" @@ -92,9 +88,6 @@ SCTCalibWriteTool::initialize() return StatusCode::FAILURE; } - ATH_CHECK(m_eventInfoKey.initialize()); - ATH_MSG_DEBUG("in SCTCalibWriteTool::initialize after m_eventInfoKey initialized"); - // ------------------------------------------------------------ // The following is required for writing out something to COOL @@ -641,12 +634,8 @@ SCTCalibWriteTool::registerCondObjects(const std::string& foldername,const std:: unsigned int endRun; if (!m_manualiov) { - SG::ReadHandle<EventInfo> evt{m_eventInfoKey}; - if (not evt.isValid()) { - return StatusCode::FAILURE; - } - - beginRun = evt->event_ID()->run_number(); + const EventContext& ctx = Gaudi::Hive::currentContext(); + beginRun = ctx.eventID().run_number(); endRun = beginRun; } else { diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx index ff04a6c75861..3ffc31ba51a7 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -11,9 +11,6 @@ #include "SCT_CalibEventInfo.h" #include "SCT_CalibUtilities.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - #include "CoralBase/TimeStamp.h" namespace { diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx index d8ff8dc9fc3b..98af762b4195 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -12,9 +12,6 @@ #include "SCT_CalibUtilities.h" #include "SCT_CalibNumbers.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - using namespace SCT_CalibAlgs; static const std::string detectorNames[] {"negativeEndcap", "barrel", "positiveEndcap"}; @@ -66,13 +63,15 @@ SCT_CalibHvTool::book() { bool SCT_CalibHvTool::fill(const bool fromData) { + const EventContext& ctx = Gaudi::Hive::currentContext(); + if (fromData) { return fillFromData(); } bool result{true}; int lumi_block{0}; //fix me! const int wafersize{static_cast<int>(m_sct_waferHash->size())}; - int time_stamp{static_cast<int>(m_evt->event_ID()->time_stamp())}; + int time_stamp{static_cast<int>(ctx.eventID().time_stamp())}; int curr_time{time_stamp}; int dtime{curr_time - m_phvtripPrevTime}; int totalHits{0}; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h index 3f0f33954c22..765646aafaf1 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibHvTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -34,7 +34,6 @@ class StatusCode; class ISvcLocator; class IdentifierHash; -class EventInfo; class SCT_CalibHvTool : public extends<AthAlgTool, ISCT_CalibHistoTool> { @@ -88,7 +87,6 @@ class SCT_CalibHvTool : public extends<AthAlgTool, ISCT_CalibHistoTool> std::vector<std::vector<std::pair<int, int>>> m_summarytrips; std::vector<std::vector<std::pair<int, int>>> m_summarytripslb; - const EventInfo* m_evt{nullptr}; bool m_outputLowHits{false}; int m_lowHitCut{100}; ///retrieve a tool and report if it failed diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx index eec72480a591..33735f7a12ed 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -12,8 +12,6 @@ #include "SCT_CalibUtilities.h" //gaudi -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" #include "InDetIdentifier/SCT_ID.h" #include "Identifier/Identifier.h" #include <algorithm> //std::unique @@ -34,19 +32,6 @@ namespace SCT_CalibAlgs { } -std::string -eventInfoAsString(const EventInfo* theEvent) { - using std::string; - const EventID* e{theEvent->event_ID()}; - string result{string("[ Run, Event, Time, Lumi, Bunch ] = [ " )+ - std::to_string(e->run_number()) + ", " + - std::to_string(e->event_number()) + ", "+ - std::to_string(e->time_stamp()) + ", "+ - std::to_string(e->lumi_block()) + ", "+ - std::to_string(e->lumi_block()) + " ] "}; - return result; -}//function end - std::string formatPosition(const Identifier& waferId, const SCT_ID* helper, const std::string& delimiter, const bool includeSide) { using std::string; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h index bded77b917ad..3ce01fc8e041 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibUtilities.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /** @@ -17,11 +17,9 @@ class Identifier; class SCT_ID; -class EventInfo; namespace SCT_CalibAlgs { -std::string eventInfoAsString(const EventInfo* theEvent); std::string formatPosition(const Identifier& waferId, const SCT_ID* helper, const std::string& delimiter="_", const bool includeSide=true); std::string chipList2LinkList(const std::string& chipList); unsigned int bec2Index(const int bec); -- GitLab