diff --git a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h index c2ee5f755afd39bede1f88b49822a8ac7ecc7546..b4af30a6edeb103ee17360e7ea8e7f21efa22fb5 100644 --- a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h +++ b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h @@ -71,6 +71,9 @@ class MuonMDT_CablingMap : public MdtMapBase<MdtSubdetectorMap> { /** return the ROD id of a given chamber, given the hash id */ uint32_t getROBId(const IdentifierHash stationCode) const; + /** get the robs corresponding to a vector of hashIds, copied from Svc before the readCdo migration */ + std::vector<uint32_t> getROBId(const std::vector<IdentifierHash>& mdtHashVector) const; + /** return a vector of HashId lists for a given list of ROD's */ const std::vector<IdentifierHash> getChamberHashVec(const std::vector< uint32_t> &ROBId_list) const; diff --git a/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx b/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx index 9e598e05feaf1a253a2cf97dcd3fa4d0cf3dbe2e..a66b346cbc464c751a026f05cc1ff6f7fee51e49 100644 --- a/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx +++ b/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #include "MuonCablingData/MuonMDT_CablingMap.h" @@ -407,6 +407,7 @@ uint32_t MuonMDT_CablingMap::getROBId(int station, int eta, int phi) const } // get the ROBid given the identifier hash + uint32_t MuonMDT_CablingMap::getROBId(const IdentifierHash stationCode) const { int rodId = 0; @@ -423,6 +424,29 @@ uint32_t MuonMDT_CablingMap::getROBId(const IdentifierHash stationCode) const return rodId; } +//get the robs corresponding to a vector of hashIds, copied from Svc before the readCdo migration + +std::vector<uint32_t> MuonMDT_CablingMap::getROBId(const std::vector<IdentifierHash>& mdtHashVector) const +{ + std::vector<uint32_t> robVector; + + for ( unsigned int i = 0 ; i<mdtHashVector.size() ; ++i ) { + + int robId = getROBId(mdtHashVector[i]); + if (robId==0) { + + *m_log << MSG::ERROR << "ROB id not found for Hash Id: " << mdtHashVector[i] << endmsg; + + } else { + *m_log << MSG::VERBOSE << "Found ROB id 0x" << MSG::hex << robId << MSG::dec << " for hashId " << mdtHashVector[i] << endmsg; + } + robVector.push_back(robId); + } + *m_log << MSG::VERBOSE << "Size of ROB vector is: " << robVector.size() << endmsg; + + return robVector; +} + const std::vector<IdentifierHash>& MuonMDT_CablingMap::getChamberHashVec(const uint32_t ROBId) const { RODToChamberMap::const_iterator Rob_it = m_RODToChamber->find(ROBId); diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx index a61f1284396c3a43bb157baf363c42db86c7d715..f3e99a746192c90133c0ec196cec5c045c0d1db1 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.cxx index ab52b42160194c73cd5b6076bd981c2c1978a926..1a7323f9061c6a0bd65511f3b53f359b25be20b5 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.cxx @@ -8,7 +8,6 @@ #include "StoreGate/StoreGateSvc.h" #include "GaudiKernel/IJobOptionsSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" // using namespace OFFLINE_FRAGMENTS_NAMESPACE; @@ -21,7 +20,6 @@ Muon::MDT_RawDataProviderTool::MDT_RawDataProviderTool(const std::string& t, //m_lastLvl1ID(0), m_decoder("MdtROD_Decoder/MdtROD_Decoder", this), m_muonMgr(0), - m_mdtCabling(0), m_robDataProvider ("ROBDataProviderSvc",n) { declareInterface<Muon::IMuonRawDataProviderTool>(this); @@ -43,20 +41,6 @@ StatusCode Muon::MDT_RawDataProviderTool::initialize() return sc; } - ATH_MSG_VERBOSE("Getting cabling"); - - // get MDT cablingSvc - StatusCode status = service("MuonMDT_CablingSvc", m_mdtCabling); - - if (status.isFailure()) { - ATH_MSG_FATAL("Could not get MuonMDT_CablingSvc !"); - m_mdtCabling = 0; - return StatusCode::FAILURE; - } - else { - ATH_MSG_DEBUG(" Found the MuonMDT_CablingSvc. "); - } - ATH_MSG_VERBOSE("Getting m_robDataProvider"); // Get ROBDataProviderSvc @@ -164,6 +148,7 @@ StatusCode Muon::MDT_RawDataProviderTool::initialize() } ATH_CHECK( m_rdoContainerKey.initialize() ); + ATH_CHECK( m_readKey.initialize() ); ATH_MSG_INFO("initialize() successful in " << name()); return StatusCode::SUCCESS; @@ -177,12 +162,24 @@ StatusCode Muon::MDT_RawDataProviderTool::finalize() // the new one StatusCode Muon::MDT_RawDataProviderTool::convert() //call decoding function using list of all detector ROBId's { - return convert(m_mdtCabling->getAllROBId()); - } + 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; + } + return convert(readCdo->getAllROBId()); +} StatusCode Muon::MDT_RawDataProviderTool::convert(const std::vector<IdentifierHash>& HashVec) { - return convert(m_mdtCabling->getROBId(HashVec)); + 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; + } + return convert(readCdo->getROBId(HashVec)); } StatusCode Muon::MDT_RawDataProviderTool::convert(const std::vector<uint32_t>& robIds) diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h index 16dd5a607cbdb7d6e23df58a41084d46cc723998..f9e62bd8dd12b5f44ff5d11288dd70a3cbd70f19 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_RawDataProviderTool.h @@ -14,11 +14,14 @@ #include <vector> #include <set> #include <string> + +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" + class MdtCsmContainer; class StoreGateSvc; class ActiveStoreSvc; -class MuonMDT_CablingSvc; class IROBDataProviderSvc; namespace MuonGM { @@ -66,10 +69,11 @@ class MDT_RawDataProviderTool : virtual public IMuonRawDataProviderTool, virtual ActiveStoreSvc* m_activeStore; unsigned int m_maxhashtoUse; bool m_useContainer; - /// MDT cabling Svc - MuonMDT_CablingSvc * m_mdtCabling; // Rob Data Provider handle ServiceHandle<IROBDataProviderSvc> m_robDataProvider; + + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + }; }