ATLAS Offline Software
MdtTwinTubeTestAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "MdtTwinTubeTestAlg.h"
6 namespace Muon{
7 
9  ATH_CHECK(m_idHelperSvc.retrieve());
10  ATH_CHECK(m_readKey.initialize());
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
Muon::MdtTwinTubeTestAlg::m_idHelperSvc
ServiceHandle< IMuonIdHelperSvc > m_idHelperSvc
Definition: MdtTwinTubeTestAlg.h:20
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Muon::MdtTwinTubeTestAlg::m_readKey
SG::ReadCondHandleKey< TwinTubeMap > m_readKey
Definition: MdtTwinTubeTestAlg.h:22
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
ReadCondHandle.h
Muon::MdtTwinTubeTestAlg::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
Definition: MdtTwinTubeTestAlg.h:24
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MdtTwinTubeTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: MdtTwinTubeTestAlg.cxx:14
MdtIdHelper
Definition: MdtIdHelper.h:61
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MdtTwinTubeTestAlg.h
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:22
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
re
const boost::regex re(r_e)
calibdata.tube
tube
Definition: calibdata.py:31
Muon::MdtTwinTubeTestAlg::initialize
virtual StatusCode initialize() override final
Definition: MdtTwinTubeTestAlg.cxx:8
Identifier
Definition: IdentifierFieldParser.cxx:14