ATLAS Offline Software
Loading...
Searching...
No Matches
MmIdHelper.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// ******************************************************************************
6// ATLAS Muon Identifier Helpers Package
7// -----------------------------------------
8// ******************************************************************************
9
10#ifndef MUONIDHELPERS_MMIDHELPER_H
11#define MUONIDHELPERS_MMIDHELPER_H
12
13// Includes
14class MsgStream;
16
17// ******************************************************************************
18// class MmIdHelper
19// ******************************************************************************//
20// Description
21// -----------
22// This factory class constructs MicroMegas (MM) identifiers and ranges and provides access
23// to the levels. ATLAS note ATL-MUON-2001-014 provides a complete description
24// of the hierarchical identifier scheme.
25// MmIdHelper provides an interface to the following fields of the identifier.
26//
27// Field Range Notes
28// ==============================================================================
29// nectar: todo: update this section for MM
30// StationName unsigned integer maps to T1F,T3E,etc.
31// StationEta [-5,-1] backward endcap (-1 at lowest R)
32// [1,5] forward endcap (1 at lowest R)
33// StationPhi [1,48] endcap: increases with phi
34// [1,24] forward: increases with phi
35// Technology [5] maps to MM --> <label name="MM" value="5" /> in IdDictMuonSpectrometer_R.01.xml
36// Multilayer [1,2] barrel: increases with R
37// endcap: increases with |Z|
38// GasGap [1,2] doublet: increases with |Z|
39// [1,3] triplet: increases with |Z|
40// Channel [1,n] increases with R for IsStrip=0 (wire gang)
41// increases with phi for IsStrip=1 (strip)
42// ==============================================================================
43//
44// Inheritance
45// -----------
46// Inherits from MuonIdHelpers/MuonIdHelpers
47//
48// Author
49// ------
50// Nektarios Chr. Benekos <nectarios.benekos@cern.ch>
51// Jochen Meyer <Jochen.Meyer@cern.ch>
52// ******************************************************************************
53
54class MmIdHelper : public MuonIdHelper {
55public:
56 // Constructor
57 MmIdHelper();
58
59 // Destructor
60 virtual ~MmIdHelper() = default;
61
63
65 virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
66 virtual int get_module_hash(const Identifier& id, IdentifierHash& hash_id) const override;
67 virtual int get_detectorElement_hash(const Identifier& id, IdentifierHash& hash_id) const override;
68
70
71 // Identifier builders
73 Identifier elementID(int stationName, int stationEta, int stationPhi, bool& isValid) const;
74
75 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const;
76 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const;
77
79
81 Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel, bool& isValid) const;
82
83 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const;
84 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channel,
85 bool& isValid) const;
86
87 Identifier channelID(const Identifier& id, int multilayer, int gasGap, int channel) const;
88 Identifier channelID(const Identifier& id, int multilayer, int gasGap, int channel, bool& isValid) const;
89
90 Identifier parentID(const Identifier& id) const;
91
92 Identifier multilayerID(const Identifier& channeldID) const;
93 Identifier multilayerID(const Identifier& moduleID, int multilayer) const;
94 Identifier multilayerID(const Identifier& moduleID, int multilayer, bool& isValid) const;
95
96 Identifier pcbID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb) const;
97 Identifier pcbID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb, bool& isValid) const;
98 Identifier pcbID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb) const;
99 Identifier pcbID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb, bool& isValid) const;
100 Identifier pcbID(const Identifier& channelID, int pcb) const;
101 Identifier pcbID(const Identifier& channelID, int pcb, bool& isValid) const;
102 Identifier pcbID(const Identifier& channelID) const;
103 /*
104 One readout board of the Micromegas cover 512 channels and they are named according to their radial position in a layer (0-15).
105 This helper function creates a dummy identifier which can be associated with a front end board, which is primarily needed to deal with the correlation between DCS data and the hits in athena.
106 The identifier always points to the innermost channel that is read out by a given front end board, i.e. radius*512 + 1 (_1 since athena counts from one). For the outer quads it is (radius-10)*512+1 since athena restarts from channel 1 in the outer quads but the DAQ convention for radius counts for the full sector and only febs 0-9 are reading out the inner quad
107 The las function is meant to translate an athena identifier to a feb ID. It returns the same fields except for the channel which is set to the coresponding feb channel by doing ((channel-1)/512)*512+1 (one also needs to take into account the quad, see the actual implementation for that)
108 */
109 Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius) const;
110 Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius, bool& isValid) const;
111 Identifier febID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius) const;
112 Identifier febID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius, bool& isValid) const;
113 Identifier febID(const Identifier& channelID, int radius) const;
114 Identifier febID(const Identifier& channelID, int radius, bool& isValid) const;
115 Identifier febID(const Identifier& channelID) const;
116
117
118 // for an Identifier id, get the list of the daughter readout channel ids
119 void idChannels(const Identifier& id, std::vector<Identifier>& vect) const;
120
121 // Access to levels: missing field returns 0
122 int gasGap(const Identifier& id) const override;
123 int multilayer(const Identifier& id) const;
124 int channel(const Identifier& id) const override;
125 bool isStereo(const Identifier& id) const;
126 bool measuresPhi(const Identifier& id) const override; // Returns false
127
128 int numberOfMultilayers(const Identifier& id) const;
129
130 // Access to min and max of level ranges
131 // to be remove when we moved to compact ids
132 static int stationEtaMin() ;
133 static int stationEtaMax() ;
134 static int stationPhiMin() ;
135 static int stationPhiMax() ;
136 static int multilayerMin() ;
137 static int multilayerMax() ;
138 static int gasGapMin() ;
139 static int gasGapMax() ;
140 static int channelMin() ;
141 static int channelMax() ;
142
143 // Access to min and max of level ranges
144 int stationEtaMin(const Identifier& id) const;
145 int stationEtaMax(const Identifier& id) const;
146 int stationPhiMin(const Identifier& id) const;
147 int stationPhiMax(const Identifier& id) const;
148 int multilayerMin(const Identifier& id) const;
149 int multilayerMax(const Identifier& id) const;
150 int gasGapMin(const Identifier& id) const;
151 int gasGapMax(const Identifier& id) const;
152 int channelMin(const Identifier& id) const;
153 int channelMax(const Identifier& id) const;
154
155 // Utility methods
156 static int sectorType(const std::string& stationName, int stationEta) ;
157 int sectorType(int stationName, int stationEta) const;
158
159 // Public validation of levels
160 bool valid(const Identifier& id) const;
161 bool validElement(const Identifier& id) const;
162
163private:
164 static int getFirstPcbChnl(int stationEta, int pcb) ;
165 static int getFirstRadiusChnl(int stationEta, int pcb) ;
166 bool isStNameInTech(const std::string& stationName) const override;
167
168 int stationEtaMin(const ExpandedIdentifier& expId) const;
169 int stationEtaMax(const ExpandedIdentifier& expId) const;
170 int stationPhiMin(const ExpandedIdentifier& expId) const;
171 int stationPhiMax(const ExpandedIdentifier& expId) const;
172 int multilayerMin(const ExpandedIdentifier& expId) const;
173 int multilayerMax(const ExpandedIdentifier& expId) const;
174 int gasGapMin(const ExpandedIdentifier& expId) const;
175 int gasGapMax(const ExpandedIdentifier& expId) const;
176 int channelMin(const ExpandedIdentifier& expId) const;
177 int channelMax(const ExpandedIdentifier& expId) const;
178
179 int init_id_to_hashes();
181 static constexpr unsigned int s_stDim = 2;
183 static constexpr unsigned int s_etaDim = 4;
185 static constexpr unsigned int s_phiDim = 8;
187 static constexpr unsigned int s_mlDim = 2;
188
189 static constexpr unsigned int s_modHashDim = s_stDim * s_etaDim * s_phiDim;
190 static constexpr unsigned int s_detHashDim = s_modHashDim * s_mlDim;
191
192 std::array<unsigned int, s_modHashDim> m_module_hashes{};
193 std::array<unsigned int, s_detHashDim> m_detectorElement_hashes{};
194
195 unsigned int moduleHashIdx(const Identifier& id) const;
196 unsigned int detEleHashIdx(const Identifier& id) const;
198 unsigned int m_stationShift{std::numeric_limits<unsigned int>::max()};
199
200 // compact id indices
202
206
207 // Check level values
208 bool validElement(const ExpandedIdentifier& expId, int stationName, int stationEta, int stationPhi) const;
209 bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const;
210
211 // Utility methods
212 int mmTechnology() const;
213 bool LargeSector(int stationName) const;
214 bool SmallSector(int stationName) const;
215
216 // Level indices
218
219 // Level ranges
220 enum MmRanges {
223 StationPhiMin = 1, // ED: change for MM
224 StationPhiMax = 8, // ED: change for MM
231 };
232
233}; // end class MmIdHelper
234/*******************************************************************************/
235// For backwards compatibility
237
238CLASS_DEF(MmIdHelper, 4175, 1)
239
240#endif // MUONIDHELPERS_MMIDHELPER_H
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
MmIdHelper MM_ID
Definition MmIdHelper.h:236
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
static int gasGapMax()
Identifier elementID(int stationName, int stationEta, int stationPhi) const
static int channelMin()
static int stationEtaMax()
IdDictFieldImplementation m_cha_impl
Definition MmIdHelper.h:205
unsigned int detEleHashIdx(const Identifier &id) const
static int channelMax()
Identifier pcbID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int pcb) const
bool LargeSector(int stationName) const
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
unsigned int moduleHashIdx(const Identifier &id) const
Identifier multilayerID(const Identifier &channeldID) const
bool isStereo(const Identifier &id) const
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
bool valid(const Identifier &id) const
virtual ~MmIdHelper()=default
IdDictFieldImplementation m_gap_impl
Definition MmIdHelper.h:204
Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int radius) const
static int sectorType(const std::string &stationName, int stationEta)
int channel(const Identifier &id) const override
static constexpr unsigned int s_detHashDim
Definition MmIdHelper.h:190
static int gasGapMin()
int numberOfMultilayers(const Identifier &id) const
static int stationPhiMin()
IdDictFieldImplementation m_mplet_impl
Definition MmIdHelper.h:203
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
std::array< unsigned int, s_detHashDim > m_detectorElement_hashes
Definition MmIdHelper.h:193
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
static constexpr unsigned int s_modHashDim
Definition MmIdHelper.h:189
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
static int stationEtaMin()
int mmTechnology() const
Utility methods.
int gasGap(const Identifier &id) const override
get the hashes
static int multilayerMin()
std::array< unsigned int, s_modHashDim > m_module_hashes
Definition MmIdHelper.h:192
unsigned int m_stationShift
Minimal station index found.
Definition MmIdHelper.h:198
static int getFirstPcbChnl(int stationEta, int pcb)
static constexpr unsigned int s_etaDim
-2, -1 , 1, 2
Definition MmIdHelper.h:183
static constexpr unsigned int s_phiDim
8 phi station
Definition MmIdHelper.h:185
bool SmallSector(int stationName) const
size_type m_GASGAP_INDEX
Definition MmIdHelper.h:201
static int getFirstRadiusChnl(int stationEta, int pcb)
static constexpr unsigned int s_stDim
Small and big wedges.
Definition MmIdHelper.h:181
static int multilayerMax()
static int stationPhiMax()
static constexpr unsigned int s_mlDim
2 multilayer
Definition MmIdHelper.h:187
Identifier parentID(const Identifier &id) const
int init_id_to_hashes()
bool validElement(const Identifier &id) const
int multilayer(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
int stationEta(const Identifier &id) const
int stationPhi(const Identifier &id) const
int stationName(const Identifier &id) const
Identifier::size_type size_type
MuonIdHelper(const std::string &logName, const std::string &group)