ATLAS Offline Software
Loading...
Searching...
No Matches
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"
12#include "Identifier/IdHelper.h"
15
16#include <algorithm>
17#include <vector>
18
20
23
24class ZdcID : public AtlasDetectorID
25{
26public:
27
28
29 typedef Identifier::size_type size_type;
30 typedef std::vector<Identifier>::const_iterator const_id_iterator;
32
33 ZdcID();
34 ~ZdcID();
35
37
38
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
59
62
67
68
70
72 int module) const;
73
75 int module,
76 int type,
77 int channel) const;
82
83
85
86
87 virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr);
88
90 void test_packing () const;
92
93private:
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
128CLASS_DEF(ZdcID, 190591643, 1)
129
130// inline definitions
131
132inline
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
141inline
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)
153}
154
155
156inline
157int ZdcID::side(const Identifier& id) const
158{
159 return (m_side_impl.unpack(id));
160}
161
162inline
163int ZdcID::module(const Identifier& id) const
164{
165 return (m_module_impl.unpack(id));
166}
167
168inline
169int ZdcID::type(const Identifier& id) const
170{
171 return (m_type_impl.unpack(id));
172}
173
174inline
175int ZdcID::channel(const Identifier& id) const
176{
177 return (m_channel_impl.unpack(id));
178}
179
180inline
183 int module) const
184{
185 // Build identifier
187
188 // Pack fields independently
191 m_side_impl.pack (side, result);
192 m_module_impl.pack (module, result);
193 return result;
194}
195
196inline
202
203inline
206 int module,
207 int type,
208 int channel) const
209{
210 // Build identifier
212
213 // Pack fields independently
216 m_side_impl.pack (side, result);
217 m_module_impl.pack (module, result);
218 m_type_impl.pack (type, result);
220 return result;
221}
222
223inline
229
230#endif
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
@ PIXEL
Definition RegSelEnums.h:24
ZdcIDType
Definition ZdcID.h:21
@ SINGLECHANNEL
Definition ZdcID.h:21
@ ACTIVE
Definition ZdcID.h:21
@ INACTIVE
Definition ZdcID.h:21
@ MULTICHANNEL
Definition ZdcID.h:21
ZdcIDVolChannel
Definition ZdcID.h:22
@ AIR
Definition ZdcID.h:22
@ HOUSING
Definition ZdcID.h:22
@ TANAIR
Definition ZdcID.h:22
@ TUNGSTEN
Definition ZdcID.h:22
@ READOUT
Definition ZdcID.h:22
int forward_field_value() const
int zdc_field_value() const
AtlasDetectorID(const std::string &name, const std::string &group)
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
int unpack(Identifier id) const
Identifier manipulation methods.
This is a "hash" representation of an Identifier.
A MultiRange combines several Ranges.
Definition MultiRange.h:17
Definition ZdcID.h:25
Identifier::size_type size_type
Definition ZdcID.h:29
IdDictFieldImplementation m_forward_impl
Definition ZdcID.h:119
id_vec m_module_vec
Definition ZdcID.h:116
~ZdcID()
Definition ZdcID.cxx:22
Identifier module_id(int side, int module) const
Definition ZdcID.h:182
ZdcID()
Definition ZdcID.cxx:16
MultiRange m_full_channel_range
Definition ZdcID.h:113
IdentifierHash module_hash(Identifier module_id) const
module hash from id - optimized
Definition ZdcID.h:134
size_type m_FORWARD_INDEX
Definition ZdcID.h:105
IdDictFieldImplementation m_zdc_impl
Definition ZdcID.h:120
size_type m_channel_hash_max
Definition ZdcID.h:115
int side(const Identifier &id) const
Values of different levels (failure returns 0)
Definition ZdcID.h:157
const_id_iterator modules_end() const
Definition ZdcID.cxx:365
id_vec::const_iterator id_vec_it
Definition ZdcID.h:96
size_type m_SIDE_INDEX
Definition ZdcID.h:107
size_type m_module_hash_max
Definition ZdcID.h:114
size_type m_zdc_region_index
Definition ZdcID.h:104
std::vector< Identifier >::const_iterator const_id_iterator
Definition ZdcID.h:30
const IdDictDictionary * m_dict
Definition ZdcID.h:111
void test_packing() const
Tests of packing.
Definition ZdcID.cxx:293
MultiRange::const_identifier_factory const_expanded_id_iterator
Definition ZdcID.h:31
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
Definition ZdcID.cxx:27
std::vector< unsigned short > hash_vec
Definition ZdcID.h:97
MultiRange m_full_module_range
Definition ZdcID.h:112
size_type m_ZDC_INDEX
Definition ZdcID.h:106
const_id_iterator modules_begin() const
Iterators over full set of ids. modules iterator is sorted.
Definition ZdcID.cxx:360
const_id_iterator channels_begin() const
Iterators over full set of ids. channels iterator is sorted.
Definition ZdcID.cxx:370
int type(const Identifier &id) const
Definition ZdcID.h:169
IdDictFieldImplementation m_side_impl
Definition ZdcID.h:121
id_vec m_channel_vec
Definition ZdcID.h:117
const_id_iterator channels_end() const
Definition ZdcID.cxx:375
Identifier channel_id(int side, int module, int type, int channel) const
Definition ZdcID.h:205
int channel(const Identifier &id) const
Definition ZdcID.h:175
size_type m_MODULE_INDEX
Definition ZdcID.h:108
int initLevelsFromDict()
Definition ZdcID.cxx:101
IdDictFieldImplementation m_type_impl
Definition ZdcID.h:123
IdDictFieldImplementation m_module_impl
Definition ZdcID.h:122
int init_hashes()
Definition ZdcID.cxx:203
size_type channel_hash_max() const
size_type module_hash_max() const
IdDictFieldImplementation m_channel_impl
Definition ZdcID.h:124
hash_vec::const_iterator hash_vec_it
Definition ZdcID.h:98
size_type m_CHANNEL_INDEX
Definition ZdcID.h:110
IdentifierHash channel_hash(Identifier channel_id) const
channel hash from id - optimized
Definition ZdcID.h:143
size_type m_TYPE_INDEX
Definition ZdcID.h:109
std::vector< Identifier > id_vec
Definition ZdcID.h:95