From 28d702e69e391c4309c784c3ececf1fc2afe9134 Mon Sep 17 00:00:00 2001 From: ckato <ckato@cern.ch> Date: Mon, 19 Nov 2018 23:12:43 +0100 Subject: [PATCH] migrated MuonMDT_CablingSvc to readCdo in MDT_Hid2RESrcID, MdtCsmContByteStreamTool, and MdtROD_Decoder --- .../MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx | 33 ++++++++++++------- .../MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h | 11 ++++--- .../src/MdtCsmContByteStreamTool.cxx | 12 ++----- .../src/MdtCsmContByteStreamTool.h | 2 -- .../MuonMDT_CnvTools/src/MdtROD_Decoder.cxx | 19 ++++++----- .../MuonMDT_CnvTools/src/MdtROD_Decoder.h | 6 ++-- 6 files changed, 45 insertions(+), 38 deletions(-) diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx index 2619c9958af..e9d32c3447a 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx @@ -23,15 +23,17 @@ using eformat::helper::SourceIdentifier; MDT_Hid2RESrcID::MDT_Hid2RESrcID() : - m_cabling(0), m_mdtIdHelper(0), m_specialROBNumber(0) + m_mdtIdHelper(0), m_specialROBNumber(0), m_readKey("MuonMDT_CablingMap") { } -void MDT_Hid2RESrcID::set(MuonMDT_CablingSvc* p_cabling, const MdtIdHelper* mdtIdHelper) { +void MDT_Hid2RESrcID::set(const MdtIdHelper* mdtIdHelper) { // Initialize the cabling Service m_mdtIdHelper = mdtIdHelper; - m_cabling = p_cabling; + m_readKey.initialize(); + //ATH_CHECK( m_readKey.initialize() ); + //return StatusCode::SUCCESS; } uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { @@ -63,15 +65,22 @@ uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { int multilayer = m_mdtIdHelper->multilayer(offlineId); int tubelayer = m_mdtIdHelper->tubeLayer(offlineId); int tube = m_mdtIdHelper->tube(offlineId); - - online = m_cabling->getOnlineId(station_name, station_eta, - station_phi, multilayer,tubelayer, - tube, - SubsystemId, - MrodId, - LinkId, - TdcId, - ChannelId); + + SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; + const MuonMDT_CablingMap* readCdo{*readHandle}; + if(readCdo==nullptr){ + //ATH_MSG_ERROR("Null pointer to the read conditions object"); + log << MSG::ERROR << "Null pointer to the read conditions object" << endmsg; + return 0; + } + online = readCdo->getOnlineId(station_name, station_eta, + station_phi, multilayer,tubelayer, + tube, + SubsystemId, + MrodId, + LinkId, + TdcId, + ChannelId); if (!online) { log << MSG::DEBUG << "ROD Id of the Station " << MSG::hex << "0x" << offlineId diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h index f6e0103da65..e30e1331fdc 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h @@ -8,12 +8,13 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" +#include "StoreGate/ReadCondHandle.h" +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" #include "MuonIdHelpers/MdtIdHelper.h" #include "Identifier/Identifier.h" - #include <stdint.h> #include <map> @@ -36,7 +37,7 @@ public: /** intialize the cabling service */ - void set(MuonMDT_CablingSvc* p_cabling, const MdtIdHelper* m_mdtIdHelper); + void set(const MdtIdHelper* m_mdtIdHelper); /** TMP method for sector 13 data */ void setSpecialROBNumber(int specialROBNumber) {m_specialROBNumber=specialROBNumber;} @@ -58,11 +59,13 @@ public: private: - MuonMDT_CablingSvc* m_cabling; const MdtIdHelper* m_mdtIdHelper; int m_specialROBNumber; + //SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey; + }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx index 83dfa98295a..6336e8ef0af 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx @@ -5,8 +5,6 @@ #include "MdtCsmContByteStreamTool.h" #include "MdtROD_Encoder.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" - #include "MuonRDO/MdtCsm.h" #include "MuonRDO/MdtCsmContainer.h" @@ -24,7 +22,6 @@ Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool ( const std::string& type, const std::string& name,const IInterface* parent ) : AthAlgTool(type,name,parent), - m_cabling(0), m_hid2re(0), m_mdtIdHelper(0) { @@ -39,11 +36,6 @@ Muon::MdtCsmContByteStreamTool::MdtCsmContByteStreamTool StatusCode Muon::MdtCsmContByteStreamTool::initialize() { - if (StatusCode::SUCCESS != service("MuonMDT_CablingSvc", m_cabling)) { - ATH_MSG_ERROR(" Can't get MuonMDT_CablingSvc "); - return StatusCode::FAILURE; - } - StoreGateSvc * detStore; StatusCode status = service("DetectorStore", detStore); if (status.isFailure()) { @@ -63,7 +55,7 @@ StatusCode Muon::MdtCsmContByteStreamTool::initialize() { } m_hid2re = new MDT_Hid2RESrcID (); - m_hid2re->set(m_cabling, mdt_id); + m_hid2re->set(mdt_id); m_mdtIdHelper = mdt_id; @@ -81,7 +73,7 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit MsgStream& log ) { m_fea.clear(); - m_fea.idMap().set(m_cabling, m_mdtIdHelper); + m_fea.idMap().set(m_mdtIdHelper); FullEventAssembler<MDT_Hid2RESrcID>::RODDATA* theROD ; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h index b92201b2857..2dad648dc76 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h @@ -18,7 +18,6 @@ class MdtCsmContainer; class MsgStream; -class MuonMDT_CablingSvc; #include <string> @@ -65,7 +64,6 @@ public: private: - MuonMDT_CablingSvc* m_cabling; MDT_Hid2RESrcID* m_hid2re; const MdtIdHelper* m_mdtIdHelper; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx index 86a80ed5cd1..a1556a2fe44 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx @@ -25,7 +25,7 @@ static const InterfaceID IID_IMdtROD_Decoder MdtROD_Decoder::MdtROD_Decoder ( const std::string& type, const std::string& name,const IInterface* parent ) : AthAlgTool(type,name,parent), - m_EvtStore(0), m_hid2re(0), m_cabling(0), m_mdtIdHelper(0), m_rodReadOut(0), m_csmReadOut(0), + m_EvtStore(0), m_hid2re(0), m_mdtIdHelper(0), m_rodReadOut(0), m_csmReadOut(0), m_amtReadOut(0), m_hptdcReadOut(0), m_BMEpresent(false), m_BMGpresent(false), m_BMEid(-1), m_BMGid(-1) // m_debug(false), // m_log (msgSvc(), name) @@ -72,12 +72,7 @@ StatusCode MdtROD_Decoder::initialize() { // Here the mapping service has to be initialized - if (StatusCode::SUCCESS != service("MuonMDT_CablingSvc", m_cabling)) { - ATH_MSG_ERROR(" Can't get MuonMDT_CablingSvc "); - return StatusCode::FAILURE; - } - m_hid2re->set(m_cabling,m_mdtIdHelper); - + m_hid2re->set(m_mdtIdHelper); // Initialize decoding classes m_rodReadOut = new MdtRODReadOut(); @@ -96,6 +91,8 @@ StatusCode MdtROD_Decoder::initialize() { ATH_MSG_INFO("Processing configuration for layouts with BMG chambers."); m_BMGid = m_mdtIdHelper->stationNameIndex("BMG"); } + + ATH_CHECK( m_readKey.initialize() ); return StatusCode::SUCCESS; } @@ -287,7 +284,13 @@ StatusCode MdtROD_Decoder::fillCollections(const OFFLINE_FRAGMENTS_NAMESPACE::RO bool cab; - cab = m_cabling->getOfflineId(subdetId, mrodId, csmId, tdc, cha, + SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; + const MuonMDT_CablingMap* readCdo{*readHandle}; + if(readCdo==nullptr){ + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + cab = readCdo->getOfflineId(subdetId, mrodId, csmId, tdc, cha, StationName, StationEta, StationPhi, MultiLayer, TubeLayer, Tube); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h index 23e78745c42..0eb69231efe 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.h @@ -16,7 +16,8 @@ #include "MuonIdHelpers/MdtIdHelper.h" #include "MDT_Hid2RESrcID.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" #include <stdint.h> #include <map> @@ -81,7 +82,7 @@ private: StoreGateSvc *m_EvtStore; MDT_Hid2RESrcID* m_hid2re; - MuonMDT_CablingSvc* m_cabling; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; const MdtIdHelper* m_mdtIdHelper; @@ -101,6 +102,7 @@ private: // bool m_debug; //!< If true, output debugging information //MsgStream m_log; + }; /* -- GitLab