ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MuonDetectorManager_H
6#define MuonDetectorManager_H
7
10#include <iostream>
11#include <map>
12#include <sstream>
13#include <vector>
15#include "GaudiKernel/StatusCode.h"
16#include "GeoModelKernel/GeoAlignableTransform.h"
17#include "GeoModelKernel/GeoVDetectorManager.h"
23
24
25#ifndef SIMULATIONBASE
28#endif
29
30namespace MuonGM {
31
32
39 class MMReadoutElement;
41 class MuonStation;
42
50
51 class MuonDetectorManager : public GeoVDetectorManager, public AthMessaging {
52 public:
53 // Constructor:
55
56 // Destructor:
58
59 // Gets the number of tree tops: required:
60 virtual unsigned int getNumTreeTops() const;
61
62 // Gets the ith tree top: required:
63 virtual PVConstLink getTreeTop(unsigned int i) const;
64 PVLink getTreeTop(unsigned int i);
65
66 // Add a tree top:
67 void addTreeTop(PVLink);
68
69 // Add a XxxReadoutElement to the Collection
70 void addMdtReadoutElement(std::unique_ptr<MdtReadoutElement>&& reEle);
71 void addRpcReadoutElement(std::unique_ptr<RpcReadoutElement>&& reEle);
72 void addTgcReadoutElement(std::unique_ptr<TgcReadoutElement>&& reEle);
73 void addCscReadoutElement(std::unique_ptr<CscReadoutElement>&& reEle);
74 void addsTgcReadoutElement(std::unique_ptr<sTgcReadoutElement>&& reEle);
75 void addMMReadoutElement(std::unique_ptr<MMReadoutElement>&& reEle);
76
77
78 // access to Readout Elements
79 const MdtReadoutElement* getMdtReadoutElement(const Identifier& id) const;
80 const RpcReadoutElement* getRpcReadoutElement(const Identifier& id) const;
81 const TgcReadoutElement* getTgcReadoutElement(const Identifier& id) const;
82 const CscReadoutElement* getCscReadoutElement(const Identifier& id) const;
83 const MMReadoutElement* getMMReadoutElement(const Identifier& id) const;
86 const MuonReadoutElement* getReadoutElement(const Identifier& id) const;
91
92
97
98 std::vector<const MuonReadoutElement*> getAllReadoutElements() const;
99
100 inline unsigned int nMuonStation() const;
101
102 inline unsigned int nMdtRE() const;
103 inline unsigned int nsTgcRE() const;
104 inline unsigned int nMMRE() const;
105 inline unsigned int nCscRE() const;
106 inline unsigned int nRpcRE() const;
107 inline unsigned int nTgcRE() const;
108
109 inline unsigned int nMdtDE() const;
110 inline unsigned int nCscDE() const;
111 inline unsigned int nRpcDE() const;
112 inline unsigned int nTgcDE() const;
113
114 // Geometry versioning
115 inline const std::string& geometryVersion() const;
116 void setGeometryVersion(const std::string& version);
117 inline const std::string& get_DBMuonVersion() const;
118 void set_DBMuonVersion(const std::string& version);
119
120 // Access to identifier helpers
121 inline const MdtIdHelper* mdtIdHelper() const;
122 inline const CscIdHelper* cscIdHelper() const;
123 inline const RpcIdHelper* rpcIdHelper() const;
124 inline const TgcIdHelper* tgcIdHelper() const;
125 inline const sTgcIdHelper* stgcIdHelper() const;
126 inline const MmIdHelper* mmIdHelper() const;
127
128
129 void setMinimalGeoFlag(int flag);
130 inline int MinimalGeoFlag() const;
131 void setCutoutsFlag(int flag);
132 inline int IncludeCutoutsFlag() const;
133 void setCutoutsBogFlag(int flag);
134 inline int IncludeCutoutsBogFlag() const;
135
136 // Add a MuonStation to the list
137 void addMuonStation(std::unique_ptr<MuonStation>&& mst);
138 const MuonStation* getMuonStation(const std::string& stName, int eta, int phi) const;
139 MuonStation* getMuonStation(const std::string& stName, int eta, int phi);
140 //<! access to the MuonStation by StationName, Jzz, Jff (amdb indices!!!! not stationPhi and Eta)
141 static std::string muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) ;
142
143 void clearCache();
144 void fillCache();
145
146 StatusCode updateAlignment(const ALineContainer& a);
147 StatusCode updateDeformations(const BLineContainer& a);
149 StatusCode updateCSCInternalAlignmentMap(const ALineContainer& cscIntAline);
150
151 void setNswAsBuilt(const NswAsBuiltDbData* nswAsBuiltData);
152 void setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt);
153 void setMmAsBuilt2(const sTGCAsBuiltData* mmAsBuilt2);
154
155#ifndef SIMULATIONBASE
157 return m_nswAsBuilt ? m_nswAsBuilt->microMegaData.get() : nullptr;
158 }
159#endif
163 static constexpr int NCscStEtaOffset = 1;
164 static constexpr int NTgcStatTypeOff = -41;
165 static constexpr int NTgcStEtaOffset = 5;
166
168 return m_stgcAsBuildData;
169 }
171 return m_mmAsBuilt2;
172 }
173
175 return m_mmPassivation;
176 }
177 void setMMPassivation(const NswPassivationDbData* passiv);
178 // map the RPC station indices (0-NRpcStatType) back to the RpcIdHelper stationNames
179 int rpcStationName(const int stationIndex) const;
180
181 private:
182 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"};
183 void loadStationIndices();
184 unsigned int rpcStationTypeIdx(const int stationName) const; // map the RPC stationNames from the RpcIdHelper to 0-NRpcStatType
185 enum RpcStatType { BML = 0, BMS, BOL, BOS, BMF, BOF, BOG, BME, BIR, BIM, BIL, BIS, UNKNOWN };
187 int rpcIdentToArrayIdx(const Identifier& id) const;
188 int tgcIdentToArrayIdx(const Identifier& id) const;
189 int cscIdentToArrayIdx(const Identifier& id) const;
190 int stgcIdentToArrayIdx(const Identifier& id) const;
191 int mmIdenToArrayIdx(const Identifier& id) const;
192 int mdtIdentToArrayIdx(const Identifier& id) const;
193
197
198 std::vector<PVLink> m_envelope; // Tree-top...
199
200
201 // Geometry versioning
202 std::string m_geometryVersion{}; // generic name of the Layout
203 std::string m_DBMuonVersion{}; // name of the MuonVersion table-collection in Oracle
204
205 // 115.6 kBytes.
206 std::vector<std::unique_ptr<MdtReadoutElement>> m_mdtArray;
207 std::vector<std::unique_ptr<CscReadoutElement>> m_cscArray;
208 std::vector<std::unique_ptr<TgcReadoutElement>> m_tgcArray;
209
210 std::vector<std::unique_ptr<RpcReadoutElement>> m_rpcArray;
211 std::vector<std::unique_ptr<sTgcReadoutElement>> m_stgArray;
212 std::vector<std::unique_ptr<MMReadoutElement>> m_mmcArray;
213 std::map<std::string, std::unique_ptr<MuonStation> > m_MuonStationMap;
214
215 unsigned int m_n_mdtRE{0};
216 unsigned int m_n_cscRE{0};
217 unsigned int m_n_rpcRE{0};
218 unsigned int m_n_tgcRE{0};
219 unsigned int m_n_stgRE{0};
220 unsigned int m_n_mmcRE{0};
221
222 unsigned int m_n_mdtDE{0};
223 unsigned int m_n_cscDE{0};
224 unsigned int m_n_rpcDE{0};
225 unsigned int m_n_tgcDE{0};
226
227
232
234 std::map<int, int> m_rpcStatToIdx;
235 std::map<int, int> m_rpcIdxToStat;
236
237
238 };
239
241 return m_idHelperSvc->hasMDT() ? &(m_idHelperSvc->mdtIdHelper()) : nullptr;
242 }
244 return m_idHelperSvc->hasCSC() ? &(m_idHelperSvc->cscIdHelper()) : nullptr;
245 }
247 return m_idHelperSvc->hasRPC() ? &(m_idHelperSvc->rpcIdHelper()): nullptr;
248 }
250 return m_idHelperSvc->hasTGC() ? &(m_idHelperSvc->tgcIdHelper()) : nullptr;
251 }
253 return m_idHelperSvc->hasSTGC() ? &(m_idHelperSvc->stgcIdHelper()) : nullptr;
254 }
256 return m_idHelperSvc->hasMM() ? &(m_idHelperSvc->mmIdHelper()) : nullptr;
257 }
258
259
260
264
265 const std::string& MuonDetectorManager::geometryVersion() const { return m_geometryVersion; }
266 const std::string& MuonDetectorManager::get_DBMuonVersion() const { return m_DBMuonVersion; }
267
268
269 unsigned int MuonDetectorManager::nMuonStation() const { return m_MuonStationMap.size(); }
270 unsigned int MuonDetectorManager::nMdtRE() const { return m_n_mdtRE; }
271 unsigned int MuonDetectorManager::nCscRE() const { return m_n_cscRE; }
272 unsigned int MuonDetectorManager::nRpcRE() const { return m_n_rpcRE; }
273 unsigned int MuonDetectorManager::nTgcRE() const { return m_n_tgcRE; }
274 unsigned int MuonDetectorManager::nsTgcRE() const { return m_n_stgRE; }
275 unsigned int MuonDetectorManager::nMMRE() const { return m_n_mmcRE; }
276
277 unsigned int MuonDetectorManager::nMdtDE() const { return m_n_mdtDE; }
278 unsigned int MuonDetectorManager::nCscDE() const { return m_n_cscDE; }
279 unsigned int MuonDetectorManager::nRpcDE() const { return m_n_rpcDE; }
280 unsigned int MuonDetectorManager::nTgcDE() const { return m_n_tgcDE; }
281
282} // namespace MuonGM
283
284#ifndef GAUDI_NEUTRAL
285namespace MuonGM {
286 class MuonDetectorManager;
287}
290#endif
291
292#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define CONDCONT_MIXED_DEF(...)
Definition CondCont.h:1446
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
std::set< ALinePar, std::less<> > ALineContainer
std::set< MdtAsBuiltPar, std::less<> > MdtAsBuiltContainer
std::set< BLinePar, std::less<> > BLineContainer
static Double_t a
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This is a "hash" representation of an Identifier.
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
StatusCode updateCSCInternalAlignmentMap(const ALineContainer &cscIntAline)
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Get any read out element.
static constexpr int NCscStEtaOffset
Identifier <-> AMDB conversion constants in use.
void addsTgcReadoutElement(std::unique_ptr< sTgcReadoutElement > &&reEle)
store the sTGCReadoutElement using as "key" the identifier
void addRpcReadoutElement(std::unique_ptr< RpcReadoutElement > &&reEle)
store the RpcReadoutElement using as "key" the identifier
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const std::string & get_DBMuonVersion() const
the name of the MuonSpectrometer tag (in the geometry DB) actually accessed
const std::string & geometryVersion() const
it can be Rome-Initial or P03, or ... it's the name of the layout
int rpcIdentToArrayIdx(const Identifier &id) const
Helper method to convert the Identifier into the corresponding index accessing the array.
static std::string muonStationKey(const std::string &stName, int statEtaIndex, int statPhiIndex)
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
std::map< std::string, std::unique_ptr< MuonStation > > m_MuonStationMap
void addCscReadoutElement(std::unique_ptr< CscReadoutElement > &&reEle)
store the CscReadoutElement using as "key" the identifier
void addMdtReadoutElement(std::unique_ptr< MdtReadoutElement > &&reEle)
store the MdtReadoutElement using as "key" the identifier
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
void addTgcReadoutElement(std::unique_ptr< TgcReadoutElement > &&reEle)
store the TgcReadoutElement using as "key" the identifier
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
void addMMReadoutElement(std::unique_ptr< MMReadoutElement > &&reEle)
store the MMReadoutElement using as "key" the identifier
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Class holding the sTGC as built conditions data and applying it.
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27