Skip to content
Snippets Groups Projects
Commit 59d9fe17 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'master-MuonMDT_CablingSvcMT-v4' into 'master'

MuonMDT_CablingSvc MT migration v4

See merge request atlas/athena!16099

Former-commit-id: 8b83d42b
parents 427746eb 709f5d4e
No related branches found
No related tags found
No related merge requests found
Showing
with 236 additions and 191 deletions
......@@ -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;
......
......@@ -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;
}
}
......
......@@ -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;
......
/*
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
{
......
......@@ -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"};
};
......
......@@ -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;
......
......@@ -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;
}
......
/*
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"
......
......@@ -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 )
......
......@@ -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
......@@ -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()) {
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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"};
};
}
......
......@@ -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 ;
......
......@@ -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;
......
/*
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;
//}
/*
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);
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment