2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 #ifndef MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_ICC
5 #define MUONREADOUTGEOMETRY_MUONDETECTORMANAGER_ICC
7 #include <MuonReadoutGeometryR4/MdtReadoutElement.h>
8 #include <MuonReadoutGeometryR4/TgcReadoutElement.h>
9 #include <MuonReadoutGeometryR4/RpcReadoutElement.h>
10 #include <MuonReadoutGeometryR4/sTgcReadoutElement.h>
11 #include <MuonReadoutGeometryR4/MmReadoutElement.h>
13 #define WRITE_GETTERS(ELE_TYPE, GETTER_FUNC, STORAGE_VEC, ATTR) \
14 inline ATTR ELE_TYPE* MuonDetectorManager::GETTER_FUNC(const Identifier& id) ATTR { \
15 ATTR ELE_TYPE* reEle = GETTER_FUNC(m_idHelperSvc->detElementHash(id)); \
16 if (!reEle) ATH_MSG_WARNING("Failed to retrieve "<<m_idHelperSvc->toStringDetEl(id)); \
19 inline ATTR ELE_TYPE* MuonDetectorManager::GETTER_FUNC(const IdentifierHash& hash) ATTR { \
20 const size_t idx = static_cast<unsigned int>(hash); \
21 return idx < STORAGE_VEC.size() ? STORAGE_VEC[idx].get() : nullptr; \
23 #define ADD_DETECTOR(ELE_TYPE, STORAGE_VEC) \
24 WRITE_GETTERS(ELE_TYPE, get##ELE_TYPE, STORAGE_VEC, ) \
25 WRITE_GETTERS(ELE_TYPE, get##ELE_TYPE, STORAGE_VEC, const)
28 ADD_DETECTOR(MdtReadoutElement, m_mdtEles);
29 ADD_DETECTOR(TgcReadoutElement, m_tgcEles);
30 ADD_DETECTOR(RpcReadoutElement, m_rpcEles);
31 ADD_DETECTOR(MmReadoutElement, m_mmEles);
32 ADD_DETECTOR(sTgcReadoutElement, m_sTgcEles);
34 #undef ELEMENT_GETTERSETTER