![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
20 template <
class ReadOutEleStoreType,
21 class ReadoutEleReturnType>
void insert(
const ElementStorage<ReadOutEleStoreType>& eleStore,
22 std::vector<ReadoutEleReturnType>& returnVec) {
23 returnVec.reserve(returnVec.capacity() + eleStore.size());
24 for (
const auto& ele : eleStore) {
25 if (ele) returnVec.push_back(ele.get());
28 template <
class ReadOutEleType,
29 class ReadOutEleReturnType>
void insert(std::vector<ReadOutEleType*>&& eleStore,
30 std::vector<ReadOutEleReturnType*>& returnVec) {
31 returnVec.insert(returnVec.end(),
32 std::make_move_iterator(eleStore.begin()),
33 std::make_move_iterator(eleStore.end()));
37 #define WRITE_SETTER(ELE_TYPE, SETTER, STORAGE_VEC) \
38 StatusCode MuonDetectorManager::SETTER(ElementPtr<ELE_TYPE> element) { \
40 ATH_MSG_FATAL(__func__ << " -- nullptr is given."); \
41 return StatusCode::FAILURE; \
43 ATH_CHECK(element->initElement()); \
44 element->releaseUnAlignedTrfs(); \
45 size_t idx = static_cast<unsigned int>(element->identHash()); \
46 if (idx >= STORAGE_VEC.size()) \
47 STORAGE_VEC.resize(idx + 1); \
48 std::unique_ptr<ELE_TYPE>& new_element = STORAGE_VEC[idx]; \
50 ATH_MSG_FATAL("The detector element " \
51 << m_idHelperSvc->toStringDetEl(element->identify()) \
52 << " has already been added before " \
53 <<m_idHelperSvc->toStringDetEl(new_element->identify())); \
54 return StatusCode::FAILURE; \
56 new_element = std::move(element); \
57 return StatusCode::SUCCESS; \
59 #define ADD_DETECTOR(ELE_TYPE, STORAGE_VEC) \
60 WRITE_SETTER(ELE_TYPE, add##ELE_TYPE, STORAGE_VEC) \
62 std::vector<const ELE_TYPE*> MuonDetectorManager::getAll##ELE_TYPE##s() const { \
63 std::vector<const ELE_TYPE*> allElements{}; \
64 insert(STORAGE_VEC, allElements); \
68 std::vector<ELE_TYPE*> MuonDetectorManager::getAll##ELE_TYPE##s() { \
69 std::vector<ELE_TYPE*> allElements{}; \
70 insert(STORAGE_VEC, allElements); \
73 #define WRITE_ALLGETTER(TYPE) \
74 std::vector<TYPE MuonReadoutElement*> MuonDetectorManager::getAllReadoutElements() TYPE { \
75 std::vector<TYPE MuonReadoutElement*> allEles{}; \
76 insert(getAllMdtReadoutElements(), allEles); \
77 insert(getAllRpcReadoutElements(), allEles); \
78 insert(getAllTgcReadoutElements(), allEles); \
79 insert(getAllMmReadoutElements(), allEles); \
80 insert(getAllsTgcReadoutElements(), allEles); \
83 TYPE MuonReadoutElement* MuonDetectorManager::getReadoutElement(const Identifier& id) TYPE { \
84 if (m_idHelperSvc->isMdt(id)) return getMdtReadoutElement(id); \
85 else if (m_idHelperSvc->isRpc(id)) return getRpcReadoutElement(id); \
86 else if (m_idHelperSvc->isTgc(id)) return getTgcReadoutElement(id); \
87 else if (m_idHelperSvc->issTgc(id)) return getsTgcReadoutElement(id); \
88 else if (m_idHelperSvc->isMM(id)) return getMmReadoutElement(id); \
89 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Not a muon detector element " \
90 <<m_idHelperSvc->toString(id)); \
97 #ifndef SIMULATIONBASE
99 if (
a->stationName() !=
b->stationName())
return a->stationName() <
b->stationName();
100 if (
a->stationEta() !=
b->stationEta())
return a->stationEta() <
b->stationEta();
101 return a->stationPhi() <
b->stationPhi();
107 if (!m_idHelperSvc.retrieve().isSuccess()) {
108 ATH_MSG_FATAL(__func__<<
"() -- Failed to retrieve the Identifier service");
109 throw std::runtime_error(
"MuonIdHelperSvc does not exist");
123 return m_treeTopVector.size();
136 std::vector<ActsTrk::DetectorType> types{};
145 #ifndef SIMULATIONBASE
148 return re ?
re->getChamber() :
nullptr;
154 if (
re->getChamber()) {
155 allChambers.insert(
re->getChamber());
166 #undef WRITE_ALLGETTER
std::vector< ActsTrk::DetectorType > getDetectorTypes() const
Returns a list of all detector types.
ElementStorage< TgcReadoutElement > m_tgcEles
@ Tgc
Resitive Plate Chambers.
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
Returns the list of all detector elements.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ElementStorage< RpcReadoutElement > m_rpcEles
bool operator()(const MuonChamber *a, const MuonChamber *b) const
A muon chamber is a collection of readout elements belonging to the same station.
@ Mm
Maybe not needed in the migration.
#define WRITE_ALLGETTER(TYPE)
std::set< const MuonChamber *, ChamberSorter > MuonChamberSet
Class to provide easy MsgStream access and capabilities.
ADD_DETECTOR(MdtReadoutElement, m_mdtEles)
const MuonChamber * getChamber(const Identifier &channelId) const
PVConstLink getTreeTop(unsigned int i) const override final
Returns the i-th top node of the MuonSystem trees.
ElementStorage< MdtReadoutElement > m_mdtEles
std::vector< PVConstLink > m_treeTopVector
void addTreeTop(PVConstLink pv)
Adds a new GeoModelTree node indicating the entrance to a muon system description.
std::vector< ElementPtr< MuonDetectorType > > ElementStorage
MuonChamberSet getAllChambers() const
: Returns all MuonChambers associated with the readout geometry
ElementStorage< sTgcReadoutElement > m_sTgcEles
const boost::regex re(r_e)
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns a pointer to the central MuonIdHelperSvc.
@ Rpc
Monitored Drift Tubes.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
ElementStorage< MmReadoutElement > m_mmEles
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.