diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx index 344de640956585b2790bd4b150ba69d973237c53..5fcd423b5cc5d4cd2dd23a9277b434fd04d90d42 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx @@ -79,9 +79,8 @@ void AlignmentErrorTool::makeAlignmentDeviations (const Trk::Track& track, std:: SG::ReadCondHandle<MuonAlignmentErrorData> readHandle{m_readKey}; const MuonAlignmentErrorData* readCdo{*readHandle}; - if(readCdo==0){ + if(readCdo==nullptr){ ATH_MSG_ERROR("Null pointer to the read conditions object"); - std::cout<<"ckato Null pointer to the read conditions object"<<std::endl; return; } std::vector<deviationStr> devStrVec; diff --git a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MdtMapBase.h b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MdtMapBase.h index c6d4a92288c42ab6d141fac40a2f7c4908209329..cd68f71f97587c78c03f99e918cce501b8532923 100644 --- a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MdtMapBase.h +++ b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MdtMapBase.h @@ -43,7 +43,7 @@ template<class T> class MdtMapBase void clear(); /** get full map (used for testing) */ - MapOfItems* getListOfElements() {return m_mapOfItems;} + MapOfItems* getListOfElements() const {return m_mapOfItems;} protected: @@ -57,7 +57,7 @@ template<class T> class MdtMapBase bool addItem(uint8_t itemId, T* item); /** get function - fast, used for online->offline conversion */ - T* getItem(uint8_t itemId); + T* getItem(uint8_t itemId) const; private: @@ -65,21 +65,21 @@ template<class T> class MdtMapBase const std::string m_itemName; /** pointer to the current item */ - T* m_currentItem; + //T* m_currentItem; /** map containing the items */ MapOfItems* m_mapOfItems; /** private access function */ - T* findItem(uint8_t itemId); + T* findItem(uint8_t itemId) const; }; /** default constructor */ template<class T> MdtMapBase<T>::MdtMapBase(uint8_t moduleId, const std::string itemName) : - m_moduleId(moduleId), m_itemName(itemName), m_currentItem(NULL) - +m_moduleId(moduleId), m_itemName(itemName)//, m_currentItem(NULL) + { // m_mapOfItems = new std::map< uint8_t, T*, std::less<uint8_t> >(); m_mapOfItems = new MapOfItems(); @@ -124,7 +124,7 @@ template<class T> void MdtMapBase<T>::clear() } m_mapOfItems->clear(); - m_currentItem=NULL; + //m_currentItem=NULL; } /** Add an item to the map */ @@ -160,8 +160,8 @@ template<class T> bool MdtMapBase<T>::addItem(uint8_t itemId, T* item) { /** return the item for a given access key (onlineId) */ -template<class T> T* MdtMapBase<T>::getItem(uint8_t itemId) { - +template<class T> T* MdtMapBase<T>::getItem(uint8_t itemId) const{ + /* if ( m_currentItem ) { if ( itemId == m_currentItem->moduleId() ) { return m_currentItem; @@ -173,15 +173,16 @@ template<class T> T* MdtMapBase<T>::getItem(uint8_t itemId) { else { return findItem(itemId); } - + */ + return findItem(itemId); } /** find the item in the datamember map */ -template<class T> T* MdtMapBase<T>::findItem(uint8_t itemId) { +template<class T> T* MdtMapBase<T>::findItem(uint8_t itemId) const{ typename MapOfItems::const_iterator it = m_mapOfItems->find(itemId); - + /* if (it!=m_mapOfItems->end()) { m_currentItem = (*it).second; } @@ -189,9 +190,14 @@ template<class T> T* MdtMapBase<T>::findItem(uint8_t itemId) { // *m_log << MSG::ERROR << m_itemName << " with Id: " << MSG::hex << itemId // << MSG::dec << " not found " << endmsg; m_currentItem=NULL; - } - + } return m_currentItem; + */ + if (it!=m_mapOfItems->end()) { + return (*it).second; + } else { + return nullptr; + } } diff --git a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h index f2e7694f0b7d8f87a5d8b95f7dc3449264231694..b4af30a6edeb103ee17360e7ea8e7f21efa22fb5 100644 --- a/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h +++ b/MuonSpectrometer/MuonCablings/MuonCablingData/MuonCablingData/MuonMDT_CablingMap.h @@ -63,13 +63,16 @@ class MuonMDT_CablingMap : public MdtMapBase<MdtSubdetectorMap> { int tdcId, int channelZero); /** Get function */ - MdtSubdetectorMap* getSubdetectorMap(uint8_t subdetectorId); + MdtSubdetectorMap* getSubdetectorMap(uint8_t subdetectorId) const; /** return the ROD id of a given chamber, given station, eta, phi */ - uint32_t getROBId(int station, int eta, int phi); + uint32_t getROBId(int station, int eta, int phi) const; /** return the ROD id of a given chamber, given the hash id */ - uint32_t getROBId(const IdentifierHash stationCode); + 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; @@ -78,19 +81,19 @@ class MuonMDT_CablingMap : public MdtMapBase<MdtSubdetectorMap> { const std::vector<IdentifierHash>& getChamberHashVec(const uint32_t ROBId) const; /** return the ROD id of a given chamber */ - std::vector<uint32_t> getAllROBId(); + std::vector<uint32_t> getAllROBId() const; /** return the offline id given the online id */ bool getOfflineId(uint8_t subdetectorId,uint8_t rodId,uint8_t csmId, uint8_t tdcId,uint8_t channelId, int& stationName, int& stationEta, int& stationPhi, - int& multiLayer, int& layer, int& tube); + int& multiLayer, int& layer, int& tube) const; /** return the online id given the offline id */ bool getOnlineId(int stationName, int stationEta, int stationPhi, int multiLayer, int layer, int tube, uint8_t& subdetectorId, uint8_t& rodId, uint8_t& csmId, - uint8_t& tdcId, uint8_t& channelId); + uint8_t& tdcId, uint8_t& channelId) const; private: @@ -113,7 +116,7 @@ class MuonMDT_CablingMap : public MdtMapBase<MdtSubdetectorMap> { ListOfROD* m_listOfROD; /** private function to compute a station code for the chamber to ROD map */ - bool getStationCode(int station, int eta, int phi, IdentifierHash& mdtIdHash); + bool getStationCode(int station, int eta, int phi, IdentifierHash& mdtIdHash) const; /** Pointer to the MdtIdHelper */ const MdtIdHelper* m_mdtIdHelper; diff --git a/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx b/MuonSpectrometer/MuonCablings/MuonCablingData/src/MuonMDT_CablingMap.cxx index 33fcc6ded7be9bf38a292b59278cd8c8f9d6c689..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" @@ -299,7 +299,7 @@ bool MuonMDT_CablingMap::addMezzanine( int mezType, int station, int eta, int ph -MdtSubdetectorMap* MuonMDT_CablingMap::getSubdetectorMap(uint8_t subdetectorId) { +MdtSubdetectorMap* MuonMDT_CablingMap::getSubdetectorMap(uint8_t subdetectorId) const{ return getItem(subdetectorId); } @@ -367,7 +367,7 @@ bool MuonMDT_CablingMap::addChamberToRODMap(int station, int eta, int phi, * */ bool MuonMDT_CablingMap::getStationCode(int station, int eta, int phi, - IdentifierHash& mdtHashId) + IdentifierHash& mdtHashId) const { // create the station identifier Identifier elementId = m_mdtIdHelper->elementID(station,eta,phi); @@ -387,7 +387,7 @@ bool MuonMDT_CablingMap::getStationCode(int station, int eta, int phi, * return the ROBid of a given station, identified through station, eta, phi * */ -uint32_t MuonMDT_CablingMap::getROBId(int station, int eta, int phi) +uint32_t MuonMDT_CablingMap::getROBId(int station, int eta, int phi) const { int rodId = 0; @@ -407,7 +407,8 @@ uint32_t MuonMDT_CablingMap::getROBId(int station, int eta, int phi) } // get the ROBid given the identifier hash -uint32_t MuonMDT_CablingMap::getROBId(const IdentifierHash stationCode) + +uint32_t MuonMDT_CablingMap::getROBId(const IdentifierHash stationCode) const { int rodId = 0; @@ -423,6 +424,29 @@ uint32_t MuonMDT_CablingMap::getROBId(const IdentifierHash stationCode) 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); @@ -457,7 +481,7 @@ const std::vector<IdentifierHash> MuonMDT_CablingMap::getChamberHashVec(const st * get the full list of ROBid * */ -std::vector<uint32_t> MuonMDT_CablingMap::getAllROBId() +std::vector<uint32_t> MuonMDT_CablingMap::getAllROBId() const { return *m_listOfROD; } @@ -475,7 +499,7 @@ bool MuonMDT_CablingMap::getOfflineId(uint8_t subdetectorId, uint8_t tdcId, uint8_t channelId, int& stationName, int& stationEta, int& stationPhi, - int& multiLayer, int& layer, int& tube) + int& multiLayer, int& layer, int& tube) const { // get the subdetector @@ -587,7 +611,7 @@ bool MuonMDT_CablingMap::getOnlineId(int stationName, int stationEta, int statio int multiLayer, int layer, int tube, uint8_t& subdetectorId, uint8_t& rodId, uint8_t& csmId, uint8_t& tdcId, - uint8_t& channelId) + uint8_t& channelId) const { diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h index d2ba316b8128aff32e041fa6cd2cb8d4f61624e8..0f2accdc90c8ad6ddd070e58318719e15756135d 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MdtTestCabling.h @@ -16,13 +16,12 @@ ***********************************************/ #include "GaudiKernel/IChronoStatSvc.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" #include "MuonIdHelpers/MdtIdHelper.h" #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -// old cabling service -//#include "MDTcabling/IMDTcablingSvc.h" +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" class MdtTestCabling : public AthAlgorithm { @@ -38,8 +37,6 @@ class MdtTestCabling : public AthAlgorithm { private: - ServiceHandle<MuonMDT_CablingSvc> m_cablingSvc; - const MdtIdHelper* m_mdtIdHelper; // test initialize function @@ -57,6 +54,8 @@ class MdtTestCabling : public AthAlgorithm { std::string m_chrono3; std::string m_chrono4; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + }; diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx index 924c6d7a1e681b9f21ebd298be755b4758abcaf8..aae40662999fab8025b1e2df610a1e8dd1de2783 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MdtTestCabling.cxx @@ -4,14 +4,11 @@ #include "MuonMDT_Cabling/MdtTestCabling.h" -#include "MuonCablingData/MuonMDT_CablingMap.h" - #include "StoreGate/StoreGateSvc.h" #include "StoreGate/DataHandle.h" MdtTestCabling::MdtTestCabling(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_cablingSvc("MuonMDT_CablingSvc", name), m_mdtIdHelper(0), m_chronoSvc("ChronoStatSvc", name) { @@ -23,7 +20,6 @@ MdtTestCabling::~MdtTestCabling() { } StatusCode MdtTestCabling::initialize() { ATH_CHECK( m_chronoSvc.retrieve() ); - ATH_CHECK( m_cablingSvc.retrieve() ); // initialize the pointer to the MdtIdHelper ServiceHandle<StoreGateSvc> detStore ("DetectorStore", name()); @@ -34,6 +30,8 @@ StatusCode MdtTestCabling::initialize() m_chrono2 = "oldcab"; m_chrono3 = "OfflineToOnline"; + ATH_CHECK( m_readKey.initialize() ); + return StatusCode::SUCCESS; } @@ -64,22 +62,25 @@ StatusCode MdtTestCabling::finalize() bool MdtTestCabling::testMap() { + 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 false; + } + // print the list of ROBids - std::vector<uint32_t> robVector = m_cablingSvc->getAllROBId(); - std::cout << "============================= List of ROBids:" << std::endl; + std::vector<uint32_t> robVector = readCdo->getAllROBId(); + ATH_MSG_DEBUG( "============================= List of ROBids:" ); for (unsigned int i=0 ; i<robVector.size() ; ++i) { - std::cout << std::hex << robVector[i] << std::dec << std::endl; + ATH_MSG_DEBUG( std::hex << robVector[i] << std::dec ); } - std::cout << "=============================================" << std::endl; + ATH_MSG_DEBUG( "=============================================" ); // loop on the hardware objects to get online identifiers - // if (m_debug) { + ATH_MSG_DEBUG( "in testMap()" ); - //} - DataHandle<MuonMDT_CablingMap> cablingMap = m_cablingSvc->getCablingMap(); - //if (m_debug) { ATH_MSG_DEBUG( "retrieved the map from the service" ); - //} std::map<uint8_t, MdtSubdetectorMap*, std::less<uint8_t> >* listOfSubdet; std::map<uint8_t, MdtSubdetectorMap*, std::less<uint8_t> >::const_iterator it_sub; @@ -93,7 +94,7 @@ bool MdtTestCabling::testMap() std::map<uint8_t, MdtAmtMap*, std::less<uint8_t> >* listOfAmt; std::map<uint8_t, MdtAmtMap*, std::less<uint8_t> >::const_iterator it_amt; - listOfSubdet = cablingMap->getListOfElements(); + listOfSubdet = readCdo->getListOfElements(); // if (m_debug) { ATH_MSG_DEBUG( "Got the list of subdetectors" ); @@ -142,8 +143,7 @@ bool MdtTestCabling::testMap() int tube=0; m_chronoSvc->chronoStart(m_chrono1); - - bool cabling = m_cablingSvc->getOfflineId(subdetectorId,rodId,csmId, + bool cabling = readCdo->getOfflineId(subdetectorId,rodId,csmId, amtId,chanId, station,eta,phi,multi, layer,tube); @@ -168,8 +168,8 @@ bool MdtTestCabling::testMap() // test the back-conversion to online indeces m_chronoSvc->chronoStart(m_chrono3); - cabling = m_cablingSvc->getOnlineId(station,eta,phi,multi,layer,tube, - newSubdet,newRod,newCsm,newAmt,newChan); + cabling = readCdo->getOnlineId(station,eta,phi,multi,layer,tube,newSubdet,newRod,newCsm,newAmt,newChan); + m_chronoSvc->chronoStop(m_chrono3); if (!cabling) { @@ -240,10 +240,17 @@ bool MdtTestCabling::testMapTiming() bool found; + 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 false; + } + // m_chronoSvc->chronoStart(m_chrono1); for (int i = 0 ; i<1000 ; i++) { - found = m_cablingSvc->getOfflineId(1,1,1,1,1, + found = readCdo->getOfflineId(1,1,1,1,1, stationName,stationEta,stationPhi, multiLayer,layer,tube); if (!found) { @@ -251,12 +258,9 @@ bool MdtTestCabling::testMapTiming() return found; } - //found = m_cablingSvc->getOfflineId(1,1,1,1,1, - // stationName,stationEta,stationPhi, - // multiLayer,layer,tube); - found = m_cablingSvc->getOfflineId(1,1,1,1,3, - stationName,stationEta,stationPhi, - multiLayer,layer,tube); + found = readCdo->getOfflineId(1,1,1,1,3, + stationName,stationEta,stationPhi, + multiLayer,layer,tube); if (!found) { ATH_MSG_FATAL( " coul dnot find the test channel" ); return false; diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx index 110c4f7e80e9f4093f2e85d3ce92240b02c5fa85..4bc4baf9de843d664b5b2e654be96f5b71635815 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx @@ -66,7 +66,7 @@ StatusCode MuonMDT_CablingAlg::execute(){ SG::ReadCondHandle<CondAttrListCollection> readHandleMez{ m_readKeyMez }; const CondAttrListCollection* readCdoMez{*readHandleMez}; - if(readCdoMez==0){ + if(readCdoMez==nullptr){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } @@ -80,7 +80,7 @@ StatusCode MuonMDT_CablingAlg::execute(){ SG::ReadCondHandle<CondAttrListCollection> readHandleMap{ m_readKeyMap }; const CondAttrListCollection* readCdoMap{*readHandleMap}; - if(readCdoMap==0){ + if(readCdoMap==nullptr){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } 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/MuonByteStreamCnvTest/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt index 246bb445e22a5e19345ea29ca0b464eb32b197ed..ef63407e2ca2a5619bd731b3f1c236ef3449cc95 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/CMakeLists.txt @@ -28,18 +28,19 @@ atlas_depends_on_subdirs( PUBLIC MuonSpectrometer/MuonCnv/MuonTGC_CnvTools MuonSpectrometer/MuonDigitContainer MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData ) + MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData + MuonSpectrometer/MuonCablings/MuonCablingData ) # Component(s) in the package: atlas_add_library( MuonByteStreamCnvTestLib src/*.cxx PUBLIC_HEADERS MuonByteStreamCnvTest LINK_LIBRARIES AthenaBaseComps GaudiKernel MuonReadoutGeometry MuonRDO StoreGateLib SGtests RPCcablingInterfaceLib TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib MuonMDT_CablingLib TGCcablingInterfaceLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES EventInfo MuonDigitContainer MuonPrepRawData ) + PRIVATE_LINK_LIBRARIES EventInfo MuonDigitContainer MuonPrepRawData MuonCablingData ) atlas_add_component( MuonByteStreamCnvTest src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib ) + LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonRDO TrigT1RPChardwareLib RPChardware TrigT1RPClogicLib EventInfo MuonMDT_CablingLib TGCcablingInterfaceLib MuonDigitContainer MuonIdHelpersLib MuonPrepRawData MuonByteStreamCnvTestLib MuonCablingData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h index d0374bdd2aa54fff90f7a981e6817adaa7c350b9..b59e720d29adc354b7e9a76e61717cf597f7e885 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/MuonByteStreamCnvTest/MdtDigitToMdtRDO.h @@ -10,7 +10,9 @@ #include "MuonDigitContainer/MdtDigitContainer.h" #include "MuonRDO/MdtCsmContainer.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" + +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" class MdtIdHelper; @@ -31,11 +33,12 @@ class MdtDigitToMdtRDO : public AthAlgorithm { protected: - ServiceHandle<MuonMDT_CablingSvc> m_cabling; const MdtIdHelper* m_mdtIdHelper; bool m_BMEpresent; SG::WriteHandleKey<MdtCsmContainer> m_csmContainerKey{this,"OutputObjectName","MDTCSM","WriteHandleKey for Output MdtCsmContainer"}; SG::ReadHandleKey<MdtDigitContainer> m_digitContainerKey{this,"InputObjectName","MDT_DIGITS","ReadHandleKey for Input MdtDigitContainer"}; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx index 5f6ce979da6fd800733785a143f99db58d3c7f3f..82f7b729e323de575a6f681a25f52104c60bbc28 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStreamCnvTest/src/MdtDigitToMdtRDO.cxx @@ -6,8 +6,6 @@ #include "MuonDigitContainer/MdtDigitCollection.h" #include "MuonDigitContainer/MdtDigit.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" - #include "MuonRDO/MdtCsmIdHash.h" #include "MuonRDO/MdtCsmContainer.h" #include "MuonRDO/MdtCsm.h" @@ -27,7 +25,6 @@ using namespace std; MdtDigitToMdtRDO::MdtDigitToMdtRDO(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_cabling("MuonMDT_CablingSvc", name), m_mdtIdHelper(0), m_BMEpresent(false) { @@ -43,7 +40,7 @@ StatusCode MdtDigitToMdtRDO::initialize() ATH_CHECK( m_digitContainerKey.initialize() ); ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_digitContainerKey ); ATH_CHECK( detStore()->retrieve(m_mdtIdHelper,"MDTIDHELPER") ); - ATH_CHECK( m_cabling.retrieve() ); + ATH_CHECK( m_readKey.initialize() ); if ( fillTagInfo().isFailure() ) { ATH_MSG_WARNING( "Could not fill the tagInfo for MDT cabling" ); @@ -95,6 +92,13 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { MdtCsmIdHash hashF; + SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; + const MuonMDT_CablingMap* readCdo{*readHandle}; + if(readCdo==0){ + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + // Iterate on the collections collection_iterator it_coll = container->begin(); for ( ; it_coll != container->end(); ++it_coll) @@ -114,10 +118,10 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { uint8_t tdc; uint8_t channel; - bool cabling = m_cabling->getOnlineId(name, eta, phi, - 1, 1, 1, - subsystem, mrod, link, - tdc, channel); + bool cabling = readCdo->getOnlineId(name, eta, phi, + 1, 1, 1, + subsystem, mrod, link, + tdc, channel); if (!cabling) { ATH_MSG_ERROR( "MDTcabling can't return an online ID for the channel : " ); @@ -165,10 +169,10 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { if ( name == 53 ) { uint8_t subsystem_2ndcsm, mrod_2ndcsm, link_2ndcsm, tdc_2ndcsm, channel_2ndcsm; - cabling = m_cabling->getOnlineId(name, eta, phi, 1, 1, 43, - subsystem_2ndcsm, mrod_2ndcsm, - link_2ndcsm, tdc_2ndcsm, channel_2ndcsm); - + cabling = readCdo->getOnlineId(name, eta, phi, 1, 1, 43, + subsystem_2ndcsm, mrod_2ndcsm, + link_2ndcsm, tdc_2ndcsm, channel_2ndcsm); + if (!cabling) { ATH_MSG_ERROR( "MDTcabling can't return an online ID for the channel : " ); ATH_MSG_ERROR( name << " " @@ -196,10 +200,10 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { int tube = m_mdtIdHelper->tube(channelId); // Get the online Id of the channel - cabling = m_cabling->getOnlineId(name, eta, phi, - multilayer, layer, tube, - subsystem, mrod, link, - tdc, channel); + cabling = readCdo->getOnlineId(name, eta, phi, + multilayer, layer, tube, + subsystem, mrod, link, + tdc, channel); if (!cabling) { ATH_MSG_ERROR( "MDTcabling can't return an online ID for the channel : " ); @@ -263,17 +267,11 @@ StatusCode MdtDigitToMdtRDO::fill_MDTdata() const { StatusCode MdtDigitToMdtRDO::fillTagInfo() const { ServiceHandle<ITagInfoMgr> tagInfoMgr ("TagInfoMgr", name()); - if (tagInfoMgr.retrieve().isFailure()) + if (tagInfoMgr.retrieve().isFailure()){ return StatusCode::FAILURE; - - std::string cablingType=""; - if (m_cabling->usingOldCabling() ) { - cablingType="OldMDT_Cabling"; - } - else { - cablingType="NewMDT_Cabling"; } + std::string cablingType="NewMDT_Cabling"; StatusCode sc = tagInfoMgr->addTag("MDT_CablingType",cablingType); if(sc.isFailure()) { diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx index 2619c9958afdc9c9da49e61d44b251c728007d87..f8d88654eb9d61286d71b0d16e56bec686e51af7 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.cxx @@ -23,15 +23,16 @@ 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) { +StatusCode MDT_Hid2RESrcID::set(const MdtIdHelper* mdtIdHelper) { // Initialize the cabling Service m_mdtIdHelper = mdtIdHelper; - m_cabling = p_cabling; + ATH_CHECK( m_readKey.initialize() ); + return StatusCode::SUCCESS; } uint32_t MDT_Hid2RESrcID::getRodID(const Identifier& offlineId) { @@ -63,15 +64,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 f6e0103da65c2e61767ce22c7b696181c6af7b8b..f112d0d279f62cea098c97724f6426a99d67ca21 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MDT_Hid2RESrcID.h @@ -8,12 +8,14 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/StatusCode.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" +#include "AthenaBaseComps/AthService.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 +38,7 @@ public: /** intialize the cabling service */ - void set(MuonMDT_CablingSvc* p_cabling, const MdtIdHelper* m_mdtIdHelper); + StatusCode set(const MdtIdHelper* m_mdtIdHelper); /** TMP method for sector 13 data */ void setSpecialROBNumber(int specialROBNumber) {m_specialROBNumber=specialROBNumber;} @@ -58,11 +60,12 @@ public: private: - MuonMDT_CablingSvc* m_cabling; const MdtIdHelper* m_mdtIdHelper; int m_specialROBNumber; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey; + }; #endif 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"}; + }; } diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.cxx index 83dfa98295a0ca00265e51817fb31f729f7e4233..2ae218a8abf5e2c02ad7659b6ccbfa6b9827ee41 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,11 @@ StatusCode Muon::MdtCsmContByteStreamTool::initialize() { } m_hid2re = new MDT_Hid2RESrcID (); - m_hid2re->set(m_cabling, mdt_id); + status = m_hid2re->set(mdt_id); + if ( status.isFailure() ){ + ATH_MSG_FATAL("Could not initialize MDT mapping !"); + return StatusCode::FAILURE; + } m_mdtIdHelper = mdt_id; @@ -81,7 +77,11 @@ StatusCode Muon::MdtCsmContByteStreamTool::convert(CONTAINER* cont, RawEventWrit MsgStream& log ) { m_fea.clear(); - m_fea.idMap().set(m_cabling, m_mdtIdHelper); + StatusCode status = m_fea.idMap().set(m_mdtIdHelper); + if ( status.isFailure() ){ + ATH_MSG_FATAL("Could not initialize MDT mapping !"); + return StatusCode::FAILURE; + } FullEventAssembler<MDT_Hid2RESrcID>::RODDATA* theROD ; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtCsmContByteStreamTool.h index b92201b2857b8cff70c363b7527542ac40d9bd37..2dad648dc766b4afba4c421f0f2c24d9ae650d72 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/MdtRDO_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.cxx index 6a3ec2d7bb53cd38a451b9c695484c784a4860bb..67880443b04dfb06de4ffc3b1dbed2e1c59760d3 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.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 "MdtRDO_Decoder.h" @@ -8,19 +8,13 @@ using namespace Muon; MdtRDO_Decoder::MdtRDO_Decoder(const std::string& type, const std::string& name,const IInterface* parent) : AthAlgTool(type,name,parent), - m_mdtIdHelper(0), - m_cablingSvc(0) + m_mdtIdHelper(0) { declareInterface< Muon::IMDT_RDO_Decoder >( this ); } StatusCode MdtRDO_Decoder::initialize() { - - if (StatusCode::SUCCESS != service("MuonMDT_CablingSvc", m_cablingSvc)) { - ATH_MSG_ERROR(" Can't get MuonMDT_CablingSvc "); - return StatusCode::FAILURE; - } - + StoreGateSvc * detStore; StatusCode status = service("DetectorStore", detStore); if (status.isFailure()) { @@ -36,7 +30,7 @@ StatusCode MdtRDO_Decoder::initialize() { else { ATH_MSG_DEBUG(" Found the MdtIdHelper. "); } - + ATH_CHECK( m_readKey.initialize() ); return StatusCode::SUCCESS; } @@ -47,13 +41,3 @@ StatusCode MdtRDO_Decoder::finalize() } -//void MdtRDO_Decoder::set(const MdtIdHelper * mdtIdHelper, const MDTcablingSvc* mdtCabling) -//{ -// m_mdtIdHelper = mdtIdHelper; -// m_cablingSvc = mdtCabling; -//} - - - - - diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h index 583ecde58a970cec0566416e3b3240d31367f509..8c5c85053be95f69aa7b190be7c139597f53748a 100755 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRDO_Decoder.h @@ -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 */ #ifndef MUONBYTESTREAMMDTRDODECODER_H @@ -10,7 +10,8 @@ #include "MuonRDO/MdtAmtHit.h" #include "MuonDigitContainer/MdtDigit.h" #include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" #include "MuonMDT_CnvTools/IMDT_RDO_Decoder.h" @@ -31,10 +32,7 @@ namespace Muon { const IInterface* parent ) ; virtual StatusCode initialize(); - virtual StatusCode finalize(); - - - // void set(const MdtIdHelper * mdtIdHelper, const MDTcablingSvc* mdtCabling); + virtual StatusCode finalize(); MdtDigit * getDigit(const MdtAmtHit * amtHit, uint16_t& subdetId, uint16_t& mrodId, uint16_t& csmId) const; @@ -45,7 +43,7 @@ namespace Muon { private: const MdtIdHelper * m_mdtIdHelper; - MuonMDT_CablingSvc* m_cablingSvc; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; }; @@ -67,14 +65,18 @@ inline MdtDigit* Muon::MdtRDO_Decoder::getDigit(const MdtAmtHit* amtHit, uint16_ uint16_t fine = amtHit->fine(); int width = (int) amtHit->width(); - bool cab = m_cablingSvc->getOfflineId((uint8_t) subdetId, (uint8_t) mrodId, - (uint8_t) csmId, (uint8_t) tdc, - (uint8_t) chan, - stationName, stationEta, stationPhi, - multiLayer, tubeLayer, tube); - - - + 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 NULL; + } + bool cab = readCdo->getOfflineId((uint8_t) subdetId, (uint8_t) mrodId, + (uint8_t) csmId, (uint8_t) tdc, + (uint8_t) chan, + stationName, stationEta, stationPhi, + multiLayer, tubeLayer, tube); + if (!cab) return NULL; Identifier chanId = m_mdtIdHelper->channelID(stationName, stationEta, stationPhi, @@ -104,8 +106,15 @@ inline Identifier Muon::MdtRDO_Decoder::getOfflineData(const MdtAmtHit* amtHit, uint16_t coarse = amtHit->coarse(); uint16_t fine = amtHit->fine(); width = (int) amtHit->width(); - - bool cab = m_cablingSvc->getOfflineId(subdetId, mrodId, csmId, tdc, chan, + + Identifier chanIdDefault; + 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 chanIdDefault; + } + bool cab = readCdo->getOfflineId(subdetId, mrodId, csmId, tdc, chan, stationName, stationEta, stationPhi, multiLayer, tubeLayer, tube); diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtROD_Decoder.cxx index 86a80ed5cd11fa7107e533ea9fa835370aa7def5..b6de2acedeaea486cbdf1b8b5498ab7b54fd7455 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) @@ -68,16 +68,13 @@ StatusCode MdtROD_Decoder::initialize() { return sc; } - m_hid2re=new MDT_Hid2RESrcID(); - // 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=new MDT_Hid2RESrcID(); + sc = m_hid2re->set(m_mdtIdHelper); + if ( !sc.isSuccess() ) { + ATH_MSG_ERROR(" Can't initialize MDT mapping"); + return sc; + } // Initialize decoding classes m_rodReadOut = new MdtRODReadOut(); @@ -96,6 +93,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 +286,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 23e78745c4254cdb3a2a5dd43cbf12d83de7b3d4..0eb69231efeac4c66414776d231913d8ccd586df 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; + }; /* diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx index 695bafcc870771380db9fe7c219834737b3d393e..08e0993f4336913a2fad84469bb53d63aec03d65 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataTool.cxx @@ -164,7 +164,7 @@ StatusCode Muon::MdtRdoToPrepDataTool::decode( const std::vector<uint32_t>& robI { SG::ReadCondHandle<MuonMDT_CablingMap> readHandle{m_readKey}; const MuonMDT_CablingMap* readCdo{*readHandle}; - if(readCdo==0){ + if(readCdo==nullptr){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MuonAlignmentErrorDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MuonAlignmentErrorDbAlg.cxx index 4c76add8d4e7da8be8792127b412db185228a0cd..cad8d2fe9e77d9858697f1f347e88cc0876a336f 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MuonAlignmentErrorDbAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/MuonAlignmentErrorDbAlg.cxx @@ -45,7 +45,7 @@ StatusCode MuonAlignmentErrorDbAlg::execute(){ const CondAttrListCollection* readCdo{*readHandle}; //const CondAttrListCollection* atrc(0); //readCdo = *readHandle; - if(readCdo==0){ + if(readCdo==nullptr){ ATH_MSG_ERROR("Null pointer to the read conditions object"); return StatusCode::FAILURE; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py index 4a3cd606c4c927e4f992590e0f69bbff17c39692..127c0386c320c70219320d682519d7f80a7e5a5a 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py +++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py @@ -309,8 +309,8 @@ athenaCommonFlags.SkipEvents = 0 # Output setup #-------------------------------------------------------------------------------- #recFlags.doTruth=False -rec.doWriteESD = False -rec.doWriteAOD = False +rec.doWriteESD = True +rec.doWriteAOD = True ##### no more flags after this line ##### diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h index 98964798fb3b59def3d556a9e2ae741759e4b966..c572d1402cd40c3e38fad0ba354b0cd66c8d532f 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/MdtDataPreparator.h @@ -29,7 +29,8 @@ #include "TrigL2MuonSA/RpcFitResult.h" #include "TrigL2MuonSA/TgcFitResult.h" -#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h" +#include "MuonCablingData/MuonMDT_CablingMap.h" +#include "StoreGate/ReadCondHandleKey.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" @@ -130,10 +131,7 @@ namespace TrigL2MuonSA { ToolHandle<Muon::IMuonRawDataProviderTool> m_mdtRawDataProvider; //ToolHandle<Muon::IMuonRawDataProviderTool> m_mdtRawDataProvider { // this, "MDT_RawDataProvider", "Muon::MDT_RawDataProviderTool", "MDTRawDataProviderTool"}; - - // Cabling - ServiceHandle<MuonMDT_CablingSvc> m_mdtCabling; - + // Geometry Services const MuonGM::MuonDetectorManager* m_muonMgr; const MuonGM::MdtReadoutElement* m_mdtReadout; @@ -171,6 +169,8 @@ namespace TrigL2MuonSA { int m_BMGid; std::map<Identifier, std::vector<Identifier> > m_DeadChannels; + SG::ReadCondHandleKey<MuonMDT_CablingMap> m_readKey{this, "ReadKey", "MuonMDT_CablingMap", "Key of MuonMDT_CablingMap"}; + }; } // namespace TrigL2MuonSA diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx index 36cae716dbf700138c29abd97dbad5a7f68599cf..fc2898a5a19c15944a9f5aa70e1d7ed1607dd8e4 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx @@ -58,7 +58,6 @@ TrigL2MuonSA::MdtDataPreparator::MdtDataPreparator(const std::string& type, m_storeGateSvc( "StoreGateSvc", name ), m_activeStore( "ActiveStoreSvc", name ), m_mdtRawDataProvider("Muon::MDT_RawDataProviderTool"), - m_mdtCabling("MuonMDT_CablingSvc", name), m_regionSelector("RegSelSvc", name ), m_robDataProvider("ROBDataProviderSvc", name), m_recMuonRoIUtils(), @@ -120,9 +119,7 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::initialize() ATH_CHECK( m_mdtRegionDefiner.retrieve() ); ATH_MSG_DEBUG("Retrieved service " << m_mdtRegionDefiner); - // initialize the NEW cabling service - ATH_CHECK( m_mdtCabling.retrieve()); - ATH_MSG_DEBUG("Retrieved the new cabling service "); + ATH_CHECK( m_readKey.initialize() ); // retrieve the mdtidhelper ServiceHandle<StoreGateSvc> detStore("DetectorStore", name()); @@ -290,12 +287,19 @@ StatusCode TrigL2MuonSA::MdtDataPreparator::getMdtHits(const LVL1::RecMuonRoI* ATH_MSG_DEBUG("size of the hashids in getMdtHits " << mdtHashList.size()); if (roi) delete roi; + + 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; + } bool redundant; for(int hash_iter=0; hash_iter<(int)mdtHashList.size(); hash_iter++){ redundant = false; - uint32_t newROBId = m_mdtCabling->getROBId(mdtHashList[hash_iter]); + uint32_t newROBId = readCdo->getROBId(mdtHashList[hash_iter]); for (int rob_iter=0; rob_iter<(int)v_robIds.size(); rob_iter++){ if(newROBId == v_robIds[rob_iter]) @@ -525,13 +529,14 @@ bool TrigL2MuonSA::MdtDataPreparator::decodeMdtCsm(const MdtCsm* csm, unsigned short int MrodId = csm->MrodId(); unsigned short int LinkId = csm->CsmId(); - MuonMDT_CablingMap* cablingMap = m_mdtCabling->getCablingMap(); - if (!cablingMap) { - ATH_MSG_DEBUG("Null pointer to MuonMDT_CablingMap"); + 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 true; } - MdtSubdetectorMap* subdetectorMap = cablingMap->getSubdetectorMap(SubsystemId); + MdtSubdetectorMap* subdetectorMap = readCdo->getSubdetectorMap(SubsystemId); if (!subdetectorMap) { ATH_MSG_DEBUG("Null pointer to MdtSubdetectorMap"); return true;