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-2025 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
24#include <ranges>
25
26
27class IdDictRegion;
28class LArEM_region;
29
30
31
36{
37public:
38 typedef Identifier::size_type size_type ;
39
41 LArEM_Base_ID (const std::string& name,
42 const std::string& group,
43 bool supercell);
44
46
49
52
55 Identifier region_id (int barrel_ec, int sampling, int region, bool checks ) const;
56
59 int eta, int phi ) const;
61 int eta, int phi, bool checks ) const;
62
65 Identifier region_id (const Identifier channelId) const ;
66
70 int eta, int phi ) const;
72 int eta, int phi, bool checks ) const;
73
78
80 using id_iterator = std::vector<Identifier>::const_iterator;
82 using id_range = std::ranges::subrange<id_iterator>;
83
84
91
98
100 const std::vector<Identifier>& channel_ids() const;
101
103 bool is_em_barrel (const Identifier id) const;
104
106 bool is_em_endcap (const Identifier id) const;
107
109 bool is_em_endcap_inner (const Identifier id) const;
110
112 bool is_em_endcap_outer (const Identifier id) const;
113
114
115
116
130 int barrel_ec (const Identifier id)const;
131
144 int sampling (const Identifier id)const;
145
146
170 int region (const Identifier id)const;
171
229 int eta (const Identifier id)const;
230
275 int phi (const Identifier id)const;
276
277
279 bool is_supercell (const Identifier id)const;
280
281
284 int eta_min(const Identifier regId) const;
287 int eta_max(const Identifier regId) const;
290 int phi_min(const Identifier regId) const;
293 int phi_max(const Identifier regId) const;
294
295
297 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
298 const std::string& group_name);
299
300
303 bool twoSymSides() const;
304
305
319 int get_neighbours(const IdentifierHash id,
320 const LArNeighbours::neighbourOption& option,
321 std::vector<IdentifierHash>& neighbourList) const;
322
323
327 // Inherited from CaloIDHelper:
328 //
329 //Identifier channel_id (IdentifierHash hashId) const;
330 //Identifier region_id (IdentifierHash hashId) const;
331 //IdentifierHash region_hash (Identifier regionId) const;
332 //size_type channel_hash_max() const;
333 //size_type region_hash_max() const;
334 //IdContext channel_context() const;
335 //IdContext region_context() const;
336 //const std::vector<const IdDictRegion*>& dictRegions() const;
337 //float etaGranularity(const IdentifierHash regHash) const;
338 //float phiGranularity(const IdentifierHash regHash) const;
339 //float eta0(const IdentifierHash regHash) const;
340 //float phi0(const IdentifierHash regHash) const;
341 //virtual int get_id (const IdentifierHash& hash_id,
342 // Identifier& id,
343 // const IdContext* context = 0 ) const;
344 //virtual int get_hash (const Identifier& id,
345 // IdentifierHash& hash_id,
346 // const IdContext* context = 0 ) const;
347
348
349private:
350 enum {NOT_VALID_HASH = 256000};
351
352 // Check methods
353 void region_id_checks (int barrel_ec, int sampling, int region ) const;
354 void channel_id_checks (int barrel_ec, int sampling, int region,
355 int eta, int phi ) const;
356 void channel_id_checks (const Identifier regionId,
357 int eta, int phi ) const;
358
360 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
361
362 int phi_min_init(const Identifier regId) const;
363
364 int initLevelsFromDict (const std::string& group_name);
365 int init_hashes();
366
367 static int get_prevInPhi(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
368 int& neighbourIndex, IdentifierHash* neighbList) ;
369
370 static int get_nextInPhi(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
371 int& neighbourIndex, IdentifierHash* neighbList) ;
372
373 int get_prevInEta(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& minHash,
374 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
375
376 int get_nextInEta(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& maxHash,
377 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
378
379 int get_prevInSamp(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
380 const double& gEta, const float& gPhi, const double& absEta,
381 int& neighbourIndex, IdentifierHash* neighbList) const;
382
383 int get_nextInSamp(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
384 const double& gEta, const float& gPhi, const double& absEta,
385 int& neighbourIndex, IdentifierHash* neighbList) const;
386
387 int get_prevInSubdet(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
388 const double& gEta, const float& gPhi, const double& absEta,
389 int& neighbourIndex, IdentifierHash* neighbList) const;
390
391 int get_nextInSubdet(const LArEM_region* emRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
392 const double& gEta, const float& gPhi, const double& absEta,
393 int& neighbourIndex, IdentifierHash* neighbList) const;
394
395
396
397 int init_neighbors();
398
399
400private:
401 unsigned m_slar{0};
402
403 bool m_two_sym_sides{true};
404
407
417
425
427
428 std::vector<int> m_vecOfPhiMin;
429
448 std::vector<HashCalc> m_hash_calcs;
449
451
452 std::vector<LArEM_region*> m_vecOfRegions;
453 std::vector<unsigned> m_cells; // stores starting hash number of each region, regions are ordered by hash so this array is ordered as well
454
457};
458
459
461
462
463#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.
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.
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