diff --git a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h index e91a328d08e6a5fba9ea9f73c22df4cf1e102282..b9c63fc5f0bb64727e9e7de3b6acc36d01619df2 100644 --- a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h +++ b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/ZdcByteStream/ZdcByteStreamRawDataV2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /* @@ -17,7 +17,10 @@ #include <map> #include <string> -#include "AthenaBaseComps/AthAlgorithm.h" +#include "ZdcByteStream/ZdcDefs.h" +#include "xAODTrigL1Calo/TriggerTowerContainer.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" #include "AthContainers/DataVector.h" class ISvcLocator; @@ -28,15 +31,15 @@ class ZdcDigitsCollection; #include "xAODTrigL1Calo/TriggerTowerContainer.h" -class ZdcByteStreamRawDataV2: public AthAlgorithm +class ZdcByteStreamRawDataV2: public AthReentrantAlgorithm { public: ZdcByteStreamRawDataV2(const std::string& name, ISvcLocator* pSvcLocator); virtual ~ZdcByteStreamRawDataV2(); - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + virtual StatusCode finalize() override; private: typedef std::map<unsigned int, const xAOD::TriggerTower*> ZdcTriggerTowersMap; @@ -46,7 +49,8 @@ private: /// ZDC Container and collection /// StoreGate key - std::string m_ZdcTriggerTowerContainerLocation; + SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_ZdcTriggerTowerContainerLocation + { this, "ZdcTriggerTowerContainerLocation", ZdcDefs::ZdcTriggerTowerContainerLocation, "" }; //void setupZdcTriggerTowersMap(const xAOD::TriggerTowerContainer* ttCollection); diff --git a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/src/ZdcByteStreamRawDataV2.cxx b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/src/ZdcByteStreamRawDataV2.cxx index 4cecdecd41d2962f07a3dc70feca8b9770a9e077..622c4fa6833bc24423595b229800dd9f138040fe 100644 --- a/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/src/ZdcByteStreamRawDataV2.cxx +++ b/ForwardDetectors/ZDC/ZdcCnv/ZdcByteStream/src/ZdcByteStreamRawDataV2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /* @@ -15,7 +15,7 @@ #include "GaudiKernel/ISvcLocator.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" -#include "StoreGate/StoreGateSvc.h" +#include "StoreGate/ReadHandle.h" #include "ZdcEvent/ZdcDigits.h" #include "ZdcEvent/ZdcDigitsCollection.h" @@ -30,9 +30,8 @@ //================================================================================================== ZdcByteStreamRawDataV2::ZdcByteStreamRawDataV2(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) + AthReentrantAlgorithm(name, pSvcLocator) { - declareProperty("ZdcTriggerTowerContainerLocation", m_ZdcTriggerTowerContainerLocation = ZdcDefs::ZdcTriggerTowerContainerLocation); declareProperty("ForceSlicesLUT", m_forceSlicesLut = 0); declareProperty("ForceSlicesFADC", m_forceSlicesFadc = 0); } @@ -52,28 +51,22 @@ StatusCode ZdcByteStreamRawDataV2::initialize() msg(MSG::INFO) << "Initializing " << name() << " - package version " << PACKAGE_VERSION << endmsg; + ATH_CHECK( m_ZdcTriggerTowerContainerLocation.initialize() ); return StatusCode::SUCCESS; } //================================================================================================== //================================================================================================== -StatusCode ZdcByteStreamRawDataV2::execute() +StatusCode ZdcByteStreamRawDataV2::execute (const EventContext& ctx) const { if (!msgLvl(MSG::INFO)) return StatusCode::SUCCESS; msg(MSG::INFO); - //ZdcDigitsCollection* ttCollection = 0; - const DataHandle<xAOD::TriggerTowerContainer> ttCollection; + msg(MSG::DEBUG) << "Looking for ZDC trigger tower container at " << m_ZdcTriggerTowerContainerLocation.key() << endmsg; - msg(MSG::DEBUG) << "Looking for ZDC trigger tower container at " << m_ZdcTriggerTowerContainerLocation << endmsg; - - StatusCode sc = evtStore()->retrieve(ttCollection, m_ZdcTriggerTowerContainerLocation); - if (sc.isFailure() || !ttCollection || ttCollection->empty()) - { - msg() << "No Zdc Digits found" << endmsg; - return StatusCode::SUCCESS; - } + SG::ReadHandle<xAOD::TriggerTowerContainer> ttCollection + (m_ZdcTriggerTowerContainerLocation, ctx); msg(MSG::DEBUG) << ZdcToString(*ttCollection) << endmsg;