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-2026 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
20
22
23#include <string>
24#include <vector>
25#include <set>
26#include <ranges>
27
28class IdentifierHash;
29
30
35class Tile_Base_ID : public CaloIDHelper {
36
37 friend class TileNeighbour;
38
39public:
40
42 Tile_Base_ID (const std::string& name,
43 const std::string& group,
44 bool supercell);
45
46 enum SECTION { ONLINE = 0, BARREL = 1, EXTBAR = 2, GAPDET = 3, AUXDET = 4 ,
47 SBARREL = 5, SEXTBAR = 6,
50 };
51 enum SAMPLE { SAMP_A = 0,
52 SAMP_B = 1, SAMP_BC = 1, SAMP_C = 1, // synonyms
53 SAMP_D = 2, SAMP_E = 3, SAMP_X = 4 };
54 enum SIDE { NEGATIVE = -1, POSITIVE = 1, TWOSIDES = 0 };
55 enum GAIN { LOWGAIN = 0, HIGHGAIN = 1 };
56 enum SIZE { NSIDES = 2, NSECTIONS = 3, NREGIONS = NSIDES * NSECTIONS };
57
59 Identifier tile_system () const;
60
62 Identifier tile_barrel () const;
63
66
68 Identifier tile_gap () const;
69
71 Identifier tile_det ( int section) const;
72 Identifier tile_det ( int section, bool checks) const;
73
75 Identifier region_id ( int index) const;
76 Identifier region_id ( int section, int side) const;
77 Identifier region_id ( int section, int side, bool checks) const;
78 Identifier region_id ( const Identifier& any_id) const;
79
81 int module) const;
83 int module, bool checks) const;
84 Identifier module_id ( const Identifier& any_id) const;
86 int module, int tower) const;
88 int module, int tower,
89 bool checks) const;
90 Identifier tower_id ( const Identifier& any_id) const;
91 Identifier cell_id ( const Identifier & any_id ) const;
92 Identifier cell_id ( int section, int side,
93 int module, int tower,
94 int sample ) const;
95 Identifier cell_id ( int section, int side,
96 int module, int tower,
97 int sample, bool checks ) const;
98 Identifier pmt_id ( const Identifier & any_id ) const;
100 int pmt ) const;
102 int pmt, bool checks ) const;
103 Identifier pmt_id ( int section, int side,
104 int module, int tower,
105 int sample, int pmt ) const;
106 Identifier pmt_id ( int section, int side,
107 int module, int tower,
108 int sample, int pmt,
109 bool checks) const;
111 int pmt, int adc ) const;
113 int pmt, int adc,
114 bool checks ) const;
116 int adc ) const;
118 int adc, bool checks ) const;
119 Identifier adc_id ( int section, int side,
120 int module, int tower,
121 int sample, int pmt,
122 int adc ) const;
123 Identifier adc_id ( int section, int side,
124 int module, int tower,
125 int sample, int pmt,
126 int adc, bool checks ) const;
127
129 Identifier cell_id (const IdentifierHash& hash_id) const;
132
134// bool is_tile (const Identifier& id) const;
135 bool is_tile_barrel (const Identifier& id) const;
136 bool is_tile_extbarrel (const Identifier& id) const;
137 bool is_tile_gap (const Identifier& id) const;
138 bool is_tile_gapscin (const Identifier& id) const;
139 bool is_tile_aux (const Identifier& id) const;
140
141 bool is_negative (const Identifier& id) const;
142 bool is_positive (const Identifier& id) const;
143 bool is_twosides (const Identifier& id) const;
144
145 bool is_low_gain (const Identifier& id) const;
146 bool is_high_gain (const Identifier& id) const;
147
148 bool is_supercell (const Identifier& id) const;
149
150 int region ( int section, int side ) const;
151 int region ( const Identifier & id ) const;
152 int system ( const Identifier & id ) const;
153 int section ( const Identifier & id ) const;
154 int side ( const Identifier & id ) const;
155 int module ( const Identifier & id ) const;
156 int tower ( const Identifier & id ) const;
157 int sample ( const Identifier & id ) const;
158 int pmt ( const Identifier & id ) const;
159 int adc ( const Identifier & id ) const;
160
161 // fast way to get Tile sampling (be careful - doesn't work for MBTS)
162 int sampling ( const Identifier & id ) const { return m_sample_impl.unpack(id); }
163
164 std::string to_string (const Identifier & id, int level=0) const;
165 std::string to_string (const IdentifierHash & hash_id, int level=0) const;
166
167
170 IdContext region_context () const;
171
173 IdContext module_context () const;
174
176 IdContext tower_context () const;
177
179 IdContext cell_context () const;
180
182 IdContext pmt_context () const;
183
185 IdContext adc_context () const;
186
187
189 virtual int get_id (const IdentifierHash& hash_id, Identifier& id, const IdContext* context = 0 ) const;
190
192 virtual int get_hash (const Identifier& id, IdentifierHash& hash_id, const IdContext* context = 0 ) const;
193
195 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
196 const std::string& group_name);
197
199 size_type region_hash_max () const;
200 size_type module_hash_max () const;
201 size_type tower_hash_max () const;
202 size_type cell_hash_max () const;
203 size_type pmt_hash_max () const;
204 size_type adc_hash_max () const;
205
207 using id_iterator = std::vector<Identifier>::const_iterator;
209 using id_range = std::ranges::subrange<id_iterator>;
210
212 id_iterator reg_begin () const;
213 id_iterator reg_end () const;
214 id_range reg_range () const;
215
217 id_iterator region_begin () const { return reg_begin(); }
218 id_iterator region_end () const { return reg_end(); }
219 id_range region_range () const { return reg_range(); }
220
222 id_iterator module_begin () const;
223 id_iterator module_end () const;
224 id_range module_range () const;
225
227 id_iterator tower_begin () const;
228 id_iterator tower_end () const;
229 id_range tower_range () const;
230
232 id_iterator cell_begin () const;
233 id_iterator cell_end () const;
234 id_range cell_range () const;
235
237 id_iterator pmt_begin () const;
238 id_iterator pmt_end () const;
239 id_range pmt_range () const;
240
242 id_iterator adc_begin () const;
243 id_iterator adc_end () const;
244 id_range adc_range () const;
245
247 const std::vector<Identifier>& region_ids() const;
248 const std::vector<Identifier>& module_ids() const;
249 const std::vector<Identifier>& tower_ids() const;
250 const std::vector<Identifier>& cell_ids() const;
251 const std::vector<Identifier>& pmt_ids() const;
252 const std::vector<Identifier>& adc_ids() const;
253
254
256 int eta_min(const Identifier& id) const;
257 int eta_max(const Identifier& id) const;
258 int region_eta_min(const Identifier& id) const;
259 int region_eta_max(const Identifier& id) const;
260 int phi_max(const Identifier& id) const;
261
262 enum {NOT_VALID_HASH = 64000};
263
265 bool module_id (const Identifier& region_id,
266 int module,
267 Identifier& module_id ) const;
268 bool tower_id (const Identifier& region_id,
269 int module, int tower,
270 Identifier& tower_id ) const;
271 bool cell_id (const Identifier& region_id,
272 int module, int tower, int sample,
273 Identifier& cell_id ) const;
274 bool pmt_id (const Identifier& cell_id,
275 int pmt,
276 Identifier& pmt_id ) const;
277 bool adc_id (const Identifier& pmt_id,
278 int adc,
279 Identifier& adc_id ) const;
280 bool adc_id (const Identifier& cell_id,
281 int pmt, int adc,
282 Identifier& adc_id ) const;
283
285 Identifier region_id (const ExpandedIdentifier& exp_id) const;
286 Identifier module_id (const ExpandedIdentifier& exp_id) const;
287 Identifier tower_id (const ExpandedIdentifier& exp_id) const;
288 Identifier cell_id (const ExpandedIdentifier& exp_id) const;
289 Identifier pmt_id (const ExpandedIdentifier& exp_id) const;
290 Identifier adc_id (const ExpandedIdentifier& exp_id) const;
291
292
305 int get_neighbours(const IdentifierHash& id,
306 const LArNeighbours::neighbourOption& option,
307 std::vector<IdentifierHash>& neighbourList) const;
308
309
310private:
311
312 int decode_section (int section) const
313 {
314 return section >= SBARREL ? (section & SECTION_MASK) : section;
315 }
316
317 int encode_section (int section) const
318 {
320 }
321
323 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
324
326 int get_field ( const Identifier & id,
327 size_type index ) const;
328
329 int initLevelsFromDict (const std::string& group_name);
330
331 int init_hashes();
332
333 int eta_min(const Identifier& id, const IdContext& context) const;
334 int eta_max(const Identifier& id, const IdContext& context) const;
335
336 unsigned m_supercell;
337
347
357
364
369
371};
372CLASS_DEF( Tile_Base_ID , 241188216 , 1 )
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
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
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
This class factors out code common between TileID and Tile_SuperCell_ID.
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