ATLAS Offline Software
TgcIdHelper.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 #ifndef MUONIDHELPERS_TGCIDHELPER_H
6 #define MUONIDHELPERS_TGCIDHELPER_H
7 
9 
10 // ******************************************************************************
11 // class TgcIdHelper
12 // ******************************************************************************
13 //
14 // Description
15 // -----------
16 // This factory class constructs TGC identifiers and ranges and provides access
17 // to the levels. ATLAS note ATL-MUON-2001-014 provides a complete description
18 // of the hierarchical identifier scheme. TgcIdHelper provides an interface to the
19 // following fields of the identifier.
20 //
21 // Field Range Notes
22 // ==============================================================================
23 // StationName unsigned integer maps to T1F,T3E,etc.
24 // StationEta [-5,-1] backward endcap (-1 at lowest R)
25 // [1,5] forward endcap (1 at lowest R)
26 // StationPhi [1,48] endcap: increases with phi
27 // [1,24] forward: increases with phi
28 // Technology [3] maps to TGC
29 // GasGap [1,2] doublet: increases with |Z|
30 // [1,3] triplet: increases with |Z|
31 // IsStrip [0,1] 0 if wire, 1 if strip: corresponds to measuresPhi
32 // Channel [1,n] increases with R for IsStrip=0 (wire gang)
33 // increases with phi for IsStrip=1 (strip)
34 // ==============================================================================
35 //
36 // Inheritance
37 // -----------
38 // Inherits from MuonIdHelpers/MuonIdHelper.
39 //
40 // Author
41 // ------
42 // Steven Goldfarb <Steven.Goldfarb@cern.ch>
43 //
44 // Compact ID implementation by
45 // Ketevi A. Assamagan <ketevi@bnl.gov>
46 // BNL, March 6th, 2003
47 //
48 // ******************************************************************************
49 
50 class TgcIdHelper : public MuonIdHelper {
51 public:
52  // Constructor
53 
54  TgcIdHelper();
55 
56  // Destructor
57 
58  virtual ~TgcIdHelper() = default;
59 
61 
63  virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
64  virtual int get_module_hash(const Identifier& id, IdentifierHash& hash_id) const override;
65  virtual int get_detectorElement_hash(const Identifier& id, IdentifierHash& hash_id) const override;
66 
68 
69  // Identifier builders
70 
72  Identifier elementID(int stationName, int stationEta, int stationPhi, bool& isValid) const;
73 
74  Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const;
75  Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const;
76 
78  Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const;
79  Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel, bool& isValid) const;
80 
81  Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const;
82  Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip, int channel,
83  bool& isValid) const;
84 
85  Identifier channelID(const Identifier& id, int gasGap, int isStrip, int channel) const;
86  Identifier channelID(const Identifier& id, int gasGap, int isStrip, int channel, bool& isValid) const;
87 
88  Identifier parentID(const Identifier& id) const;
89 
90  // for an Identifier id, get the list of the daughter readout channel ids
91  void idChannels(const Identifier& id, std::vector<Identifier>& vect) const;
92 
93  // Access to levels: missing field returns 0
94 
95  int gasGap(const Identifier& id) const override;
96 
98  int isStrip(const Identifier& id) const;
99  bool measuresPhi(const Identifier& id) const override;
100 
101  int channel(const Identifier& id) const override;
102 
103  // Access to min and max of level ranges
104  // to be remove when we moved to compact ids
105 
106  static int stationEtaMin() ;
107  static int stationEtaMax() ;
108  static int stationPhiMin(bool endcap) ;
109  static int stationPhiMax(bool endcap) ;
110  static int gasGapMin() ;
111  static int gasGapMax(bool triplet) ;
112  static int isStripMin() ;
113  static int isStripMax() ;
114  static int channelMin() ;
115  static int channelMax() ;
116 
117  // Access to min and max of level ranges
118 
119  int stationEtaMin(const Identifier& id) const;
120  int stationEtaMax(const Identifier& id) const;
121  int stationPhiMin(const Identifier& id) const;
122  int stationPhiMax(const Identifier& id) const;
123  int gasGapMin(const Identifier& id) const;
124  int gasGapMax(const Identifier& id) const;
125  int isStripMin(const Identifier& id) const;
126  int isStripMax(const Identifier& id) const;
127  int channelMin(const Identifier& id) const;
128  int channelMax(const Identifier& id) const;
129 
130  // Utility methods
131 
132  static int chamberType(const std::string& stationName, int stationEta) ;
133  int chamberType(int stationName, int stationEta) const;
134 
135  // Public validation of levels
136 
137  bool valid(const Identifier& id) const;
138  bool validElement(const Identifier& id) const;
139 
140 private:
141  bool isStNameInTech(const std::string& stationName) const override;
142 
143  int init_id_to_hashes();
144 
146  static constexpr unsigned int s_stDim = 8;
148  static constexpr unsigned int s_etaDim = 10;
150  static constexpr unsigned int s_phiDim = 48;
151 
152  static constexpr unsigned int s_modHashDim = s_stDim * s_etaDim * s_phiDim;
153 
154  unsigned int moduleHashIdx(const Identifier& id) const;
157 
158  std::array<unsigned int, s_modHashDim> m_module_hashes{};
159 
160  // compact id indices
163 
167 
168  // Check level values
169 
170  bool validElement(const Identifier& id, int stationName, int stationEta, int stationPhi) const;
171  bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const;
172 
173  // Utility methods
174 
175  int tgcTechnology() const;
176  bool endcapChamber(int stationName) const;
177  bool tripletChamber(int stationName) const;
178 
179  // Level indices
180 
182 
183  // Level ranges
184 
185  enum TgcRanges {
198  ChannelMax = 135
199  };
200 };
201 
202 // For backwards compatibility
203 
205 
206 CLASS_DEF(TgcIdHelper, 4173, 1)
207 
208 // Construct ID from components
209 
210 #endif // MUONIDHELPERS_TGCIDHELPER_H
TgcIdHelper::stationPhiMin
static int stationPhiMin(bool endcap)
Definition: TgcIdHelper.cxx:657
TgcIdHelper::StationPhiEndcapMax
@ StationPhiEndcapMax
Definition: TgcIdHelper.h:189
TgcIdHelper::m_ist_impl
IdDictFieldImplementation m_ist_impl
Definition: TgcIdHelper.h:165
MuonIdHelper.h
TgcIdHelper::parentID
Identifier parentID(const Identifier &id) const
Definition: TgcIdHelper.cxx:631
TgcIdHelper::ChannelMax
@ ChannelMax
Definition: TgcIdHelper.h:198
TgcIdHelper::isStripMin
static int isStripMin()
Definition: TgcIdHelper.cxx:665
TgcIdHelper::ChannelMin
@ ChannelMin
Definition: TgcIdHelper.h:197
max
#define max(a, b)
Definition: cfImp.cxx:41
TgcIdHelper::chamberType
static int chamberType(const std::string &stationName, int stationEta)
Definition: TgcIdHelper.cxx:690
TgcIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition: TgcIdHelper.cxx:642
TgcIdHelper::channelMax
static int channelMax()
Definition: TgcIdHelper.cxx:671
TgcIdHelper::GasGapTripletMax
@ GasGapTripletMax
Definition: TgcIdHelper.h:194
TgcIdHelper
Definition: TgcIdHelper.h:50
TgcIdHelper::channelMin
static int channelMin()
Definition: TgcIdHelper.cxx:669
TgcIdHelper::TgcRanges
TgcRanges
Definition: TgcIdHelper.h:185
TgcIdHelper::validElement
bool validElement(const Identifier &id) const
Definition: TgcIdHelper.cxx:489
TgcIdHelper::moduleHashIdx
unsigned int moduleHashIdx(const Identifier &id) const
Definition: TgcIdHelper.cxx:209
TgcIdHelper::StationPhiForwardMin
@ StationPhiForwardMin
Definition: TgcIdHelper.h:190
TgcIdHelper::tgcTechnology
int tgcTechnology() const
Utility methods.
Definition: TgcIdHelper.cxx:674
TgcIdHelper::StationPhiForwardMax
@ StationPhiForwardMax
Definition: TgcIdHelper.h:191
TgcIdHelper::StationPhiEndcapMin
@ StationPhiEndcapMin
Definition: TgcIdHelper.h:188
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:804
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
TgcIdHelper::get_detectorElement_hash
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: TgcIdHelper.cxx:240
TGC_ID
TgcIdHelper TGC_ID
Definition: TgcIdHelper.h:204
TgcIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
Definition: TgcIdHelper.cxx:647
TgcIdHelper::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: TgcIdHelper.cxx:12
TgcIdHelper::channel
int channel(const Identifier &id) const override
Definition: TgcIdHelper.cxx:649
TgcIdHelper::StationEtaMin
@ StationEtaMin
Definition: TgcIdHelper.h:186
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:384
TgcIdHelper::GasGapDoubletMax
@ GasGapDoubletMax
Definition: TgcIdHelper.h:193
TgcIdHelper::m_stationShift
unsigned int m_stationShift
Minimal station index found.
Definition: TgcIdHelper.h:156
IdDictMgr
Definition: IdDictDefs.h:32
MuonIdHelper
Definition: MuonIdHelper.h:80
TgcIdHelper::stationEtaMin
static int stationEtaMin()
Definition: TgcIdHelper.cxx:653
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
TgcIdHelper::IsStripIndex
@ IsStripIndex
Definition: TgcIdHelper.h:181
TgcIdHelper::~TgcIdHelper
virtual ~TgcIdHelper()=default
TgcIdHelper::m_cha_impl
IdDictFieldImplementation m_cha_impl
Definition: TgcIdHelper.h:166
TgcIdHelper::stationPhiMax
static int stationPhiMax(bool endcap)
Definition: TgcIdHelper.cxx:659
TgcIdHelper::get_module_hash
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: TgcIdHelper.cxx:233
TgcIdHelper::tripletChamber
bool tripletChamber(int stationName) const
Definition: TgcIdHelper.cxx:685
TgcIdHelper::isStNameInTech
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
Definition: TgcIdHelper.cxx:488
TgcIdHelper::IsStripMax
@ IsStripMax
Definition: TgcIdHelper.h:196
TgcIdHelper::GasGapMin
@ GasGapMin
Definition: TgcIdHelper.h:192
TgcIdHelper::isStrip
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
Definition: TgcIdHelper.cxx:645
TgcIdHelper::gasGapMax
static int gasGapMax(bool triplet)
Definition: TgcIdHelper.cxx:663
TgcIdHelper::elementID
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Definition: TgcIdHelper.cxx:556
TgcIdHelper::s_stDim
static constexpr unsigned int s_stDim
T1F-> 41 ; T1E->42 , T2F -> 43, T2E->44, T3F->45, T3E->46, T4E->48.
Definition: TgcIdHelper.h:146
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:814
TgcIdHelper::TgcIndices
TgcIndices
Definition: TgcIdHelper.h:181
TgcIdHelper::GasGapIndex
@ GasGapIndex
Definition: TgcIdHelper.h:181
TgcIdHelper::StationEtaMax
@ StationEtaMax
Definition: TgcIdHelper.h:187
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:809
TgcIdHelper::m_module_hashes
std::array< unsigned int, s_modHashDim > m_module_hashes
Definition: TgcIdHelper.h:158
TgcIdHelper::validChannel
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
Definition: TgcIdHelper.cxx:536
TgcIdHelper::endcapChamber
bool endcapChamber(int stationName) const
Definition: TgcIdHelper.cxx:680
TgcIdHelper::init_id_to_hashes
int init_id_to_hashes()
Definition: TgcIdHelper.cxx:217
TgcIdHelper::s_phiDim
static constexpr unsigned int s_phiDim
48 phi stations
Definition: TgcIdHelper.h:150
TgcIdHelper::IsStripMin
@ IsStripMin
Definition: TgcIdHelper.h:195
TgcIdHelper::isStripMax
static int isStripMax()
Definition: TgcIdHelper.cxx:667
TgcIdHelper::m_GASGAP_INDEX
size_type m_GASGAP_INDEX
Definition: TgcIdHelper.h:161
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TgcIdHelper::ChannelIndex
@ ChannelIndex
Definition: TgcIdHelper.h:181
TgcIdHelper::gasGapMin
static int gasGapMin()
Definition: TgcIdHelper.cxx:661
TgcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
Definition: TgcIdHelper.cxx:583
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
Definition: IdentifierHash.h:38
TgcIdHelper::idChannels
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
Definition: TgcIdHelper.cxx:244
TgcIdHelper::stationEtaMax
static int stationEtaMax()
Definition: TgcIdHelper.cxx:655
TgcIdHelper::m_ISSTRIP_INDEX
size_type m_ISSTRIP_INDEX
Definition: TgcIdHelper.h:162
TgcIdHelper::s_etaDim
static constexpr unsigned int s_etaDim
Except T2E all stations have 4 associated eta stations.
Definition: TgcIdHelper.h:148
TgcIdHelper::s_modHashDim
static constexpr unsigned int s_modHashDim
Definition: TgcIdHelper.h:152
TgcIdHelper::m_gap_impl
IdDictFieldImplementation m_gap_impl
Definition: TgcIdHelper.h:164
TgcIdHelper::valid
bool valid(const Identifier &id) const
Definition: TgcIdHelper.cxx:465
TgcIdHelper::TgcIdHelper
TgcIdHelper()
Definition: TgcIdHelper.cxx:7