ATLAS Offline Software
Loading...
Searching...
No Matches
CscIdHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ******************************************************************************
6// ATLAS Muon Identifier Helpers Package
7// ******************************************************************************
8
9#ifndef MUONIDHELPERS_CSCIDHELPER_H
10#define MUONIDHELPERS_CSCIDHELPER_H
11
13
14// ******************************************************************************
15// class CscIdHelper
16// ******************************************************************************
17//
18// Description
19// -----------
20// This factory class constructs CSC identifiers and ranges and provides access
21// to the levels. ATLAS note ATL-MUON-2001-014 provides a complete description
22// of the hierarchical identifier scheme. CscIdHelper provides an interface to the
23// following fields of the identifier.
24//
25// Field Range Notes
26// ==============================================================================
27// StationName unsigned integer maps to "CSS", "CSL", etc.
28// StationEta [-1,1] -1 for backward, 1 for forward endcap
29// StationPhi [1,8] increases with Phi
30// Technology [1] maps to "CSC"
31// ChamberLayer [1,2] increases with |Z|
32// WireLayer [1,4] increases with |Z|
33// MeasuresPhi [0,1] 0 if measures R, 1 if measures Phi
34// Strip [1,n] increases with R for MeasuresPhi=0
35// increases with Phi for MeasuresPhi=1
36// ==============================================================================
37//
38// Inheritance
39// -----------
40// Inherits from MuonIdHelpers/MuonIdHelper.
41//
42// Author
43// ------
44// Steven Goldfarb <Steven.Goldfarb@cern.ch>
45//
46// Compact Id implementation by
47// Ketevi A. Assamagan <ketevi@bnl.gov>
48// BNL, February 27th, 2003
49//
50// ******************************************************************************
51
52class CscIdHelper : public MuonIdHelper {
53public:
54 // Constructor
55
57
58 // Destructor
59
60 virtual ~CscIdHelper() = default;
61
63
65 int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
66
67 // need to overwrite get_module_hash and get_detectorElement_hash for Run2 geometries (since they contain both
68 // CSC chamberLayer 1 and 2 although only chamberLayer 2 is actually built into ATLAS)
69 // function checks whether chamberLayer 1 identifiers are around and in this case returns the correct module hash
70 int get_module_hash(const Identifier& id, IdentifierHash& hash_id) const override;
71 int get_detectorElement_hash(const Identifier& id, IdentifierHash& hash_id) const override;
72
74
75 // Identifier builders
77 Identifier elementID(int stationName, int stationEta, int stationPhi, bool& isValid) const;
78
79 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const;
80 Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const;
81
83
85 int strip) const;
87 bool& isValid) const;
88
89 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int chamberLayer, int wireLayer,
90 int measuresPhi, int strip) const;
91 Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int chamberLayer, int wireLayer,
92 int measuresPhi, int strip, bool& isValid) const;
93
94 Identifier channelID(const Identifier& id, int chamberLayer, int wireLayer, int measurePhi, int strip) const;
95 Identifier channelID(const Identifier& id, int chamberLayer, int wireLayer, int measurePhi, int strip, bool& isValid) const;
96
97 Identifier parentID(const Identifier& id) const;
98
99 // for an Identifier id, get the list of the daughter readout channel ids
100 void idChannels(const Identifier& id, std::vector<Identifier>& vect) const;
101
102 // Access to levels: missing field returns 0
103
104 int channel(const Identifier& id) const override;
105
106 int chamberLayer(const Identifier& id) const;
107 int wireLayer(const Identifier& id) const;
108 bool measuresPhi(const Identifier& id) const override;
109 int strip(const Identifier& id) const;
110 int gasGap(const Identifier& id) const override; // Returns chamber Layer here
111
112 int sector(const Identifier& id) const;
113 // Access to min and max of level ranges
114 // to be remove when we moved to compact ids
115
116 static int stationEtaMin() ;
117 static int stationEtaMax() ;
118 static int stationPhiMin() ;
119 static int stationPhiMax() ;
120 static int chamberLayerMin() ;
121 static int chamberLayerMax() ;
122 static int wireLayerMin() ;
123 static int wireLayerMax() ;
124 static int measuresPhiMin() ;
125 static int measuresPhiMax() ;
126 static int stripMin() ;
127 static int stripMax() ;
128
129 // Access to min and max of level ranges
130
131 int stationEtaMin(const Identifier& id) const;
132 int stationEtaMax(const Identifier& id) const;
133 int stationPhiMin(const Identifier& id) const;
134 int stationPhiMax(const Identifier& id) const;
135 int chamberLayerMin(const Identifier& id) const;
136 int chamberLayerMax(const Identifier& id) const;
137 int wireLayerMin(const Identifier& id) const;
138 int wireLayerMax(const Identifier& id) const;
139 int measuresPhiMin(const Identifier& id) const;
140 int measuresPhiMax(const Identifier& id) const;
141 int stripMin(const Identifier& id) const;
142 int stripMax(const Identifier& id) const;
143
144 // Public validation of levels
145
146 bool valid(const Identifier& id) const;
147 bool validElement(const Identifier& id) const;
148
149private:
150 bool isStNameInTech(const std::string& stationName) const override;
151 int init_id_to_hashes();
152
153 // CSS / CSL
154 static constexpr unsigned int s_stDim = 2;
155 // -1, 1 eta dimension
156 static constexpr unsigned int s_etaDim = 2;
158 static constexpr unsigned int s_phiDim = 8;
160 static constexpr unsigned int s_mlDim = 2;
161
162 static constexpr unsigned int s_modHashDim = s_stDim * s_etaDim * s_phiDim;
163 static constexpr unsigned int s_detHashDim = s_modHashDim * s_mlDim;
164
165 std::array<unsigned int, s_modHashDim> m_module_hashes{};
166 std::array<unsigned int, s_detHashDim> m_detectorElement_hashes{};
167
168 unsigned int moduleHashIdx(const Identifier& id) const;
169 unsigned int detEleHashIdx(const Identifier& id) const;
171 unsigned int m_stationShift{std::numeric_limits<unsigned int>::max()};
172
173
174 // compact id indices
178
183
184 // Private validation of levels
185
186 bool validElement(const Identifier& id, int stationName, int stationEta, int stationPhi) const;
187 bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer,
188 int measuresPhi, int strip) const;
189
190 // Utility methods
191
192 int cscTechnology() const;
193
194 // hash offset of strips */
195 int strip_hash_offsets();
196
197 // Level indices
198
200
201 // Level ranges
202
217 int m_hashOffset[2][2]{};
218
219 unsigned int m_stripMaxPhi{UINT_MAX}; // maximum number of strips for layer which measuresPhi
220 unsigned int m_stripMaxEta{UINT_MAX}; // maximum number of strips for layer which does not measure phi
221 bool m_hasChamLay1{false};
222};
223
224// For backwards compatibility
225
227
228CLASS_DEF(CscIdHelper, 4171, 1)
229
230#endif // MUONIDHELPERS_CSCIDHELPER_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
CscIdHelper CSC_ID
unsigned int m_stripMaxPhi
int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
static int wireLayerMax()
static constexpr unsigned int s_modHashDim
static int stationEtaMax()
size_type m_CHAMBERLAYER_INDEX
static int measuresPhiMin()
int sector(const Identifier &id) const
Identifier parentID(const Identifier &id) const
get parent id from channel id
static int stripMax()
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Identifier elementID(int stationName, int stationEta, int stationPhi) const
int wireLayer(const Identifier &id) const
static int stationPhiMax()
unsigned int moduleHashIdx(const Identifier &id) const
static int stationEtaMin()
Access to min and max of level ranges.
bool m_hasChamLay1
IdDictFieldImplementation m_cla_impl
IdDictFieldImplementation m_mea_impl
int chamberLayer(const Identifier &id) const
static constexpr unsigned int s_detHashDim
void idChannels(const Identifier &id, std::vector< Identifier > &vect) 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 ...
static constexpr unsigned int s_stDim
IdDictFieldImplementation m_lay_impl
int gasGap(const Identifier &id) const override
get the hashes
int strip(const Identifier &id) const
unsigned int m_stripMaxEta
static constexpr unsigned int s_mlDim
2 multi layer
size_type m_MEASURESPHI_INDEX
int strip_hash_offsets()
static constexpr unsigned int s_etaDim
static int chamberLayerMin()
IdDictFieldImplementation m_str_impl
size_type m_WIRELAYER_INDEX
bool valid(const Identifier &id) const
Public validation of levels.
int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
unsigned int detEleHashIdx(const Identifier &id) const
bool measuresPhi(const Identifier &id) const override
static int measuresPhiMax()
static int stripMin()
virtual ~CscIdHelper()=default
static constexpr unsigned int s_phiDim
8 phi stations
std::array< unsigned int, s_modHashDim > m_module_hashes
bool validElement(const Identifier &id) const
int init_id_to_hashes()
unsigned int m_stationShift
Minimal station index found.
static int stationPhiMin()
std::array< unsigned int, s_detHashDim > m_detectorElement_hashes
int cscTechnology() const
Utility methods.
int channel(const Identifier &id) const override
static int chamberLayerMax()
int m_hashOffset[2][2]
int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
static int wireLayerMin()
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)