ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCell_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
13#ifndef CALOIDENTIFIER_CALOCELL_BASE_ID_H
14#define CALOIDENTIFIER_CALOCELL_BASE_ID_H
15
16
21#include "CaloGeoHelpers/CaloSampling.h"
22#include <ranges>
23#include <array>
24
25
26class CaloNeighbours;
27
28
40{
41public:
42 typedef Identifier::size_type size_type ;
43
45 enum SUBCALO { LAREM = 0, LARHEC = 1, LARFCAL = 2, TILE = 3, LARMINIFCAL = 4, NSUBCALO = 5, NOT_VALID=CaloIDHelper::NOT_VALID /*999999*/ };
46
48 //typedef CaloSampling::CaloSample CaloSample;
49 // enum CaloSample {
50 // PreSamplerB=0, EMB1, EMB2, EMB3, // LAr barrel
51 // PreSamplerE, EME1, EME2, EME3, // LAr EM endcap
52 // HEC0, HEC1, HEC2, HEC3, // Hadronic end cap cal.
53 // TileBar0, TileBar1, TileBar2, // Tile barrel
54 // TileGap1, TileGap2, TileGap3, // Tile gap (ITC & scint)
55 // TileExt0, TileExt1, TileExt2, // Tile extended barrel
56 // FCAL0, FCAL1, FCAL2, // Forward EM endcap
57 // MINIFCAL0, MINIFCAL1, MINIFCAL2, MINIFCAL3, // MiniFCAL
58 // Unknown
59 // };
60
61
63 CaloCell_Base_ID(const std::string& name,
64 const LArEM_Base_ID* em_id,
65 const LArHEC_Base_ID* hec_id,
66 const LArFCAL_Base_ID* fcal_id,
67 const LArMiniFCAL_ID* minifcal_id,
68 const Tile_Base_ID* tile_id,
69 bool supercell);
70
72
73
74 int GetSubCaloName( const std::string& SubCaloName ) const;
75
77 virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
78
82 Identifier region_id (const int subCalo,
83 const int barec_or_posneg,
84 const int sampling_or_fcalmodule,
85 const int region_or_dummy ) const;
86 Identifier region_id (const int subCalo,
87 const int barec_or_posneg,
88 const int sampling_or_fcalmodule,
89 const int region_or_dummy,
90 bool checks) const;
91
96 Identifier cell_id (const int subCalo,
97 const int barec_or_posneg,
98 const int sampling_or_fcalmodule,
99 const int region_or_dummy,
100 const int eta,
101 const int phi ) const;
102 Identifier cell_id (const int subCalo,
103 const int barec_or_posneg,
104 const int sampling_or_fcalmodule,
105 const int region_or_dummy,
106 const int eta,
107 const int phi,
108 bool checks) const;
109
111 Identifier region_id (const Identifier cellId ) const;
112
116 const int eta, const int phi,
117 int depth = 0) const ;
119 const int eta, const int phi,
120 int depth,
121 bool checks) const ;
122
124 Identifier region_id (const IdentifierHash caloRegionHash) const;
126 Identifier region_id (const int subCalo, const IdentifierHash subCaloRegionHash) const;
127
129 Identifier cell_id (const IdentifierHash caloCellHash) const;
131 Identifier cell_id (const int subCalo, const IdentifierHash subCaloCellHash) const;
132
137 IdentifierHash subcalo_region_hash (const Identifier regionId, int& subCalo) const; // subCalo is an output argument
138
143 IdentifierHash subcalo_cell_hash (const Identifier cellId, int& subCalo) const; // subCalo is an output argument
144
149
153 void calo_cell_hash_range (const Identifier id, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const;
157 void calo_cell_hash_range (const int subCalo, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const;
161 void calo_reg_hash_range (const Identifier id, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const;
165 void calo_reg_hash_range (const int subCalo, IdentifierHash& caloCellMin, IdentifierHash& caloCellMax) const;
166
168 IdentifierHash subcalo_cell_hash (const IdentifierHash caloHash, int& subCalo) const;
170 IdentifierHash subcalo_region_hash (const IdentifierHash caloHash, int& subCalo) const;
171
173 IdentifierHash calo_cell_hash (const int subCalo, const IdentifierHash subCaloHash) const;
175 IdentifierHash calo_region_hash (const int subCalo, const IdentifierHash subCaloHash) const;
176
178 using id_iterator = std::vector<Identifier>::const_iterator;
180 using id_range = std::ranges::subrange<id_iterator>;
181
188
190 id_iterator cell_begin (const int subCalo) const;
192 id_iterator cell_end (const int subCalo) const;
194 id_range cell_range (const int subCalo) const;
195
202
204 id_iterator reg_begin (const int subCalo) const;
206 id_iterator reg_end (const int subCalo) const;
208 id_range reg_range (const int subCalo) const;
209
211 bool is_em (const Identifier id) const;
213 bool is_em (const IdentifierHash caloHash) const;
214
216 bool is_em_barrel (const Identifier id) const;
217
219 bool is_em_endcap (const Identifier id) const;
220
222 bool is_em_endcap_inner (const Identifier id) const;
223
225 bool is_em_endcap_outer (const Identifier id) const;
226
228 bool is_hec (const Identifier id) const;
230 bool is_hec (const IdentifierHash caloHash) const;
231
233 bool is_fcal (const Identifier id) const;
235 bool is_fcal (const IdentifierHash caloHash) const;
236
238 bool is_minifcal (const Identifier id) const;
240 bool is_minifcal (const IdentifierHash caloHash) const;
241
243 bool is_tile (const Identifier id) const;
245 bool is_tile (const IdentifierHash caloHash) const;
246 bool is_tile (const ExpandedIdentifier& id) const;
247
249 bool is_tile_barrel (const Identifier id) const;
251 bool is_tile_extbarrel (const Identifier id) const;
253 bool is_tile_gap (const Identifier id) const;
254 bool is_tile_gapscin (const Identifier id) const;
256 bool is_tile_negative (const Identifier id) const;
258 bool is_tile_positive (const Identifier id) const;
259
261 int sub_calo (const Identifier id)const;
263 int sub_calo (const IdentifierHash caloHash)const;
264
266 int calo_sample (const Identifier id)const;
268 int calo_sample (const IdentifierHash caloHash)const;
269
270
271 /* field values (proposal)*/
272 /*
273 int first_field (const Identifier id)const; // corresponds to 'barrel_ec' for LArEM, 'pos_neg' for LArHEC and LArFCAL, 'section' for Tile
274 int second_field (const Identifier id)const; // corresponds to 'sampling' for LArEM and LArHEC, 'module' for LArFCAL, 'side' for Tile
275 int third_field (const Identifier id)const; // corresponds to 'region' for LArEM and LArHEC, nothing for LArFCAL, 'module' for Tile
276 int fourth_field (const Identifier id)const; // corresponds to 'eta' for LAr, 'tower' for Tile
277 int fifth_field (const Identifier id)const; // corresponds to 'phi' for LAr, 'sample' for Tile
278 */
279
281 int pos_neg (const Identifier id)const; // corresponds to 'barrel_ec' for LArEM
283 int sampling (const Identifier id)const; // corresponds 'module' for FCAL/MiniFCAL
285 int region (const Identifier id)const; // no region for FCAL, is 'depth' for MiniFCAL
287 int eta (const Identifier id)const;
289 int phi (const Identifier id)const;
291 int section (const Identifier id)const;
293 int side (const Identifier id)const;
295 int module (const Identifier id)const;
297 int tower (const Identifier id)const;
299 int sample (const Identifier id)const;
300
302 bool is_supercell (const Identifier id)const;
303
306 int eta_min(const Identifier regId) const;
309 int eta_max(const Identifier regId) const;
312 int phi_min(const Identifier regId) const; // LAr only
315 int phi_max(const Identifier regId) const;
316
319 float etaGranularity(const Identifier regId) const;
322 float phiGranularity(const Identifier regId) const;
325 float eta0(const Identifier regId) const;
328 float phi0(const Identifier regId) const;
329
333 { return m_emHelper;
334 }
335
338 { return m_hecHelper;
339 }
340
344 { return m_fcalHelper;
345 }
346
350 { return m_minifcalHelper;
351 }
352
356 { return m_tileHelper;
357 }
358
359
374 int get_neighbours(const IdentifierHash caloHash,
375 const LArNeighbours::neighbourOption& option,
376 std::vector<IdentifierHash>& neighbourList) const;
377
379 std::string cell_name(const Identifier id) const;
380
381 std::string show_to_string(const Identifier id,
382 const IdContext *context = 0,
383 char sep = '.') const;
384
385
386private:
388
394 std::array<const CaloIDHelper*, NSUBCALO> m_helpers;
395
398 std::array<size_type, NSUBCALO> m_cell_min;
399 std::array<size_type, NSUBCALO> m_cell_max;
400 std::array<size_type, NSUBCALO> m_reg_min;
401 std::array<size_type, NSUBCALO> m_reg_max;
402 std::vector<Identifier> m_cell_vec;
403 std::vector<Identifier> m_region_vec;
404
405private:
406 // Avoid coverity warnings.
409
411
412 unsigned m_supercell;
413};
414
415
416
418
419
420CLASS_DEF( CaloCell_Base_ID , 257140327 , 1 )
421
422
423#endif // not CALOIDENTIFIER_CALOCELL_BASE_ID_H
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
AtlasDetectorID(const std::string &name, const std::string &group)
Helper base class for offline cell identifiers.
id_iterator cell_begin(const int subCalo) const
begin iterator over subCalo sets of cell Identifiers
IdentifierHash subcalo_region_hash(const Identifier regionId, int &subCalo) const
create hash id from 'global' region id
IdentifierHash subcalo_region_hash(const IdentifierHash caloHash, int &subCalo) const
to translate a region 'global' caloHash into a subCaloHash
id_range cell_range(const int subCalo) const
Range over subCalo sets of cell Identifiers.
id_iterator cell_end(const int subCalo) const
end iterator over subCalo sets of cell Identifiers
int sub_calo(const IdentifierHash caloHash) const
returns an int taken from SUBCALO enum and describing the subCalo to which the hash Id belongs.
void calo_reg_hash_range(const int subCalo, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' region hashes of one sub-calorimeter alone
bool is_tile_gap(const Identifier id) const
test if the id belongs to the Tiles gap
SUBCALO
enumeration of sub calorimeters
int phi(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
Identifier region_id(const int subCalo, const IdentifierHash subCaloRegionHash) const
create region id from 'local'(==internal to sub calo) hash id and sub calorimeter
std::string show_to_string(const Identifier id, const IdContext *context=0, char sep='.') const
std::string cell_name(const Identifier id) const
Returns the cell-location in a human readable form.
CaloCell_Base_ID(const CaloCell_Base_ID &)
id_iterator reg_end() const
end iterator over set of region Identifiers (LAr + Tiles)
Identifier region_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, bool checks) const
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
Identifier cell_id(const Identifier regionId, const int eta, const int phi, int depth=0) const
not available for Tile depth is only used for miniFCAL
CaloNeighbours * m_caloNeighbours
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
bool is_tile(const ExpandedIdentifier &id) const
float phi0(const Identifier regId) const
minimum LAr phi for this region
std::array< size_type, NSUBCALO > m_reg_max
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
int section(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
Identifier cell_id(const int subCalo, const IdentifierHash subCaloCellHash) const
create cell id from 'local'(==internal to sub calo) hash id and sub calorimeter
std::vector< Identifier > m_cell_vec
id_iterator reg_begin() const
begin iterator over set of region Identifiers (LAr + Tiles)
std::array< size_type, NSUBCALO > m_reg_min
Identifier region_id(const Identifier cellId) const
Make a region ID from a cell ID.
int side(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
id_iterator cell_begin() const
begin iterator over full set of Identifiers (LAr + Tiles)
std::array< const CaloIDHelper *, NSUBCALO > m_helpers
size_type calo_region_hash_max() const
cell 'global' region table max size
bool is_tile(const IdentifierHash caloHash) const
test if the hash id belongs to the Tiles
const LArHEC_Base_ID * m_hecHelper
void calo_cell_hash_range(const int subCalo, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
bool is_minifcal(const Identifier id) const
test if the id belongs to the MiniFCAL
const LArFCAL_Base_ID * fcal_idHelper() const
access to FCAL idHelper
size_type m_region_hash_max
Identifier region_id(const IdentifierHash caloRegionHash) const
create region id from 'global'(==full calo) hash id
id_iterator reg_end(const int subCalo) const
end iterator over subCalo sets of region Identifiers
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
const LArHEC_Base_ID * hec_idHelper() const
access to HEC idHelper
CaloCell_Base_ID & operator=(const CaloCell_Base_ID &)
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
const Tile_Base_ID * tile_idHelper() const
access to Tile idHelper
void calo_reg_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' region hashes of one sub-calorimeter alone
IdentifierHash calo_region_hash(const int subCalo, const IdentifierHash subCaloHash) const
to translate a region subCaloHash with its subCalo index into a 'global' caloHash
size_type calo_cell_hash_max() const
cell 'global' hash table max size
int sample(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
bool is_hec(const IdentifierHash caloHash) const
test if the hash id belongs to the HEC
const LArEM_Base_ID * em_idHelper() const
access to EM idHelper
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
float etaGranularity(const Identifier regId) const
LAr eta granularity (NOT_VALID == failure)
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
float phiGranularity(const Identifier regId) const
LAr phi granularity (NOT_VALID == failure)
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
int GetSubCaloName(const std::string &SubCaloName) const
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
std::array< size_type, NSUBCALO > m_cell_max
bool is_tile_extbarrel(const Identifier id) const
test if the id belongs to the Tiles extended barrel
id_range cell_range() const
Range over full set of Identifiers (LAr + Tiles)
bool is_tile_gapscin(const Identifier id) const
id_iterator cell_end() const
end iterator over full set of Identifiers (LAr + Tiles)
Identifier cell_id(const Identifier regionId, const int eta, const int phi, int depth, bool checks) const
id_range reg_range(const int subCalo) const
Range over subCalo sets of region Identifiers.
const LArMiniFCAL_ID * minifcal_idHelper() const
access to MiniFCAL idHelper
const LArFCAL_Base_ID * m_fcalHelper
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
bool is_tile_negative(const Identifier id) const
test if the id belongs to the Tiles negative side
id_iterator reg_begin(const int subCalo) const
begin iterator over subCalo sets of region Identifiers
IdentifierHash subcalo_cell_hash(const IdentifierHash caloHash, int &subCalo) const
to translate a cell 'global' caloHash into a subCaloHash
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
const Tile_Base_ID * m_tileHelper
Identifier region_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy) const
Make a region ID from constituting fields and subCalo index; for (Mini)FCAL and Tiles,...
SUBCALO get_subcalo(Identifier id) const
bool is_em(const Identifier id) const
test if the id belongs to LArEM
IdentifierHash subcalo_cell_hash(const Identifier cellId, int &subCalo) const
create hash id from 'global' cell id
bool is_tile_positive(const Identifier id) const
test if the id belongs to the Tiles positive side
CaloCell_Base_ID(const std::string &name, const LArEM_Base_ID *em_id, const LArHEC_Base_ID *hec_id, const LArFCAL_Base_ID *fcal_id, const LArMiniFCAL_ID *minifcal_id, const Tile_Base_ID *tile_id, bool supercell)
enumeration of samplings (i.e.layers) separately for various sub calorimeters
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
id_range reg_range() const
Range over set of region Identifiers (LAr + Tiles)
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
std::array< size_type, NSUBCALO > m_cell_min
float eta0(const Identifier regId) const
minimum LAr eta for this region
bool is_fcal(const IdentifierHash caloHash) const
test if the hash id belongs to the FCAL - true also for MiniFCAL
bool is_tile_barrel(const Identifier id) const
test if the id belongs to the Tiles barrel
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
int tower(const Identifier id) const
Tile field values (NOT_VALID == invalid request)
Identifier::size_type size_type
bool is_em(const IdentifierHash caloHash) const
test if the hash id belongs to LArEM
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
bool is_minifcal(const IdentifierHash caloHash) const
test if the hash id belongs to the FCAL
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi, bool checks) const
const LArEM_Base_ID * m_emHelper
std::vector< Identifier > m_region_vec
Identifier cell_id(const IdentifierHash caloCellHash) const
create cell id from 'global' hash id
const LArMiniFCAL_ID * m_minifcalHelper
IdentifierHash calo_region_hash(const Identifier regionId) const
create hash id from 'global' region id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
IdentifierHash calo_cell_hash(const int subCalo, const IdentifierHash subCaloHash) const
to translate a cell subCaloHash with its subCalo index into a 'global' caloHash
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
Helper class for LArMiniFCAL offline identifiers.
This class factors out code common between TileID and Tile_SuperCell_ID.
std::string depth
tag string for intendation
Definition fastadd.cxx:46