ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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 inline unsigned int nMuonStation() const;
99
100 inline unsigned int nMdtRE() const;
101 inline unsigned int nsTgcRE() const;
102 inline unsigned int nMMRE() const;
103 inline unsigned int nCscRE() const;
104 inline unsigned int nRpcRE() const;
105 inline unsigned int nTgcRE() const;
106
107 inline unsigned int nMdtDE() const;
108 inline unsigned int nCscDE() const;
109 inline unsigned int nRpcDE() const;
110 inline unsigned int nTgcDE() const;
111
112 // Geometry versioning
113 inline const std::string& geometryVersion() const;
114 void setGeometryVersion(const std::string& version);
115 inline const std::string& get_DBMuonVersion() const;
116 void set_DBMuonVersion(const std::string& version);
117
118 // Access to identifier helpers
119 inline const MdtIdHelper* mdtIdHelper() const;
120 inline const CscIdHelper* cscIdHelper() const;
121 inline const RpcIdHelper* rpcIdHelper() const;
122 inline const TgcIdHelper* tgcIdHelper() const;
123 inline const sTgcIdHelper* stgcIdHelper() const;
124 inline const MmIdHelper* mmIdHelper() const;
125
126
127 void setMinimalGeoFlag(int flag);
128 inline int MinimalGeoFlag() const;
129 void setCutoutsFlag(int flag);
130 inline int IncludeCutoutsFlag() const;
131 void setCutoutsBogFlag(int flag);
132 inline int IncludeCutoutsBogFlag() const;
133
134 // Add a MuonStation to the list
135 void addMuonStation(std::unique_ptr<MuonStation>&& mst);
136 const MuonStation* getMuonStation(const std::string& stName, int eta, int phi) const;
137 MuonStation* getMuonStation(const std::string& stName, int eta, int phi);
138 //<! access to the MuonStation by StationName, Jzz, Jff (amdb indices!!!! not stationPhi and Eta)
139 static std::string muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) ;
140
141 void clearCache();
142 void fillCache();
143
144 StatusCode updateAlignment(const ALineContainer& a);
145 StatusCode updateDeformations(const BLineContainer& a);
147 StatusCode updateCSCInternalAlignmentMap(const ALineContainer& cscIntAline);
148
149 void setNswAsBuilt(const NswAsBuiltDbData* nswAsBuiltData);
150 void setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt);
151 void setMmAsBuilt2(const sTGCAsBuiltData* mmAsBuilt2);
152
153#ifndef SIMULATIONBASE
155 return m_nswAsBuilt ? m_nswAsBuilt->microMegaData.get() : nullptr;
156 }
157#endif
161 static constexpr int NCscStEtaOffset = 1;
162 static constexpr int NTgcStatTypeOff = -41;
163 static constexpr int NTgcStEtaOffset = 5;
164
166 return m_stgcAsBuildData;
167 }
169 return m_mmAsBuilt2;
170 }
171
173 return m_mmPassivation;
174 }
175 void setMMPassivation(const NswPassivationDbData* passiv);
176 // map the RPC station indices (0-NRpcStatType) back to the RpcIdHelper stationNames
177 int rpcStationName(const int stationIndex) const;
178
179 private:
180 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"};
181 void loadStationIndices();
182 unsigned int rpcStationTypeIdx(const int stationName) const; // map the RPC stationNames from the RpcIdHelper to 0-NRpcStatType
183 enum RpcStatType { BML = 0, BMS, BOL, BOS, BMF, BOF, BOG, BME, BIR, BIM, BIL, BIS, UNKNOWN };
185 int rpcIdentToArrayIdx(const Identifier& id) const;
186 int tgcIdentToArrayIdx(const Identifier& id) const;
187 int cscIdentToArrayIdx(const Identifier& id) const;
188 int stgcIdentToArrayIdx(const Identifier& id) const;
189 int mmIdenToArrayIdx(const Identifier& id) const;
190 int mdtIdentToArrayIdx(const Identifier& id) const;
191
195
196 std::vector<PVLink> m_envelope; // Tree-top...
197
198
199 // Geometry versioning
200 std::string m_geometryVersion{}; // generic name of the Layout
201 std::string m_DBMuonVersion{}; // name of the MuonVersion table-collection in Oracle
202
203 // 115.6 kBytes.
204 std::vector<std::unique_ptr<MdtReadoutElement>> m_mdtArray;
205 std::vector<std::unique_ptr<CscReadoutElement>> m_cscArray;
206 std::vector<std::unique_ptr<TgcReadoutElement>> m_tgcArray;
207
208 std::vector<std::unique_ptr<RpcReadoutElement>> m_rpcArray;
209 std::vector<std::unique_ptr<sTgcReadoutElement>> m_stgArray;
210 std::vector<std::unique_ptr<MMReadoutElement>> m_mmcArray;
211 std::map<std::string, std::unique_ptr<MuonStation> > m_MuonStationMap;
212
213 unsigned int m_n_mdtRE{0};
214 unsigned int m_n_cscRE{0};
215 unsigned int m_n_rpcRE{0};
216 unsigned int m_n_tgcRE{0};
217 unsigned int m_n_stgRE{0};
218 unsigned int m_n_mmcRE{0};
219
220 unsigned int m_n_mdtDE{0};
221 unsigned int m_n_cscDE{0};
222 unsigned int m_n_rpcDE{0};
223 unsigned int m_n_tgcDE{0};
224
225
230
232 std::map<int, int> m_rpcStatToIdx;
233 std::map<int, int> m_rpcIdxToStat;
234
235
236 };
237
239 return m_idHelperSvc->hasMDT() ? &(m_idHelperSvc->mdtIdHelper()) : nullptr;
240 }
242 return m_idHelperSvc->hasCSC() ? &(m_idHelperSvc->cscIdHelper()) : nullptr;
243 }
245 return m_idHelperSvc->hasRPC() ? &(m_idHelperSvc->rpcIdHelper()): nullptr;
246 }
248 return m_idHelperSvc->hasTGC() ? &(m_idHelperSvc->tgcIdHelper()) : nullptr;
249 }
251 return m_idHelperSvc->hasSTGC() ? &(m_idHelperSvc->stgcIdHelper()) : nullptr;
252 }
254 return m_idHelperSvc->hasMM() ? &(m_idHelperSvc->mmIdHelper()) : nullptr;
255 }
256
257
258
262
263 const std::string& MuonDetectorManager::geometryVersion() const { return m_geometryVersion; }
264 const std::string& MuonDetectorManager::get_DBMuonVersion() const { return m_DBMuonVersion; }
265
266
267 unsigned int MuonDetectorManager::nMuonStation() const { return m_MuonStationMap.size(); }
268 unsigned int MuonDetectorManager::nMdtRE() const { return m_n_mdtRE; }
269 unsigned int MuonDetectorManager::nCscRE() const { return m_n_cscRE; }
270 unsigned int MuonDetectorManager::nRpcRE() const { return m_n_rpcRE; }
271 unsigned int MuonDetectorManager::nTgcRE() const { return m_n_tgcRE; }
272 unsigned int MuonDetectorManager::nsTgcRE() const { return m_n_stgRE; }
273 unsigned int MuonDetectorManager::nMMRE() const { return m_n_mmcRE; }
274
275 unsigned int MuonDetectorManager::nMdtDE() const { return m_n_mdtDE; }
276 unsigned int MuonDetectorManager::nCscDE() const { return m_n_cscDE; }
277 unsigned int MuonDetectorManager::nRpcDE() const { return m_n_rpcDE; }
278 unsigned int MuonDetectorManager::nTgcDE() const { return m_n_tgcDE; }
279
280} // namespace MuonGM
281
282#ifndef GAUDI_NEUTRAL
283namespace MuonGM {
284 class MuonDetectorManager;
285}
288#endif
289
290#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
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