ATLAS Offline Software
Loading...
Searching...
No Matches
sTgcIdHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ******************************************************************************
6// ATLAS Muon Identifier Helpers Package
7// -----------------------------------------
8// ******************************************************************************
9
10#ifndef MUONIDHELPERS_STGCIDHELPER_H
11#define MUONIDHELPERS_STGCIDHELPER_H
12
13// Includes
15
16// ******************************************************************************
17// class sTgcIdHelper
18// ******************************************************************************//
19// Description
20// -----------
21// This factory class constructs sTGC identifiers and ranges and provides access
22// to the levels. ATLAS note ATL-MUON-2001-014 provides a complete description
23// of the hierarchical identifier scheme. sTgcIdHelper provides an interface to the
24// following fields of the identifier.
25//
26// Field Range Notes
27// ==============================================================================
28// diehl: todo: update this section for sTGC
29// StationName unsigned integer maps to T1F,T3E,etc.
30// StationEta [-4,-1] backward endcap (-1 at lowest R)
31// [1,4] forward endcap (1 at lowest R)
32// StationPhi [1,8] increases with phi
33// Technology [4] maps to sTGC
34// GasGap [1,2] doublet: increases with |Z|
35// [1,3] triplet: increases with |Z|
36// ChannelType [0,2] 0 if pad, 1 if strip, 2 if wire
37// Channel [1,n] increases with R for channelType=1 (strip)
38// increases with phi for channelType=2 (wire)
39// increases with phi and R for channelType=0 (pad)
40//
41// ==============================================================================
42//
43// Inheritance
44// -----------
45// Inherits from MuonIdHelpers/MuonIdHelper.
46//
47// Authors
48// ------
49// Edward Diehl <diehl@umich.edu> based on TgcIdHelper.h
50// Nektarios Chr. Benekos <nectarios.benekos@cern.ch>
51// Philipp Fleischmann <philipp.fleischmann@cern.ch>
52//
53// ******************************************************************************
54
55class sTgcIdHelper : public MuonIdHelper {
56public:
57 // Constructor
59
60 // Destructor
61 virtual ~sTgcIdHelper() = default;
62
64
66 virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
67 virtual int get_module_hash(const Identifier& id, IdentifierHash& hash_id) const override;
68 virtual int get_detectorElement_hash(const Identifier& id, IdentifierHash& hash_id) const override;
69
71
72 // Identifier builders
74 Identifier elementID(int stationName, int stationEta, int stationPhi, bool& isValid) const;
75
76 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const;
77 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const;
78
80
83 bool& isValid) const;
84
85 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
86 int channel) const;
87 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
88 int channel, bool& isValid) const;
89
90 Identifier channelID(const Identifier& id, int multilayer, int gasGap, int channelType, int channel) const;
91 Identifier channelID(const Identifier& id, int multilayer, int gasGap, int channelType, int channel, bool& isValid) const;
92
94 int padPhi) const;
96 bool& isValid) const;
97
98 Identifier padID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
99 int padEta, int padPhi) const;
100 Identifier padID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
101 int padEta, int padPhi, bool& isValid) const;
102
103 Identifier padID(const Identifier& id, int multilayer, int gasGap, int channelType, int padEta, int padPhi) const;
104 Identifier padID(const Identifier& id, int multilayer, int gasGap, int channelType, int padEta, int padPhi, bool& isValid) const;
105
106 Identifier parentID(const Identifier& id) const;
107
108 Identifier multilayerID(const Identifier& channeldID) const;
109 Identifier multilayerID(const Identifier& moduleID, int multilayer) const;
110 Identifier multilayerID(const Identifier& moduleID, int multilayer, bool& isValid) const;
111
112
113 /*
114 For the sTGCs each layer of a quadruplet is read out by two front end boards, one covering the strips (sFEB) and one covering the pads and wires (pFEBs).
115 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
116 sFEBs are always mapped to channel type strip and to channel one of the layer that is readout by this board. pFEBs are mapped to pad channel type and channel one of a layer.
117 The last fuction which just takes the identifier as an input is meant to convert hit identifiers to front end identifiers. It retruns the same fields as the input identifier except for channel which is set to 1 and for wire identifiers the channel type is set to pad.
118 */
119
120 Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType) const;
121 Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, bool& isValid) const;
122 Identifier febID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType) const;
123 Identifier febID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, bool& isValid) const;
126 Identifier febID(const Identifier& channelID) const;
127
128
129 /*
130 One layer of sTGCs is segmented into 4 high voltage sections. Eta station 1 is divided into two hv sections while eta stations 2 and 3 consist of one HV section each. The HV sections are numbered from 1-4. The following functions introduce an identifier that is mapping to these HV sections. For eta stations 2 and 3 it returns the gas gap id, e.g. channel 1 on a give gas gap. For station eta 1, the channel is set sto one for the inner HV section while it is set to 100 for the outer HV section. This is an arbitary mapping, channel 100 does not correspond to the transition between the two HV section (the location is different depending on the module type and the gas gap). The hv identifier is arbitrily set to be a strip type channel.
131 */
132 Identifier hvID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1) const;
133 Identifier hvID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1, bool& isValid) const;
134 Identifier hvID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1) const;
135 Identifier hvID(const std::string& stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1, bool& isValid) const;
136 Identifier hvID(const Identifier& channelId, bool isInnerQ1)const;
137 Identifier hvID(const Identifier& channelId, bool isInnerQ1, bool& isValid) const;
138
139 // for an Identifier id, get the list of the daughter readout channel ids
140 void idChannels(const Identifier& id, std::vector<Identifier>& vect) const;
141
142 // Access to levels: missing field returns 0
143 int gasGap(const Identifier& id) const override;
144 int multilayer(const Identifier& id) const;
145 int channelType(const Identifier& id) const;
146 bool measuresPhi(const Identifier& id) const override;
147 int channel(const Identifier& id) const override;
148 int numberOfMultilayers(const Identifier& id) const;
149 int padEta(const Identifier& id) const;
150 int padPhi(const Identifier& id) const;
151
152 // Access to min and max of level ranges
153 // to be remove when we moved to compact ids
154 static int stationEtaMin() ;
155 static int stationEtaMax() ;
156 static int stationPhiMin() ;
157 static int stationPhiMax() ;
158 static int multilayerMin() ;
159 static int multilayerMax() ;
160 static int gasGapMin() ;
161 static int gasGapMax() ;
162 static int channelTypeMin() ;
163 static int channelTypeMax() ;
164 static int channelMin() ;
165 static int channelMax() ;
166 static int padEtaMin() ;
167 static int padEtaMax() ;
168 static int padPhiMin() ;
169 static int padPhiMax() ;
170
171 // Access to min and max of level ranges
172 int stationEtaMin(const Identifier& id) const;
173 int stationEtaMax(const Identifier& id) const;
174 int stationPhiMin(const Identifier& id) const;
175 int stationPhiMax(const Identifier& id) const;
176 int multilayerMin(const Identifier& id) const;
177 int multilayerMax(const Identifier& id) const;
178 int gasGapMin(const Identifier& id) const;
179 int gasGapMax(const Identifier& id) const;
180 int channelTypeMin(const Identifier& id) const;
181 int channelTypeMax(const Identifier& id) const;
182 int channelMin(const Identifier& id) const;
183 int channelMax(const Identifier& id) const;
184
185 // Public validation of levels
186 bool valid(const Identifier& id) const;
187 bool validElement(const Identifier& id) const;
188
189 // Type indices
190 enum sTgcChannelTypes { Pad = 0, Strip = 1, Wire = 2 };
191
192private:
193 bool isStNameInTech(const std::string& stationName) const override;
194
195 int init_id_to_hashes();
196
198 static constexpr unsigned int s_stDim = 2;
200 static constexpr unsigned int s_etaDim = 6;
202 static constexpr unsigned int s_phiDim = 8;
204 static constexpr unsigned int s_mlDim = 2;
205
206 static constexpr unsigned int s_modHashDim = s_stDim * s_etaDim * s_phiDim;
207 static constexpr unsigned int s_detHashDim = s_modHashDim * s_mlDim;
208
209 std::array<unsigned int, s_modHashDim> m_module_hashes{};
210 std::array<unsigned int, s_detHashDim> m_detectorElement_hashes{};
211
212 unsigned int moduleHashIdx(const Identifier& id) const;
213 unsigned int detEleHashIdx(const Identifier& id) const;
215 unsigned int m_stationShift{std::numeric_limits<unsigned int>::max()};
216
217
218 // compact id indices
221
226
227 // Check level values
228 bool validElement(const Identifier& id, int stationName, int stationEta, int stationPhi) const;
229 bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
230 int channel) const;
231 bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType,
232 int padEta, int padPhi) const;
233
234 // Utility methods
235 int stgcTechnology() const;
236 bool LargeSector(int stationName) const;
237 bool SmallSector(int stationName) const;
238
239 // Level indices
241
242 // Level ranges
259 PadEtaMax = 18 // arbitrary values. these values should be taken from an XML
260 };
261}; // end class sTgcIdHelper
262/*******************************************************************************/
263// For backwards compatibility
265
266CLASS_DEF(sTgcIdHelper, 4174, 1)
267
268#endif // MUONIDHELPERS_STGCIDHELPER_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
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
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)
static int padPhiMax()
int padPhi(const Identifier &id) const
static int padEtaMax()
static constexpr unsigned int s_etaDim
-3, -2, -1, 1, 2, 3
static constexpr unsigned int s_detHashDim
std::array< unsigned int, s_modHashDim > m_module_hashes
IdDictFieldImplementation m_cha_impl
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
int multilayer(const Identifier &id) const
bool valid(const Identifier &id) const
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
static constexpr unsigned int s_stDim
Small and big wedges.
static int channelMin()
static int gasGapMin()
static constexpr unsigned int s_mlDim
2 multilayer
bool SmallSector(int stationName) const
unsigned int m_stationShift
Minimal station index found.
static int stationPhiMax()
static int padPhiMin()
IdDictFieldImplementation m_gap_impl
int stgcTechnology() const
Utility methods.
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Identifier hvID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, bool isInnerQ1) const
int channelType(const Identifier &id) const
static int channelMax()
unsigned int detEleHashIdx(const Identifier &id) const
Identifier elementID(int stationName, int stationEta, int stationPhi) const
int padEta(const Identifier &id) const
int init_id_to_hashes()
Identifier parentID(const Identifier &id) const
static int multilayerMax()
static int gasGapMax()
size_type m_CHANNELTYPE_INDEX
Identifier febID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
static int padEtaMin()
static int stationPhiMin()
int channel(const Identifier &id) const override
Identifier febID(const Identifier &channelID, int channelType) const
static int stationEtaMin()
static int multilayerMin()
bool measuresPhi(const Identifier &id) const override
returns measuresPhi
Identifier padID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int padEta, int padPhi) const
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
IdDictFieldImplementation m_mplet_impl
virtual ~sTgcIdHelper()=default
static int stationEtaMax()
bool LargeSector(int stationName) const
int gasGap(const Identifier &id) const override
get the hashes
static constexpr unsigned int s_modHashDim
static constexpr unsigned int s_phiDim
8 phi station
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
unsigned int moduleHashIdx(const Identifier &id) const
bool validElement(const Identifier &id) const
Identifier multilayerID(const Identifier &channeldID) const
static int channelTypeMax()
int numberOfMultilayers(const Identifier &id) const
IdDictFieldImplementation m_typ_impl
std::array< unsigned int, s_detHashDim > m_detectorElement_hashes
Identifier febID(const Identifier &channelID, int channelType, bool &isValid) const
size_type m_GASGAP_INDEX
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 int channelTypeMin()
sTgcIdHelper sTGC_ID