ATLAS Offline Software
Loading...
Searching...
No Matches
LArEM_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/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
12
13
14#ifndef CALOIDENTIFIER_LAREM_BASE_ID_H
15#define CALOIDENTIFIER_LAREM_BASE_ID_H
16
17
25#include <ranges>
26
27
28class IdDictRegion;
29class LArEM_region;
30
31
32
37{
38public:
39 typedef Identifier::size_type size_type ;
40
42 LArEM_Base_ID (const std::string& name,
43 const std::string& group,
44 bool supercell);
45
47
50
53
56 Identifier region_id (int barrel_ec, int sampling, int region, bool checks ) const;
57
60 int eta, int phi ) const;
62 int eta, int phi, bool checks ) const;
63
66 Identifier region_id (const Identifier channelId) const ;
67
71 int eta, int phi ) const;
73 int eta, int phi, bool checks ) const;
74
79
81 using id_iterator = std::vector<Identifier>::const_iterator;
83 using id_range = std::ranges::subrange<id_iterator>;
84
85
92
99
101 const std::vector<Identifier>& channel_ids() const;
102
104 bool is_em_barrel (const Identifier id) const;
105
107 bool is_em_endcap (const Identifier id) const;
108
110 bool is_em_endcap_inner (const Identifier id) const;
111
113 bool is_em_endcap_outer (const Identifier id) const;
114
115
116
117
131 int barrel_ec (const Identifier id)const;
132
145 int sampling (const Identifier id)const;
146
147
171 int region (const Identifier id)const;
172
230 int eta (const Identifier id)const;
231
276 int phi (const Identifier id)const;
277
278
280 bool is_supercell (const Identifier id)const;
281
282
285 int eta_min(const Identifier regId) const;
288 int eta_max(const Identifier regId) const;
291 int phi_min(const Identifier regId) const;
294 int phi_max(const Identifier regId) const;
295
296
298 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
299 const std::string& group_name);
300
301
304 bool twoSymSides() const;
305
306
320 int get_neighbours(const IdentifierHash id,
321 const LArNeighbours::neighbourOption& option,
322 std::vector<IdentifierHash>& neighbourList) const;
323
324
328 // Inherited from CaloIDHelper:
329 //
330 //Identifier channel_id (IdentifierHash hashId) const;
331 //Identifier region_id (IdentifierHash hashId) const;
332 //IdentifierHash region_hash (Identifier regionId) const;
333 //size_type channel_hash_max() const;
334 //size_type region_hash_max() const;
335 //IdContext channel_context() const;
336 //IdContext region_context() const;
337 //const std::vector<const IdDictRegion*>& dictRegions() const;
338 //float etaGranularity(const IdentifierHash regHash) const;
339 //float phiGranularity(const IdentifierHash regHash) const;
340 //float eta0(const IdentifierHash regHash) const;
341 //float phi0(const IdentifierHash regHash) const;
342 //virtual int get_id (const IdentifierHash& hash_id,
343 // Identifier& id,
344 // const IdContext* context = 0 ) const;
345 //virtual int get_hash (const Identifier& id,
346 // IdentifierHash& hash_id,
347 // const IdContext* context = 0 ) const;
348
349
350private:
351 enum {NOT_VALID_HASH = 256000};
352
353 // Check methods
354 void region_id_checks (int barrel_ec, int sampling, int region ) const;
355 void channel_id_checks (int barrel_ec, int sampling, int region,
356 int eta, int phi ) const;
357 void channel_id_checks (const Identifier regionId,
358 int eta, int phi ) const;
359
361 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
362
363 int phi_min_init(const Identifier regId) const;
364
365 int initLevelsFromDict (const std::string& group_name);
366 int init_hashes();
367
368 static int get_prevInPhi(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
369 int& neighbourIndex, IdentifierHash* neighbList) ;
370
371 static int get_nextInPhi(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
372 int& neighbourIndex, IdentifierHash* neighbList) ;
373
374 int get_prevInEta(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& minHash,
375 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
376
377 int get_nextInEta(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& maxHash,
378 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
379
380 int get_prevInSamp(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
381 const double& gEta, const float& gPhi, const double& absEta,
382 int& neighbourIndex, IdentifierHash* neighbList) const;
383
384 int get_nextInSamp(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
385 const double& gEta, const float& gPhi, const double& absEta,
386 int& neighbourIndex, IdentifierHash* neighbList) const;
387
388 int get_prevInSubdet(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
389 const double& gEta, const float& gPhi, const double& absEta,
390 int& neighbourIndex, IdentifierHash* neighbList) const;
391
392 int get_nextInSubdet(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
393 const double& gEta, const float& gPhi, const double& absEta,
394 int& neighbourIndex, IdentifierHash* neighbList) const;
395
396
397
398 int init_neighbors();
399
400
401private:
402 unsigned m_slar{0};
403
404 bool m_two_sym_sides{true};
405
408
418
426
428
429 std::vector<int> m_vecOfPhiMin;
430
449 std::vector<HashCalc> m_hash_calcs;
450
452
453 std::vector<LArEM_region*> m_vecOfRegions;
454 std::vector<unsigned> m_cells; // stores starting hash number of each region, regions are ordered by hash so this array is ordered as well
455
458};
459CLASS_DEF( LArEM_Base_ID , 166227018 , 1 )
460
461
462#include "CaloIdentifier/LArEM_Base_ID.icc"
463
464
465#endif // not CALOIDENTIFIER_LAREM_BASE_ID_H
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
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
const std::string & group() const
Group name for this helper.
IdentifierHash region_hash(Identifier regionId) const
Convert a connected region Identifier to a hash code.
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
Identifier region_id(IdentifierHash hashId) const
Return the region Identifier for a given hash code (no checking).
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.
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
int get_prevInEta(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const float &gPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList, unsigned int &nBiggerCell) const
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
size_type m_REGION_INDEX
int region(const Identifier id) const
return region according to :
IdentifierHash channel_hash_binary_search(Identifier channelId) const
create hash id from channel id – method NOT optimised, please use channel_hash() above
Identifier region_id(const Identifier channelId) const
allows to know in which region is a channel/cell – valid for both kinds of channels
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
std::vector< unsigned > m_cells
int eta(const Identifier id) const
return eta according to :
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
size_type m_PHI_INDEX
id_range reg_range() const
Range over set of Region Identifiers.
Identifier region_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
LArEM_Base_ID(const LArEM_Base_ID &)
size_type m_SAMPLING_INDEX
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
id_range em_range() const
Range over full set of EM Identifiers.
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
void region_id_checks(int barrel_ec, int sampling, int region) const
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
Identifier channel_id(const Identifier regionId, int eta, int phi, bool checks) const
IdDictFieldImplementation m_em_impl
int get_nextInSamp(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &gEta, const float &gPhi, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
bool is_em_endcap(const Identifier id) const
test if the id belongs to the EM Endcap
IdDictFieldImplementation m_phi_impl
size_type m_EM_INDEX
size_type m_LAR_INDEX
IdDictFieldImplementation m_sampling_impl
IdDictFieldImplementation m_region_impl
Identifier channel_id(const Identifier regionId, int eta, int phi) const
allows to build a cell id starting from a region id (e.g.
int get_prevInSamp(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &gEta, const float &gPhi, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
size_type m_em_region_index
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
std::vector< LArEM_region * > m_vecOfRegions
static int get_nextInPhi(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList)
int get_nextInEta(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const float &gPhi, const unsigned int &maxHash, int &neighbourIndex, IdentifierHash *neighbList, unsigned int &nBiggerCell) const
Identifier channel_id(int barrel_ec, int sampling, int region, int eta, int phi) const
build a cell identifier
int get_prevInSubdet(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &gEta, const float &gPhi, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
int phi(const Identifier id) const
return phi according to :
IdDictFieldImplementation m_lar_impl
id_iterator em_begin() const
begin iterator over full set of EM Identifiers
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
int phi_min_init(const Identifier regId) const
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
size_type m_ETA_INDEX
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
MultiRange m_full_em_range
static int get_prevInPhi(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList)
IdDictFieldImplementation m_bec_impl
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
size_type m_SLAR_INDEX
Identifier::size_type size_type
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
MultiRange m_full_region_range
LArEM_Base_ID & operator=(const LArEM_Base_ID &)
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
size_type m_BEC_INDEX
Identifier region_id(int barrel_ec, int sampling, int region) const
build a region identifier
std::vector< int > m_vecOfPhiMin
std::vector< HashCalc > m_hash_calcs
IdDictFieldImplementation m_slar_impl
void channel_id_checks(int barrel_ec, int sampling, int region, int eta, int phi) const
id_iterator reg_end() const
end iterator over set of Region Identifiers
Identifier region_id(int barrel_ec, int sampling, int region, bool checks) const
Identifier channel_id(int barrel_ec, int sampling, int region, int eta, int phi, bool checks) const
IdDictFieldImplementation m_bec_reg_impl
bool twoSymSides() const
True if the + and - sides of the calorimeter are identical (true layout).
IdDictFieldImplementation m_eta_impl
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,...
int barrel_ec(const Identifier id) const
return barrel_ec according to :
int sampling(const Identifier id) const
return sampling according to :
int get_nextInSubdet(const LArEM_region *emRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &gEta, const float &gPhi, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
id_iterator em_end() const
end iterator over full set of EM Identifiers
id_iterator reg_begin() const
begin iterator over set of Region Identifiers
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
int initLevelsFromDict(const std::string &group_name)
LArEM_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
This class provides an interface to deal with regions in the neighbours finding.
A MultiRange combines several Ranges.
Definition MultiRange.h:17
Definition index.py:1