ATLAS Offline Software
ZdcID.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 #ifndef ZdcID_H
6 #define ZdcID_H
7 
9 #include "Identifier/Identifier.h"
11 #include "Identifier/MultiRange.h"
12 #include "Identifier/IdHelper.h"
14 #include "AthenaKernel/CLASS_DEF.h"
15 
16 #include <algorithm>
17 #include <vector>
18 
19 class IdDictDictionary;
20 
23 
24 class ZdcID : public AtlasDetectorID
25 {
26 public:
27 
28 
30  typedef std::vector<Identifier>::const_iterator const_id_iterator;
32 
33  ZdcID();
34  ~ZdcID();
35 
37 
40 
43 
45  int side (const Identifier& id) const;
46  int module (const Identifier& id) const;
47  int type (const Identifier& id) const;
48  int channel (const Identifier& id) const;
50 
52 
56 
58 
62 
67 
68 
70 
72  int module) const;
73 
75  int module,
76  int type,
77  int channel) const;
82 
83 
85 
86  virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr);
88 
90  void test_packing () const;
92 
93 private:
94 
95  typedef std::vector<Identifier> id_vec;
96  typedef id_vec::const_iterator id_vec_it;
97  typedef std::vector<unsigned short> hash_vec;
98  typedef hash_vec::const_iterator hash_vec_it;
99 
100  int initLevelsFromDict();
101 
102  int init_hashes();
103 
118 
125 
126 };
127 
128 CLASS_DEF(ZdcID, 190591643, 1)
129 
130 // inline definitions
131 
132 inline
134 ZdcID::module_hash (Identifier module_id) const
135 {
136  // module hash is composed of side and module
137  static const unsigned int nmodule = m_module_impl.field().get_maximum() + 1;
138  return (nmodule*m_side_impl.unpackToIndex(module_id) + module(module_id));
139 }
140 
141 inline
144 {
145  // module hash is composed of side, module, type and channel
146  static const unsigned int nmodule = m_module_impl.field().get_maximum() + 1;
147  static const unsigned int ntype = m_type_impl.field().get_maximum() + 1;
148  static const unsigned int nchannel = m_channel_impl.field().get_maximum() + 1;
149  return ((nmodule*ntype*nchannel)*m_side_impl.unpackToIndex(channel_id)
150  + (ntype*nchannel)*module(channel_id)
151  + nchannel*type(channel_id)
152  + channel(channel_id));
153 }
154 
155 
156 inline
157 int ZdcID::side(const Identifier& id) const
158 {
159  return (m_side_impl.unpack(id));
160 }
161 
162 inline
163 int ZdcID::module(const Identifier& id) const
164 {
165  return (m_module_impl.unpack(id));
166 }
167 
168 inline
169 int ZdcID::type(const Identifier& id) const
170 {
171  return (m_type_impl.unpack(id));
172 }
173 
174 inline
175 int ZdcID::channel(const Identifier& id) const
176 {
177  return (m_channel_impl.unpack(id));
178 }
179 
180 inline
181 Identifier
183  int module) const
184 {
185  // Build identifier
186  Identifier result(0);
187 
188  // Pack fields independently
193  return result;
194 }
195 
196 inline
198 ZdcID::module_id ( IdentifierHash module_hash ) const
199 {
200  return (m_module_vec[module_hash]);
201 }
202 
203 inline
204 Identifier
206  int module,
207  int type,
208  int channel) const
209 {
210  // Build identifier
211  Identifier result(0);
212 
213  // Pack fields independently
220  return result;
221 }
222 
223 inline
225 ZdcID::channel_id ( IdentifierHash channel_hash ) const
226 {
227  return (m_channel_vec[channel_hash]);
228 }
229 
230 #endif
ZdcID::hash_vec
std::vector< unsigned short > hash_vec
Definition: ZdcID.h:97
ZdcID::m_channel_vec
id_vec m_channel_vec
Definition: ZdcID.h:117
PIXEL
@ PIXEL
Definition: ZdcID.h:22
HOUSING
@ HOUSING
Definition: ZdcID.h:22
get_generator_info.result
result
Definition: get_generator_info.py:21
ZdcID::m_dict
const IdDictDictionary * m_dict
Definition: ZdcID.h:111
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
ZdcID::m_ZDC_INDEX
size_type m_ZDC_INDEX
Definition: ZdcID.h:106
ZdcID::module_hash
IdentifierHash module_hash(Identifier module_id) const
module hash from id - optimized
Definition: ZdcID.h:134
ZdcID::module
int module(const Identifier &id) const
Definition: ZdcID.h:163
ZdcID::module_id
Identifier module_id(int side, int module) const
Definition: ZdcID.h:182
ZdcID::m_SIDE_INDEX
size_type m_SIDE_INDEX
Definition: ZdcID.h:107
AtlasDetectorID::forward_field_value
int forward_field_value() const
Definition: AtlasDetectorID.h:666
ZdcID::m_FORWARD_INDEX
size_type m_FORWARD_INDEX
Definition: ZdcID.h:105
ZdcIDVolChannel
ZdcIDVolChannel
Definition: ZdcID.h:22
ZdcID::~ZdcID
~ZdcID()
Definition: ZdcID.cxx:22
IdDictFieldImplementation::pack
void pack(int value, Identifier &id) const
Definition: IdDictFieldImplementation.h:173
IdentifierField::get_maximum
element_type get_maximum() const
Definition: IdentifierField.h:130
IdHelper.h
ZdcID::init_hashes
int init_hashes()
Definition: ZdcID.cxx:247
AIR
@ AIR
Definition: ZdcID.h:22
ZdcID::m_full_module_range
MultiRange m_full_module_range
Definition: ZdcID.h:112
ZdcID::channels_end
const_id_iterator channels_end() const
Definition: ZdcID.cxx:453
IdDictFieldImplementation::unpack
int unpack(Identifier id) const
Identifier manipulation methods.
Definition: IdDictFieldImplementation.h:147
READOUT
@ READOUT
Definition: ZdcID.h:22
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ZdcID::m_type_impl
IdDictFieldImplementation m_type_impl
Definition: ZdcID.h:123
ZdcID::m_channel_hash_max
size_type m_channel_hash_max
Definition: ZdcID.h:115
ZdcID::channel_id
Identifier channel_id(int side, int module, int type, int channel) const
Definition: ZdcID.h:205
TRT::Hit::side
@ side
Definition: HitInfo.h:83
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:385
ZdcID::m_zdc_region_index
size_type m_zdc_region_index
Definition: ZdcID.h:104
python.PyAthena.module
module
Definition: PyAthena.py:131
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdDictMgr
Definition: IdDictMgr.h:14
IdDictFieldImplementation::unpackToIndex
size_type unpackToIndex(Identifier id) const
Unpack a single field index of the id.
Definition: IdDictFieldImplementation.h:164
IdDictFieldImplementation::field
const Range::field & field() const
Definition: IdDictFieldImplementation.h:191
ZdcID::modules_begin
const_id_iterator modules_begin() const
Iterators over full set of ids. modules iterator is sorted.
Definition: ZdcID.cxx:438
ZdcID::id_vec_it
id_vec::const_iterator id_vec_it
Definition: ZdcID.h:96
MultiRange::const_identifier_factory
Definition: MultiRange.h:52
createCoolChannelIdFile.channel_id
channel_id
Definition: createCoolChannelIdFile.py:51
ZdcID::m_module_impl
IdDictFieldImplementation m_module_impl
Definition: ZdcID.h:122
ZdcID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: ZdcID.h:30
ZdcID::m_full_channel_range
MultiRange m_full_channel_range
Definition: ZdcID.h:113
ZdcID::test_packing
void test_packing() const
Tests of packing.
Definition: ZdcID.cxx:341
ZdcID::m_MODULE_INDEX
size_type m_MODULE_INDEX
Definition: ZdcID.h:108
TANAIR
@ TANAIR
Definition: ZdcID.h:22
ZdcID::channels_begin
const_id_iterator channels_begin() const
Iterators over full set of ids. channels iterator is sorted.
Definition: ZdcID.cxx:448
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
IdentifierHash.h
TUNGSTEN
@ TUNGSTEN
Definition: ZdcID.h:22
ZdcID::module_hash_max
size_type module_hash_max() const
ZdcID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
Definition: ZdcID.cxx:27
MultiRange.h
IdDictDictionary
Definition: IdDictDictionary.h:30
IdDictFieldImplementation.h
ZdcID::m_forward_impl
IdDictFieldImplementation m_forward_impl
Definition: ZdcID.h:119
MULTICHANNEL
@ MULTICHANNEL
Definition: ZdcID.h:21
ZdcID::size_type
Identifier::size_type size_type
Definition: ZdcID.h:29
SINGLECHANNEL
@ SINGLECHANNEL
Definition: ZdcID.h:21
ZdcID::m_side_impl
IdDictFieldImplementation m_side_impl
Definition: ZdcID.h:121
ZdcID::id_vec
std::vector< Identifier > id_vec
Definition: ZdcID.h:95
ZdcID::m_CHANNEL_INDEX
size_type m_CHANNEL_INDEX
Definition: ZdcID.h:110
ZdcID::modules_end
const_id_iterator modules_end() const
Definition: ZdcID.cxx:443
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:67
ZdcID::side
int side(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: ZdcID.h:157
ZdcID::type
int type(const Identifier &id) const
Definition: ZdcID.h:169
ZdcID::ZdcID
ZdcID()
Definition: ZdcID.cxx:16
ZdcIDType
ZdcIDType
Definition: ZdcID.h:21
ZdcID::initLevelsFromDict
int initLevelsFromDict()
Definition: ZdcID.cxx:132
ACTIVE
@ ACTIVE
Definition: ZdcID.h:21
ZdcID::channel_hash
IdentifierHash channel_hash(Identifier channel_id) const
channel hash from id - optimized
Definition: ZdcID.h:143
ZdcID::hash_vec_it
hash_vec::const_iterator hash_vec_it
Definition: ZdcID.h:98
AtlasDetectorID::zdc_field_value
int zdc_field_value() const
Definition: AtlasDetectorID.h:674
Identifier::size_type
unsigned long long size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:29
ZdcID::m_zdc_impl
IdDictFieldImplementation m_zdc_impl
Definition: ZdcID.h:120
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
ZdcID::m_channel_impl
IdDictFieldImplementation m_channel_impl
Definition: ZdcID.h:124
INACTIVE
@ INACTIVE
Definition: ZdcID.h:21
ZdcID
Definition: ZdcID.h:25
CLASS_DEF.h
macros to associate a CLID to a type
ZdcID::m_module_vec
id_vec m_module_vec
Definition: ZdcID.h:116
ZdcID::const_expanded_id_iterator
MultiRange::const_identifier_factory const_expanded_id_iterator
Definition: ZdcID.h:31
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:52
ZdcID::m_module_hash_max
size_type m_module_hash_max
Definition: ZdcID.h:114
ZdcID::channel
int channel(const Identifier &id) const
Definition: ZdcID.h:175
ZdcID::channel_hash_max
size_type channel_hash_max() const
ZdcID::m_TYPE_INDEX
size_type m_TYPE_INDEX
Definition: ZdcID.h:109
Identifier
Definition: IdentifierFieldParser.cxx:14