ATLAS Offline Software
Loading...
Searching...
No Matches
Tile_Base_ID.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
11
12#ifndef CALOIDENTIFIER_TILE_BASE_ID_H
13#define CALOIDENTIFIER_TILE_BASE_ID_H
14
16// #include "Identifier/IdentifierHash.h"
21
23
24#include <string>
25#include <vector>
26#include <set>
27#include <ranges>
28
29class IdentifierHash;
30
31
36class Tile_Base_ID : public CaloIDHelper {
37
38 friend class TileNeighbour;
39
40public:
41
43 Tile_Base_ID (const std::string& name,
44 const std::string& group,
45 bool supercell);
46
47 enum SECTION { ONLINE = 0, BARREL = 1, EXTBAR = 2, GAPDET = 3, AUXDET = 4 ,
48 SBARREL = 5, SEXTBAR = 6,
51 };
52 enum SAMPLE { SAMP_A = 0,
53 SAMP_B = 1, SAMP_BC = 1, SAMP_C = 1, // synonyms
54 SAMP_D = 2, SAMP_E = 3, SAMP_X = 4 };
55 enum SIDE { NEGATIVE = -1, POSITIVE = 1, TWOSIDES = 0 };
56 enum GAIN { LOWGAIN = 0, HIGHGAIN = 1 };
57 enum SIZE { NSIDES = 2, NSECTIONS = 3, NREGIONS = NSIDES * NSECTIONS };
58
60 Identifier tile_system () const;
61
63 Identifier tile_barrel () const;
64
67
69 Identifier tile_gap () const;
70
72 Identifier tile_det ( int section) const;
73 Identifier tile_det ( int section, bool checks) const;
74
76 Identifier region_id ( int index) const;
77 Identifier region_id ( int section, int side) const;
78 Identifier region_id ( int section, int side, bool checks) const;
79 Identifier region_id ( const Identifier& any_id) const;
80
82 int module) const;
84 int module, bool checks) const;
85 Identifier module_id ( const Identifier& any_id) const;
87 int module, int tower) const;
89 int module, int tower,
90 bool checks) const;
91 Identifier tower_id ( const Identifier& any_id) const;
92 Identifier cell_id ( const Identifier & any_id ) const;
93 Identifier cell_id ( int section, int side,
94 int module, int tower,
95 int sample ) const;
96 Identifier cell_id ( int section, int side,
97 int module, int tower,
98 int sample, bool checks ) const;
99 Identifier pmt_id ( const Identifier & any_id ) const;
101 int pmt ) const;
103 int pmt, bool checks ) const;
104 Identifier pmt_id ( int section, int side,
105 int module, int tower,
106 int sample, int pmt ) const;
107 Identifier pmt_id ( int section, int side,
108 int module, int tower,
109 int sample, int pmt,
110 bool checks) const;
112 int pmt, int adc ) const;
114 int pmt, int adc,
115 bool checks ) const;
117 int adc ) const;
119 int adc, bool checks ) const;
120 Identifier adc_id ( int section, int side,
121 int module, int tower,
122 int sample, int pmt,
123 int adc ) const;
124 Identifier adc_id ( int section, int side,
125 int module, int tower,
126 int sample, int pmt,
127 int adc, bool checks ) const;
128
130 Identifier cell_id (const IdentifierHash& hash_id) const;
133
135// bool is_tile (const Identifier& id) const;
136 bool is_tile_barrel (const Identifier& id) const;
137 bool is_tile_extbarrel (const Identifier& id) const;
138 bool is_tile_gap (const Identifier& id) const;
139 bool is_tile_gapscin (const Identifier& id) const;
140 bool is_tile_aux (const Identifier& id) const;
141
142 bool is_negative (const Identifier& id) const;
143 bool is_positive (const Identifier& id) const;
144 bool is_twosides (const Identifier& id) const;
145
146 bool is_low_gain (const Identifier& id) const;
147 bool is_high_gain (const Identifier& id) const;
148
149 bool is_supercell (const Identifier& id) const;
150
151 int region ( int section, int side ) const;
152 int region ( const Identifier & id ) const;
153 int system ( const Identifier & id ) const;
154 int section ( const Identifier & id ) const;
155 int side ( const Identifier & id ) const;
156 int module ( const Identifier & id ) const;
157 int tower ( const Identifier & id ) const;
158 int sample ( const Identifier & id ) const;
159 int pmt ( const Identifier & id ) const;
160 int adc ( const Identifier & id ) const;
161
162 // fast way to get Tile sampling (be careful - doesn't work for MBTS)
163 int sampling ( const Identifier & id ) const { return m_sample_impl.unpack(id); }
164
165 std::string to_string (const Identifier & id, int level=0) const;
166 std::string to_string (const IdentifierHash & hash_id, int level=0) const;
167
168
171 IdContext region_context () const;
172
174 IdContext module_context () const;
175
177 IdContext tower_context () const;
178
180 IdContext cell_context () const;
181
183 IdContext pmt_context () const;
184
186 IdContext adc_context () const;
187
188
190 virtual int get_id (const IdentifierHash& hash_id, Identifier& id, const IdContext* context = 0 ) const;
191
193 virtual int get_hash (const Identifier& id, IdentifierHash& hash_id, const IdContext* context = 0 ) const;
194
196 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
197 const std::string& group_name);
198
200 size_type region_hash_max () const;
201 size_type module_hash_max () const;
202 size_type tower_hash_max () const;
203 size_type cell_hash_max () const;
204 size_type pmt_hash_max () const;
205 size_type adc_hash_max () const;
206
208 using id_iterator = std::vector<Identifier>::const_iterator;
210 using id_range = std::ranges::subrange<id_iterator>;
211
213 id_iterator reg_begin () const;
214 id_iterator reg_end () const;
215 id_range reg_range () const;
216
218 id_iterator region_begin () const { return reg_begin(); }
219 id_iterator region_end () const { return reg_end(); }
220 id_range region_range () const { return reg_range(); }
221
223 id_iterator module_begin () const;
224 id_iterator module_end () const;
225 id_range module_range () const;
226
228 id_iterator tower_begin () const;
229 id_iterator tower_end () const;
230 id_range tower_range () const;
231
233 id_iterator cell_begin () const;
234 id_iterator cell_end () const;
235 id_range cell_range () const;
236
238 id_iterator pmt_begin () const;
239 id_iterator pmt_end () const;
240 id_range pmt_range () const;
241
243 id_iterator adc_begin () const;
244 id_iterator adc_end () const;
245 id_range adc_range () const;
246
248 const std::vector<Identifier>& region_ids() const;
249 const std::vector<Identifier>& module_ids() const;
250 const std::vector<Identifier>& tower_ids() const;
251 const std::vector<Identifier>& cell_ids() const;
252 const std::vector<Identifier>& pmt_ids() const;
253 const std::vector<Identifier>& adc_ids() const;
254
255
257 int eta_min(const Identifier& id) const;
258 int eta_max(const Identifier& id) const;
259 int region_eta_min(const Identifier& id) const;
260 int region_eta_max(const Identifier& id) const;
261 int phi_max(const Identifier& id) const;
262
263 enum {NOT_VALID_HASH = 64000};
264
266 bool module_id (const Identifier& region_id,
267 int module,
268 Identifier& module_id ) const;
269 bool tower_id (const Identifier& region_id,
270 int module, int tower,
271 Identifier& tower_id ) const;
272 bool cell_id (const Identifier& region_id,
273 int module, int tower, int sample,
274 Identifier& cell_id ) const;
275 bool pmt_id (const Identifier& cell_id,
276 int pmt,
277 Identifier& pmt_id ) const;
278 bool adc_id (const Identifier& pmt_id,
279 int adc,
280 Identifier& adc_id ) const;
281 bool adc_id (const Identifier& cell_id,
282 int pmt, int adc,
283 Identifier& adc_id ) const;
284
286 Identifier region_id (const ExpandedIdentifier& exp_id) const;
287 Identifier module_id (const ExpandedIdentifier& exp_id) const;
288 Identifier tower_id (const ExpandedIdentifier& exp_id) const;
289 Identifier cell_id (const ExpandedIdentifier& exp_id) const;
290 Identifier pmt_id (const ExpandedIdentifier& exp_id) const;
291 Identifier adc_id (const ExpandedIdentifier& exp_id) const;
292
293
306 int get_neighbours(const IdentifierHash& id,
307 const LArNeighbours::neighbourOption& option,
308 std::vector<IdentifierHash>& neighbourList) const;
309
310
311private:
312
313 int decode_section (int section) const
314 {
315 return section >= SBARREL ? (section & SECTION_MASK) : section;
316 }
317
318 int encode_section (int section) const
319 {
321 }
322
324 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
325
327 int get_field ( const Identifier & id,
328 size_type index ) const;
329
330 int initLevelsFromDict (const std::string& group_name);
331
332 int init_hashes();
333
334 int eta_min(const Identifier& id, const IdContext& context) const;
335 int eta_max(const Identifier& id, const IdContext& context) const;
336
337 unsigned m_supercell;
338
348
358
365
370
372};
373
374
375#endif // not CALOIDENTIFIER_TILE_BASE_ID_H
376
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Base class to factor out code common among Calo ID helpers.
macros to associate a CLID to a type
void section(const std::string &sec)
const std::string & group() const
Group name for this helper.
Manage a list of identifiers.
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier::size_type size_type
const std::string & name() const
Return the name for this helper.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
A MultiRange combines several Ranges.
Definition MultiRange.h:17
const std::vector< Identifier > & region_ids() const
provide access to id vectors, accessed via hash
id_iterator module_begin() const
iterator over set of module Identifiers
IdDictFieldImplementation m_side_impl
id_range tower_range() const
MultiRange m_full_tower_range
bool is_twosides(const Identifier &id) const
int sample(const Identifier &id) const
IdDictFieldImplementation m_adc_impl
Identifier tile_barrel() const
build identifier for Tile Barrel
id_iterator region_begin() const
iterator over set of region Identifiers (synonyms for naming consistency)
Tile_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
int decode_section(int section) const
int region_eta_max(const Identifier &id) const
id_iterator tower_begin() const
iterator over set of tower Identifiers
const std::vector< Identifier > & adc_ids() const
int tower(const Identifier &id) const
id_iterator module_end() const
size_type m_MODULE_INDEX
Identifier tile_system() const
build identifier for whole TileCal
CaloIDHelper::HashGroup m_modules
MultiRange m_full_adc_range
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
size_type module_hash_max() const
bool is_tile_aux(const Identifier &id) const
id_iterator pmt_begin() const
iterator over set of pmt Identifiers
int get_neighbours(const IdentifierHash &id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = prevInPhi,...
CaloIDHelper::HashGroup m_towers
size_type cell_hash_max() const
IdContext adc_context() const
id for ADCs
int adc(const Identifier &id) const
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
Identifier tower_id(int section, int side, int module, int tower) const
IdDictFieldImplementation m_tower_impl
id_iterator reg_end() const
IdContext cell_context() const
id for cells
IdDictFieldImplementation m_section_impl
IdContext pmt_context() const
id for PMTs
size_type m_PMT_INDEX
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
bool is_supercell(const Identifier &id) const
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
const std::vector< Identifier > & tower_ids() const
Identifier tile_det(int section) const
build identifier for any Tilecal section
size_type pmt_hash_max() const
const std::vector< Identifier > & pmt_ids() const
bool is_low_gain(const Identifier &id) const
IdentifierHash cell_hash(const Identifier &cell_id) const
fast conversion from ID to hash for cells
const std::vector< Identifier > & cell_ids() const
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
id_range module_range() const
IdContext module_context() const
id for modules
CaloIDHelper::HashGroup m_pmts
MultiRange m_full_module_range
bool is_tile_barrel(const Identifier &id) const
Test of an Identifier to see if it belongs to a particular part of the calorimeter.
int encode_section(int section) const
CaloIDHelper::HashGroup m_adcs
unsigned m_supercell
MultiRange m_full_pmt_range
std::string to_string(const Identifier &id, int level=0) const
IdDictFieldImplementation m_pmt_impl
IdDictFieldImplementation m_slar_impl
int eta_max(const Identifier &id) const
id_iterator cell_begin() const
iterator over set of cell Identifiers
id_range region_range() const
id_range pmt_range() const
int system(const Identifier &id) const
Identifier tile_extbarrel() const
build identifier for Tile Extended Barrel
const std::vector< Identifier > & module_ids() const
id_iterator reg_begin() const
iterator over set of region Identifiers
Identifier cell_id(const Identifier &any_id) const
TileNeighbour m_neighbour
int region_eta_min(const Identifier &id) const
Identifier adc_id(const Identifier &cell_id, int pmt, int adc) const
id_range reg_range() const
id_iterator adc_end() const
size_type m_SECTION_INDEX
id_iterator cell_end() const
size_type m_SAMPLE_INDEX
int side(const Identifier &id) const
size_type adc_hash_max() const
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
id_range cell_range() const
id_iterator adc_begin() const
iterator over set of adc Identifiers
size_type m_TOWER_INDEX
Identifier region_id(int index) const
build single region, module, tower, cell, pmt, adc identifiers
IdContext tower_context() const
id for towers
size_type m_tile_region_index
int initLevelsFromDict(const std::string &group_name)
int pmt(const Identifier &id) const
IdDictFieldImplementation m_module_impl
int section(const Identifier &id) const
int eta_min(const Identifier &id) const
max values (-999 == failure)
id_iterator pmt_end() const
bool is_tile_extbarrel(const Identifier &id) const
bool is_tile_gap(const Identifier &id) const
id_range adc_range() const
IdDictFieldImplementation m_sample_impl
size_type m_SYSTEM_INDEX
Identifier tile_gap() const
build identifier for Tile Gap detector (ITC + gap/crack scintillators)
int sampling(const Identifier &id) const
bool is_high_gain(const Identifier &id) const
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
IdDictFieldImplementation m_system_impl
Identifier pmt_id(const Identifier &any_id) const
int get_field(const Identifier &id, size_type index) const
unpack one field from Identifier
size_type m_SIDE_INDEX
size_type region_hash_max() const
hash tables max size
bool is_tile_gapscin(const Identifier &id) const
size_type m_ADC_INDEX
bool is_positive(const Identifier &id) const
id_iterator region_end() const
Identifier module_id(int section, int side, int module) const
int phi_max(const Identifier &id) const
bool is_negative(const Identifier &id) const
int region(int section, int side) const
MultiRange m_full_cell_range
friend class TileNeighbour
id_iterator tower_end() const
size_type tower_hash_max() const
MultiRange m_full_region_range
Definition index.py:1