ATLAS Offline Software
Loading...
Searching...
No Matches
MdtTwinTubeTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
6namespace Muon{
7
9 ATH_CHECK(m_idHelperSvc.retrieve());
10 ATH_CHECK(m_readKey.initialize());
11 ATH_CHECK(detStore()->retrieve(m_detMgr));
12 return StatusCode::SUCCESS;
13 }
14 StatusCode MdtTwinTubeTestAlg::execute(const EventContext& ctx) const {
15 SG::ReadCondHandle twinMap{m_readKey, ctx};
16 ATH_CHECK(twinMap.isValid());
17 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
18 const std::vector<const MuonGMR4::MdtReadoutElement*> readOutEles{m_detMgr->getAllMdtReadoutElements()};
19 for (const MuonGMR4::MdtReadoutElement* re : readOutEles) {
20 const Identifier detEl{re->identify()};
21 if (!twinMap->isTwinTubeLayer(detEl)) {
22 ATH_MSG_DEBUG("Multi layer "<<m_idHelperSvc->toStringDetEl(detEl)<<" does not contain a ML");
23 continue;
24 }
25 ATH_MSG_INFO("Test twin tube mapping in "<<m_idHelperSvc->toStringDetEl(detEl));
26 for (unsigned int layer = 1; layer<= re->numLayers(); ++layer) {
27 for (unsigned tube = 1; tube <= re->numTubesInLay(); ++tube) {
28 const Identifier primId = idHelper.channelID(detEl, idHelper.multilayer(detEl), layer, tube);
29 const Identifier twinId = twinMap->twinId(primId);
30 const Identifier backId = twinMap->twinId(twinId);
31 if (backId != primId) {
32 ATH_MSG_FATAL("Back & forth mapping of "<<m_idHelperSvc->toString(primId)<<" -> "
33 <<m_idHelperSvc->toString(twinId)<<" -> "<<m_idHelperSvc->toString(backId)<<" does not close");
34 return StatusCode::FAILURE;
35 }
36 if (twinId == primId){
37 ATH_MSG_WARNING("Twin tube maps back onto itself "<<m_idHelperSvc->toString(primId));
38 return StatusCode::FAILURE;
39 }
40 }
41 }
42 }
43 return StatusCode::SUCCESS;
44 }
45}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
int multilayer(const Identifier &id) const
Access to components of the ID.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Readout element to describe the Monitored Drift Tube (Mdt) chambers Mdt chambers usually comrpise out...
ServiceHandle< IMuonIdHelperSvc > m_idHelperSvc
SG::ReadCondHandleKey< TwinTubeMap > m_readKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override final
const MuonGMR4::MuonDetectorManager * m_detMgr
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.