From de428585d85b2e76b0992c2ba7ee1854b3d94c25 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Fri, 18 Oct 2024 14:41:18 +0200 Subject: [PATCH] LArIdCnv+TileIdCnv: cleanup detector description converter - use common messaging - use helpers from base class - remove unnecessary code --- .../LArIdCnv/LArElectrodeIDDetDescrCnv.h | 31 +----- .../LArIdCnv/LArHVLineIDDetDescrCnv.h | 31 +----- .../LArIdCnv/LArOnlineIDDetDescrCnv.h | 31 +----- .../LArOnline_SuperCellIDDetDescrCnv.h | 32 +----- .../src/LArElectrodeIDDetDescrCnv.cxx | 84 ++------------ .../LArIdCnv/src/LArHVLineIDDetDescrCnv.cxx | 87 ++------------- .../LArIdCnv/src/LArOnlineIDDetDescrCnv.cxx | 87 ++------------- .../src/LArOnline_SuperCellIDDetDescrCnv.cxx | 87 ++------------- .../TileIdCnv/TileIdCnv/TileHWIDDetDescrCnv.h | 29 +---- .../TileIdCnv/src/TileHWIDDetDescrCnv.cxx | 103 ++---------------- 10 files changed, 66 insertions(+), 536 deletions(-) diff --git a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArElectrodeIDDetDescrCnv.h b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArElectrodeIDDetDescrCnv.h index 194b65ed1fea..5a55ae8de725 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArElectrodeIDDetDescrCnv.h +++ b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArElectrodeIDDetDescrCnv.h @@ -1,30 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - InDet DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: LArElectrodeIDDetDescrCnv.h,v 1.3 2009-02-11 04:50:25 ssnyder Exp $ -//<version> $Name: not supported by cvs2svn $ - #ifndef LARIDCNV_LARELECTRODEIDDETDESCRCNV_H # define LARIDCNV_LARELECTRODEIDDETDESCRCNV_H -//<<<<<< INCLUDES - -///// >>>>>> - #include "DetDescrCnvSvc/DetDescrConverter.h" -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> /** ** This class is a converter for the LArElectrodeID an IdHelper which is @@ -35,10 +17,9 @@ class LArElectrodeIDDetDescrCnv: public DetDescrConverter { public: - virtual long int repSvcType() const; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual long int repSvcType() const override; + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; // Storage type and class ID (used by CnvFactory) static long storageType(); @@ -47,8 +28,4 @@ public: LArElectrodeIDDetDescrCnv(ISvcLocator* svcloc); }; - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - #endif // LARIDCNV_LARELECTRODEIDDETDESCRCNV_H diff --git a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArHVLineIDDetDescrCnv.h b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArHVLineIDDetDescrCnv.h index 6f9dfd3724c1..a5f3b53dc4d9 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArHVLineIDDetDescrCnv.h +++ b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArHVLineIDDetDescrCnv.h @@ -1,30 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - InDet DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: LArHVLineIDDetDescrCnv.h,v 1.3 2009-02-11 04:50:25 ssnyder Exp $ -//<version> $Name: not supported by cvs2svn $ - #ifndef LARIDCNV_LARHVLINEIDDETDESCRCNV_H # define LARIDCNV_LARHVLINEIDDETDESCRCNV_H -//<<<<<< INCLUDES - -///// >>>>>> - #include "DetDescrCnvSvc/DetDescrConverter.h" -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> /** ** This class is a converter for the LArHVLineID an IdHelper which is @@ -36,10 +18,9 @@ class LArHVLineIDDetDescrCnv: public DetDescrConverter { public: - virtual long int repSvcType() const; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual long int repSvcType() const override; + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; // Storage type and class ID (used by CnvFactory) static long storageType(); @@ -48,8 +29,4 @@ public: LArHVLineIDDetDescrCnv(ISvcLocator* svcloc); }; - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - #endif // LARIDCNV_LARHVLINEIDDETDESCRCNV_H diff --git a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnlineIDDetDescrCnv.h b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnlineIDDetDescrCnv.h index f6463608cc4a..cb9c01068ce4 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnlineIDDetDescrCnv.h +++ b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnlineIDDetDescrCnv.h @@ -1,30 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - InDet DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: LArOnlineIDDetDescrCnv.h,v 1.5 2009-02-11 04:50:25 ssnyder Exp $ -//<version> $Name: not supported by cvs2svn $ - #ifndef LARIDCNV_LARONLINEIDDETDESCRCNV_H # define LARIDCNV_LARONLINEIDDETDESCRCNV_H -//<<<<<< INCLUDES - -///// >>>>>> - #include "DetDescrCnvSvc/DetDescrConverter.h" -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> /** ** This class is a converter for the LArOnlineID an IdHelper which is @@ -36,10 +18,9 @@ class LArOnlineIDDetDescrCnv: public DetDescrConverter { public: - virtual long int repSvcType() const; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual long int repSvcType() const override; + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; // Storage type and class ID (used by CnvFactory) static long storageType(); @@ -48,8 +29,4 @@ public: LArOnlineIDDetDescrCnv(ISvcLocator* svcloc); }; - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - #endif // LARIDCNV_LARONLINEIDDETDESCRCNV_H diff --git a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnline_SuperCellIDDetDescrCnv.h b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnline_SuperCellIDDetDescrCnv.h index 625c78bdc0ac..2e3baafd04cf 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnline_SuperCellIDDetDescrCnv.h +++ b/LArCalorimeter/LArCnv/LArIdCnv/LArIdCnv/LArOnline_SuperCellIDDetDescrCnv.h @@ -1,31 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - InDet DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: LArOnline_SuperCellIDDetDescrCnv.h,v 1.5 2009-02-11 04:50:25 ssnyder Exp $ -//<version> $Name: not supported by cvs2svn $ - #ifndef LARIDCNV_LARONLINE_SUPERCELLIDDETDESCRCNV_H # define LARIDCNV_LARONLINE_SUPERCELLIDDETDESCRCNV_H -//<<<<<< INCLUDES - -///// >>>>>> - #include "DetDescrCnvSvc/DetDescrConverter.h" -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> - /** ** This class is a converter for the LArOnline_SuperCellID an IdHelper which is ** stored in the detector store. This class derives from @@ -36,10 +17,9 @@ class LArOnline_SuperCellIDDetDescrCnv: public DetDescrConverter { public: - virtual long int repSvcType() const; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual long int repSvcType() const override; + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; // Storage type and class ID (used by CnvFactory) static long storageType(); @@ -48,8 +28,4 @@ public: LArOnline_SuperCellIDDetDescrCnv(ISvcLocator* svcloc); }; - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - #endif // LARIDCNV_LARONLINE_SUPERCELLIDDETDESCRCNV_H diff --git a/LArCalorimeter/LArCnv/LArIdCnv/src/LArElectrodeIDDetDescrCnv.cxx b/LArCalorimeter/LArCnv/LArIdCnv/src/LArElectrodeIDDetDescrCnv.cxx index 19a285ee5e16..3a319b15994e 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/src/LArElectrodeIDDetDescrCnv.cxx +++ b/LArCalorimeter/LArCnv/LArIdCnv/src/LArElectrodeIDDetDescrCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -29,90 +29,27 @@ StatusCode LArElectrodeIDDetDescrCnv::initialize() { // First call parent init - StatusCode sc = DetDescrConverter::initialize(); - MsgStream log(msgSvc(), "LArElectrodeIDDetDescrCnv"); - log << MSG::DEBUG << "in initialize" << endmsg; - - if (sc.isFailure()) { - log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg; - return sc; - } - - return StatusCode::SUCCESS; -} - -//-------------------------------------------------------------------- - -StatusCode -LArElectrodeIDDetDescrCnv::finalize() -{ - MsgStream log(msgSvc(), "LArElectrodeIDDetDescrCnv"); - log << MSG::DEBUG << "in finalize" << endmsg; - - return StatusCode::SUCCESS; + ATH_CHECK( DetDescrConverter::initialize() ); + return StatusCode::SUCCESS; } //-------------------------------------------------------------------- StatusCode -LArElectrodeIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) +LArElectrodeIDDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj) { - //StatusCode sc = StatusCode::SUCCESS; - MsgStream log(msgSvc(), "LArElectrodeIDDetDescrCnv"); - log << MSG::INFO << "in createObj: creating a LArElectrodeID helper object in the detector store" << endmsg; - - // Create a new LArElectrodeID - - DetDescrAddress* ddAddr; - ddAddr = dynamic_cast<DetDescrAddress*> (pAddr); - if(!ddAddr) { - log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg; - return StatusCode::FAILURE; - } - - // Get the StoreGate key of this container. - std::string helperKey = *( ddAddr->par() ); - if ("" == helperKey) { - log << MSG::DEBUG << "No Helper key " << endmsg; - } - else { - log << MSG::DEBUG << "Helper key is " << helperKey << endmsg; - } - - - // get DetectorStore service - StoreGateSvc * detStore; - StatusCode status = serviceLocator()->service("DetectorStore", detStore); - if (status.isFailure()) { - log << MSG::FATAL << "DetectorStore service not found !" << endmsg; - return StatusCode::FAILURE; - } else {} - + ATH_MSG_INFO("in createObj: creating a LArElectrodeID helper object in the detector store"); + // Get the dictionary manager from the detector store - //const DataHandle<IdDictManager> idDictMgr; const IdDictManager* idDictMgr; - status = detStore->retrieve(idDictMgr, "IdDict"); - if (status.isFailure()) { - log << MSG::FATAL << "Could not get IdDictManager !" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Found the IdDictManager. " << endmsg; - } - + ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") ); // create the helper LArElectrodeID* electrode_id = new LArElectrodeID; // pass a pointer to IMessageSvc to the helper electrode_id->setMessageSvc(msgSvc()); - if (idDictMgr->initializeHelper(*electrode_id)) { - log << MSG::ERROR << "Unable to initialize LArElectrodeID" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Initialized LArElectrodeID. " << endmsg; - } + ATH_CHECK( idDictMgr->initializeHelper(*electrode_id) == 0 ); // Pass a pointer to the container to the Persistency service by reference. pObj = SG::asStorable(electrode_id); @@ -137,8 +74,5 @@ LArElectrodeIDDetDescrCnv::classID() { //-------------------------------------------------------------------- LArElectrodeIDDetDescrCnv::LArElectrodeIDDetDescrCnv(ISvcLocator* svcloc) : - DetDescrConverter(ClassID_traits<LArElectrodeID>::ID(), svcloc) + DetDescrConverter(ClassID_traits<LArElectrodeID>::ID(), svcloc, "LArElectrodeIDDetDescrCnv") {} - - - diff --git a/LArCalorimeter/LArCnv/LArIdCnv/src/LArHVLineIDDetDescrCnv.cxx b/LArCalorimeter/LArCnv/LArIdCnv/src/LArHVLineIDDetDescrCnv.cxx index 0ede8790ef10..077cc21826a8 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/src/LArHVLineIDDetDescrCnv.cxx +++ b/LArCalorimeter/LArCnv/LArIdCnv/src/LArHVLineIDDetDescrCnv.cxx @@ -1,13 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - LAr DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - - #include "LArIdCnv/LArHVLineIDDetDescrCnv.h" #include "DetDescrCnvSvc/DetDescrConverter.h" @@ -29,90 +23,27 @@ StatusCode LArHVLineIDDetDescrCnv::initialize() { // First call parent init - StatusCode sc = DetDescrConverter::initialize(); - MsgStream log(msgSvc(), "LArHVLineIDDetDescrCnv"); - log << MSG::DEBUG << "in initialize" << endmsg; - - if (sc.isFailure()) { - log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg; - return sc; - } - - return StatusCode::SUCCESS; -} - -//-------------------------------------------------------------------- - -StatusCode -LArHVLineIDDetDescrCnv::finalize() -{ - MsgStream log(msgSvc(), "LArHVLineIDDetDescrCnv"); - log << MSG::DEBUG << "in finalize" << endmsg; - - return StatusCode::SUCCESS; + ATH_CHECK( DetDescrConverter::initialize() ); + return StatusCode::SUCCESS; } //-------------------------------------------------------------------- StatusCode -LArHVLineIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) +LArHVLineIDDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj) { - //StatusCode sc = StatusCode::SUCCESS; - MsgStream log(msgSvc(), "LArHVLineIDDetDescrCnv"); - log << MSG::INFO << "in createObj: creating a LArHVLineID helper object in the detector store" << endmsg; - - // Create a new LArHVLineID - - DetDescrAddress* ddAddr; - ddAddr = dynamic_cast<DetDescrAddress*> (pAddr); - if(!ddAddr) { - log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg; - return StatusCode::FAILURE; - } - - // Get the StoreGate key of this container. - std::string helperKey = *( ddAddr->par() ); - if ("" == helperKey) { - log << MSG::DEBUG << "No Helper key " << endmsg; - } - else { - log << MSG::DEBUG << "Helper key is " << helperKey << endmsg; - } - - - // get DetectorStore service - StoreGateSvc * detStore; - StatusCode status = serviceLocator()->service("DetectorStore", detStore); - if (status.isFailure()) { - log << MSG::FATAL << "DetectorStore service not found !" << endmsg; - return StatusCode::FAILURE; - } else {} - + ATH_MSG_INFO("in createObj: creating a LArHVLineID helper object in the detector store"); + // Get the dictionary manager from the detector store - //const DataHandle<IdDictManager> idDictMgr; const IdDictManager* idDictMgr; - status = detStore->retrieve(idDictMgr, "IdDict"); - if (status.isFailure()) { - log << MSG::FATAL << "Could not get IdDictManager !" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Found the IdDictManager. " << endmsg; - } - + ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") ); // create the helper LArHVLineID* hvline_id = new LArHVLineID; // pass a pointer to IMessageSvc to the helper hvline_id->setMessageSvc(msgSvc()); - if (idDictMgr->initializeHelper(*hvline_id)) { - log << MSG::ERROR << "Unable to initialize LArHVLineID" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Initialized LArHVLineID. " << endmsg; - } + ATH_CHECK( idDictMgr->initializeHelper(*hvline_id) == 0 ); // Pass a pointer to the container to the Persistency service by reference. pObj = SG::asStorable(hvline_id); @@ -137,7 +68,7 @@ LArHVLineIDDetDescrCnv::classID() { //-------------------------------------------------------------------- LArHVLineIDDetDescrCnv::LArHVLineIDDetDescrCnv(ISvcLocator* svcloc) : - DetDescrConverter(ClassID_traits<LArHVLineID>::ID(), svcloc) + DetDescrConverter(ClassID_traits<LArHVLineID>::ID(), svcloc, "LArHVLineIDDetDescrCnv") {} diff --git a/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnlineIDDetDescrCnv.cxx b/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnlineIDDetDescrCnv.cxx index 29287fcd31c6..a0d3e06cc8c6 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnlineIDDetDescrCnv.cxx +++ b/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnlineIDDetDescrCnv.cxx @@ -1,13 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - LAr DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - - #include "LArIdCnv/LArOnlineIDDetDescrCnv.h" #include "DetDescrCnvSvc/DetDescrConverter.h" @@ -29,90 +23,27 @@ StatusCode LArOnlineIDDetDescrCnv::initialize() { // First call parent init - StatusCode sc = DetDescrConverter::initialize(); - MsgStream log(msgSvc(), "LArOnlineIDDetDescrCnv"); - log << MSG::DEBUG << "in initialize" << endmsg; - - if (sc.isFailure()) { - log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg; - return sc; - } - - return StatusCode::SUCCESS; -} - -//-------------------------------------------------------------------- - -StatusCode -LArOnlineIDDetDescrCnv::finalize() -{ - MsgStream log(msgSvc(), "LArOnlineIDDetDescrCnv"); - log << MSG::DEBUG << "in finalize" << endmsg; - - return StatusCode::SUCCESS; + ATH_CHECK( DetDescrConverter::initialize() ); + return StatusCode::SUCCESS; } //-------------------------------------------------------------------- StatusCode -LArOnlineIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) +LArOnlineIDDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj) { - //StatusCode sc = StatusCode::SUCCESS; - MsgStream log(msgSvc(), "LArOnlineIDDetDescrCnv"); - log << MSG::INFO << "in createObj: creating a LArOnlineID helper object in the detector store" << endmsg; - - // Create a new LArOnlineID - - DetDescrAddress* ddAddr; - ddAddr = dynamic_cast<DetDescrAddress*> (pAddr); - if(!ddAddr) { - log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg; - return StatusCode::FAILURE; - } - - // Get the StoreGate key of this container. - std::string helperKey = *( ddAddr->par() ); - if ("" == helperKey) { - log << MSG::DEBUG << "No Helper key " << endmsg; - } - else { - log << MSG::DEBUG << "Helper key is " << helperKey << endmsg; - } - - - // get DetectorStore service - StoreGateSvc * detStore; - StatusCode status = serviceLocator()->service("DetectorStore", detStore); - if (status.isFailure()) { - log << MSG::FATAL << "DetectorStore service not found !" << endmsg; - return StatusCode::FAILURE; - } else {} - + ATH_MSG_INFO("in createObj: creating a LArOnlineID helper object in the detector store"); + // Get the dictionary manager from the detector store - //const DataHandle<IdDictManager> idDictMgr; const IdDictManager* idDictMgr; - status = detStore->retrieve(idDictMgr, "IdDict"); - if (status.isFailure()) { - log << MSG::FATAL << "Could not get IdDictManager !" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Found the IdDictManager. " << endmsg; - } - + ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") ); // create the helper LArOnlineID* online_id = new LArOnlineID; // pass a pointer to IMessageSvc to the helper online_id->setMessageSvc(msgSvc()); - if (idDictMgr->initializeHelper(*online_id)) { - log << MSG::ERROR << "Unable to initialize LArOnlineID" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Initialized LArOnlineID. " << endmsg; - } + ATH_CHECK( idDictMgr->initializeHelper(*online_id) == 0 ); // Pass a pointer to the container to the Persistency service by reference. pObj = SG::asStorable(online_id); @@ -138,7 +69,7 @@ LArOnlineIDDetDescrCnv::classID() { //-------------------------------------------------------------------- LArOnlineIDDetDescrCnv::LArOnlineIDDetDescrCnv(ISvcLocator* svcloc) : - DetDescrConverter(ClassID_traits<LArOnlineID>::ID(), svcloc) + DetDescrConverter(ClassID_traits<LArOnlineID>::ID(), svcloc, "LArOnlineIDDetDescrCnv") {} diff --git a/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnline_SuperCellIDDetDescrCnv.cxx b/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnline_SuperCellIDDetDescrCnv.cxx index 85f1976f403e..a92e868b1cc4 100755 --- a/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnline_SuperCellIDDetDescrCnv.cxx +++ b/LArCalorimeter/LArCnv/LArIdCnv/src/LArOnline_SuperCellIDDetDescrCnv.cxx @@ -1,13 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - LAr DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - - #include "LArIdCnv/LArOnline_SuperCellIDDetDescrCnv.h" #include "DetDescrCnvSvc/DetDescrConverter.h" @@ -29,90 +23,27 @@ StatusCode LArOnline_SuperCellIDDetDescrCnv::initialize() { // First call parent init - StatusCode sc = DetDescrConverter::initialize(); - MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv"); - log << MSG::DEBUG << "in initialize" << endmsg; - - if (sc.isFailure()) { - log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg; - return sc; - } - - return StatusCode::SUCCESS; -} - -//-------------------------------------------------------------------- - -StatusCode -LArOnline_SuperCellIDDetDescrCnv::finalize() -{ - MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv"); - log << MSG::DEBUG << "in finalize" << endmsg; - - return StatusCode::SUCCESS; + ATH_CHECK( DetDescrConverter::initialize() ); + return StatusCode::SUCCESS; } //-------------------------------------------------------------------- StatusCode -LArOnline_SuperCellIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) +LArOnline_SuperCellIDDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj) { - //StatusCode sc = StatusCode::SUCCESS; - MsgStream log(msgSvc(), "LArOnline_SuperCellIDDetDescrCnv"); - log << MSG::INFO << "in createObj: creating a LArOnline_SuperCellID helper object in the detector store" << endmsg; - - // Create a new LArOnline_SuperCellID - - DetDescrAddress* ddAddr; - ddAddr = dynamic_cast<DetDescrAddress*> (pAddr); - if(!ddAddr) { - log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg; - return StatusCode::FAILURE; - } - - // Get the StoreGate key of this container. - std::string helperKey = *( ddAddr->par() ); - if ("" == helperKey) { - log << MSG::DEBUG << "No Helper key " << endmsg; - } - else { - log << MSG::DEBUG << "Helper key is " << helperKey << endmsg; - } - - - // get DetectorStore service - StoreGateSvc * detStore; - StatusCode status = serviceLocator()->service("DetectorStore", detStore); - if (status.isFailure()) { - log << MSG::FATAL << "DetectorStore service not found !" << endmsg; - return StatusCode::FAILURE; - } else {} - + ATH_MSG_INFO("in createObj: creating a LArOnline_SuperCellID helper object in the detector store"); + // Get the dictionary manager from the detector store - //const DataHandle<IdDictManager> idDictMgr; const IdDictManager* idDictMgr; - status = detStore->retrieve(idDictMgr, "IdDict"); - if (status.isFailure()) { - log << MSG::FATAL << "Could not get IdDictManager !" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Found the IdDictManager. " << endmsg; - } - + ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") ); // create the helper LArOnline_SuperCellID* online_id = new LArOnline_SuperCellID; // pass a pointer to IMessageSvc to the helper online_id->setMessageSvc(msgSvc()); - if (idDictMgr->initializeHelper(*online_id)) { - log << MSG::ERROR << "Unable to initialize LArOnline_SuperCellID" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Initialized LArOnline_SuperCellID. " << endmsg; - } + ATH_CHECK( idDictMgr->initializeHelper(*online_id) == 0 ); // Pass a pointer to the container to the Persistency service by reference. pObj = SG::asStorable(online_id); @@ -138,7 +69,7 @@ LArOnline_SuperCellIDDetDescrCnv::classID() { //-------------------------------------------------------------------- LArOnline_SuperCellIDDetDescrCnv::LArOnline_SuperCellIDDetDescrCnv(ISvcLocator* svcloc) : - DetDescrConverter(ClassID_traits<LArOnline_SuperCellID>::ID(), svcloc) + DetDescrConverter(ClassID_traits<LArOnline_SuperCellID>::ID(), svcloc, "LArOnline_SuperCellIDDetDescrCnv") {} diff --git a/TileCalorimeter/TileSvc/TileIdCnv/TileIdCnv/TileHWIDDetDescrCnv.h b/TileCalorimeter/TileSvc/TileIdCnv/TileIdCnv/TileHWIDDetDescrCnv.h index daaa9f53c77e..27b897ab7c1a 100755 --- a/TileCalorimeter/TileSvc/TileIdCnv/TileIdCnv/TileHWIDDetDescrCnv.h +++ b/TileCalorimeter/TileSvc/TileIdCnv/TileIdCnv/TileHWIDDetDescrCnv.h @@ -1,28 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - Tile DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: TileHWIDDetDescrCnv.h,v 1.5 2009-02-12 10:11:08 solodkov Exp $ -//<version> $Name: not supported by cvs2svn $ - #ifndef TILEIDCNV_TILEHWIDDETDESCRCNV_H # define TILEIDCNV_TILEHWIDDETDESCRCNV_H -//<<<<<< INCLUDES >>>>>> - #include "DetDescrCnvSvc/DetDescrConverter.h" -//<<<<<< PUBLIC DEFINES >>>>>> -//<<<<<< PUBLIC CONSTANTS >>>>>> -//<<<<<< PUBLIC TYPES >>>>>> -//<<<<<< PUBLIC VARIABLES >>>>>> -//<<<<<< PUBLIC FUNCTIONS >>>>>> -//<<<<<< CLASS DECLARATIONS >>>>>> /** ** This class is a converter for the TileHWID an IdHelper which is @@ -34,21 +18,16 @@ class TileHWIDDetDescrCnv: public DetDescrConverter { public: - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj); + virtual StatusCode initialize() override; + virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override; // Storage type and class ID (used by CnvFactory) - virtual long repSvcType() const; + virtual long repSvcType() const override; static long storageType(); static const CLID& classID(); TileHWIDDetDescrCnv(ISvcLocator* svcloc); }; - -//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> - #endif // TILEDETMGRDETDESCRCNV_TILEHWIDDETDESCRCNV_H diff --git a/TileCalorimeter/TileSvc/TileIdCnv/src/TileHWIDDetDescrCnv.cxx b/TileCalorimeter/TileSvc/TileIdCnv/src/TileHWIDDetDescrCnv.cxx index e29433385d8f..b8daaa9921c1 100755 --- a/TileCalorimeter/TileSvc/TileIdCnv/src/TileHWIDDetDescrCnv.cxx +++ b/TileCalorimeter/TileSvc/TileIdCnv/src/TileHWIDDetDescrCnv.cxx @@ -1,17 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** - Tile DetDescrCnv package - ----------------------------------------- - ***************************************************************************/ - -//<doc><file> $Id: TileHWIDDetDescrCnv.cxx,v 1.7 2009-02-12 10:11:09 solodkov Exp $ -//<version> $Name: not supported by cvs2svn $ - -//<<<<<< INCLUDES >>>>>> - #include "TileIdCnv/TileHWIDDetDescrCnv.h" #include "DetDescrCnvSvc/DetDescrConverter.h" @@ -20,93 +10,26 @@ #include "StoreGate/StoreGateSvc.h" #include "IdDictDetDescr/IdDictManager.h" -//#include "Identifier/IdentifierHash.h" #include "TileIdentifier/TileHWID.h" -//<<<<<< PRIVATE DEFINES >>>>>> -//<<<<<< PRIVATE CONSTANTS >>>>>> -//<<<<<< PRIVATE TYPES >>>>>> -//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> -//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> -//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> -//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> -//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> - -StatusCode +StatusCode TileHWIDDetDescrCnv::initialize() { // First call parent init - StatusCode sc = DetDescrConverter::initialize(); - MsgStream log(msgSvc(), "TileHWIDDetDescrCnv"); - log << MSG::DEBUG << "in initialize" << endmsg; - - if (sc.isFailure()) { - log << MSG::ERROR << "DetDescrConverter::initialize failed" << endmsg; - return sc; - } - - return StatusCode::SUCCESS; -} - -//-------------------------------------------------------------------- - -StatusCode -TileHWIDDetDescrCnv::finalize() -{ - MsgStream log(msgSvc(), "TileHWIDDetDescrCnv"); - log << MSG::DEBUG << "in finalize" << endmsg; - - return StatusCode::SUCCESS; + ATH_CHECK( DetDescrConverter::initialize() ); + return StatusCode::SUCCESS; } //-------------------------------------------------------------------- StatusCode -TileHWIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) +TileHWIDDetDescrCnv::createObj(IOpaqueAddress* /*pAddr*/, DataObject*& pObj) { - //StatusCode sc = StatusCode::SUCCESS; - MsgStream log(msgSvc(), "TileHWIDDetDescrCnv"); - log << MSG::INFO << "in createObj: creating a TileHWID helper object in the detector store" << endmsg; - - // Create a new TileHWID - - DetDescrAddress* ddAddr; - ddAddr = dynamic_cast<DetDescrAddress*> (pAddr); - if(!ddAddr) { - log << MSG::FATAL << "Could not cast to DetDescrAddress." << endmsg; - return StatusCode::FAILURE; - } - - // Get the StoreGate key of this container. - std::string helperKey = *( ddAddr->par() ); - if ("" == helperKey) { - log << MSG::DEBUG << "No Helper key " << endmsg; - } - else { - log << MSG::DEBUG << "Helper key is " << helperKey << endmsg; - } - - - // get DetectorStore service - StoreGateSvc * detStore; - StatusCode status = serviceLocator()->service("DetectorStore", detStore); - if (status.isFailure()) { - log << MSG::FATAL << "DetectorStore service not found !" << endmsg; - return StatusCode::FAILURE; - } else {} - + ATH_MSG_INFO("in createObj: creating a TileHWID helper object in the detector store"); + // Get the dictionary manager from the detector store const IdDictManager* idDictMgr; - status = detStore->retrieve(idDictMgr, "IdDict"); - if (status.isFailure()) { - log << MSG::FATAL << "Could not get IdDictManager !" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Found the IdDictManager. " << endmsg; - } - + ATH_CHECK( detStore()->retrieve(idDictMgr, "IdDict") ); // create the helper TileHWID* tilehw_id = new TileHWID; @@ -114,13 +37,7 @@ TileHWIDDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) // pass a pointer to IMessageSvc to the helper tilehw_id->setMessageSvc(msgSvc()); - if (idDictMgr->initializeHelper(*tilehw_id)) { - log << MSG::ERROR << "Unable to initialize TileHWID" << endmsg; - return StatusCode::FAILURE; - } - else { - log << MSG::DEBUG << " Initialized TileHWID. " << endmsg; - } + ATH_CHECK( idDictMgr->initializeHelper(*tilehw_id) == 0 ); // Pass a pointer to the container to the Persistency service by reference. pObj = SG::asStorable(tilehw_id); @@ -152,6 +69,6 @@ TileHWIDDetDescrCnv::classID() { //-------------------------------------------------------------------- TileHWIDDetDescrCnv::TileHWIDDetDescrCnv(ISvcLocator* svcloc) : - DetDescrConverter(ClassID_traits<TileHWID>::ID(), svcloc) + DetDescrConverter(ClassID_traits<TileHWID>::ID(), svcloc, "TileHWIDDetDescrCnv") {} -- GitLab