ATLAS Offline Software
Loading...
Searching...
No Matches
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
50class TgcIdHelper : public MuonIdHelper {
51public:
52 // Constructor
53
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
140private:
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;
156 unsigned int m_stationShift{std::numeric_limits<unsigned int>::max()};
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
200};
201
202// For backwards compatibility
203
205
206CLASS_DEF(TgcIdHelper, 4173, 1)
207
208// Construct ID from components
209
210#endif // MUONIDHELPERS_TGCIDHELPER_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
TgcIdHelper TGC_ID
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 channelMin()
static constexpr unsigned int s_stDim
T1F-> 41 ; T1E->42 , T2F -> 43, T2E->44, T3F->45, T3E->46, T4E->48.
Identifier elementID(int stationName, int stationEta, int stationPhi) const
virtual ~TgcIdHelper()=default
bool tripletChamber(int stationName) const
static int stationEtaMin()
int tgcTechnology() const
Utility methods.
Identifier parentID(const Identifier &id) const
static int channelMax()
IdDictFieldImplementation m_ist_impl
int channel(const Identifier &id) const override
unsigned int m_stationShift
Minimal station index found.
static int gasGapMax(bool triplet)
static int stationPhiMin(bool endcap)
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
int gasGap(const Identifier &id) const override
get the hashes
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
static constexpr unsigned int s_etaDim
Except T2E all stations have 4 associated eta stations.
static int isStripMax()
bool valid(const Identifier &id) const
size_type m_GASGAP_INDEX
IdDictFieldImplementation m_cha_impl
bool measuresPhi(const Identifier &id) const override
IdDictFieldImplementation m_gap_impl
bool endcapChamber(int stationName) const
static int stationPhiMax(bool endcap)
size_type m_ISSTRIP_INDEX
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
std::array< unsigned int, s_modHashDim > m_module_hashes
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
static int isStripMin()
unsigned int moduleHashIdx(const Identifier &id) const
static int chamberType(const std::string &stationName, int stationEta)
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
static constexpr unsigned int s_phiDim
48 phi stations
static constexpr unsigned int s_modHashDim
static int stationEtaMax()
static int gasGapMin()
int init_id_to_hashes()
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
bool validElement(const Identifier &id) const
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...