ATLAS Offline Software
Loading...
Searching...
No Matches
LArHEC_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_LARHEC_BASE_ID_H
14#define CALOIDENTIFIER_LARHEC_BASE_ID_H
15
16
22
23#include <vector>
24#include <algorithm>
25
26class Range;
27class LArHEC_region;
28
29
35{
36public:
37
39 LArHEC_Base_ID (const std::string& name,
40 const std::string& group,
41 bool supercell);
42
44
46 Identifier region_id (const ExpandedIdentifier& exp_id ) const ;
47
49 Identifier channel_id (const ExpandedIdentifier& exp_id ) const ;
50
52 Identifier region_id (int pos_neg, int sampling, int region ) const ;
53 Identifier region_id (int pos_neg, int sampling, int region, bool checks) const;
54
57 int eta, int phi ) const;
59 int eta, int phi, bool checks) const;
60
64 int eta, int phi ) const;
65
76 Identifier channel_id ( int pos_neg, int sampling, int sector, int region,
77 int eta, int phi_sector ) const;
78
81 Identifier region_id (const Identifier channelId) const ;
82
86 int eta, int phi ) const ;
88 int eta, int phi, bool checks) const;
89
91 bool is_supercell (const Identifier id)const;
92
97
104
111
113 const std::vector<Identifier>& channel_ids() const;
115 const std::vector<Identifier>& region_ids() const;
116
117
119 int pos_neg (const Identifier id)const;
120
122 int sampling (const Identifier id)const;
123
125 int region (const Identifier id)const;
126
128 int eta (const Identifier id)const;
129
131 int phi (const Identifier id)const;
132
135 int eta_min(const Identifier regId) const;
138 int eta_max(const Identifier regId) const;
141 int phi_min(const Identifier regId) const;
144 int phi_max(const Identifier regId) const;
145
146
148 int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
149 const std::string& group_name);
150
153 bool twoSymSides() const;
154
155
167 int get_neighbours(const IdentifierHash id,
168 const LArNeighbours::neighbourOption& option,
169 std::vector<IdentifierHash>& neighbourList) const;
170
171
174 // Inherited from CaloIDHelper:
175 //
176 //Identifier channel_id (IdentifierHash hashId) const;
177 //Identifier region_id (IdentifierHash hashId) const;
178 //IdentifierHash region_hash (Identifier regionId) const;
179 //size_type channel_hash_max() const;
180 //size_type region_hash_max() const;
181 //IdContext channel_context() const;
182 //IdContext region_context() const;
183 //const std::vector<const IdDictRegion*>& dictRegions() const;
184 //float etaGranularity(const IdentifierHash regHash) const;
185 //float phiGranularity(const IdentifierHash regHash) const;
186 //float eta0(const IdentifierHash regHash) const;
187 //float phi0(const IdentifierHash regHash) const;
188 //virtual int get_id (const IdentifierHash& hash_id,
189 // Identifier& id,
190 // const IdContext* context = 0 ) const;
191 //virtual int get_hash (const Identifier& id,
192 // IdentifierHash& hash_id,
193 // const IdContext* context = 0 ) const;
194
195
196private:
197
198 enum {NOT_VALID_HASH = 64000};
199
200 int phi_min_init(const Identifier regId) const;
201
202 // Check methods
203
204 void region_id_checks (int pos_neg, int sampling, int region ) const;
205 void channel_id_checks (int pos_neg, int sampling, int region,
206 int eta, int phi ) const;
207 void channel_id_checks (const Identifier regionId,
208 int eta, int phi ) const;
209
211 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
212
213 int initLevelsFromDict (const std::string& group_name) ;
214
215 int init_hashes();
216
217 static int get_prevInPhi(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
218 int& neighbourIndex, IdentifierHash* neighbList) ;
219
220 static int get_nextInPhi(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
221 int& neighbourIndex, IdentifierHash* neighbList) ;
222
223 int get_prevInEta(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& minHash,
224 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
225
226 int get_nextInEta(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const float& gPhi, const unsigned int& maxHash,
227 int& neighbourIndex, IdentifierHash* neighbList, unsigned int& nBiggerCell) const;
228
229 int get_prevInSamp(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
230 const double& absEta,
231 int& neighbourIndex, IdentifierHash* neighbList) const;
232
233 int get_nextInSamp(const LArHEC_region* hecRegion, const unsigned int& index, const short int& nPhi, const unsigned int& minHash,
234 const double& absEta,
235 int& neighbourIndex, IdentifierHash* neighbList) const;
236
237
238 int init_neighbors();
239
240
241 unsigned m_slar;
242
252
255
257
258 std::vector<short int> m_vecOfPhiMin;
259
278 std::vector<HashCalc> m_hash_calcs;
279
280
289
291
292 std::vector<LArHEC_region*> m_vecOfRegions;
293 std::vector<short int> m_vecOfCellInfo;
294};
295
296
298
299#endif // LARHEC_BASE_ID_H
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Base class to factor out code common among Calo ID helpers.
macros to associate a CLID to a type
const std::string & group() const
Group name for this helper.
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::size_type size_type
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
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.
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
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.
size_type m_REGION_INDEX
IdDictFieldImplementation m_region_impl
id_iterator hec_end() const
end iterator over full set of Hec Identifiers for channels
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,...
IdDictFieldImplementation m_phi_impl
int initLevelsFromDict(const std::string &group_name)
int region(const Identifier id) const
return region [0,1]
LArHEC_Base_ID(const std::string &name, const std::string &group, bool supercell)
Constructor.
Identifier channel_id(const Identifier regionId, int eta, int phi, bool checks) const
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
size_type m_SAMPLING_INDEX
id_iterator reg_begin() const
begin iterator over set of region Identifiers
Identifier channel_id(const Identifier regionId, int eta, int phi) const
allows to build a channel id starting from a region id (e.g.
static int get_prevInPhi(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList)
Identifier channel_id(const ExpandedIdentifier &exp_id) const
channel identifier for a channel from ExpandedIdentifier
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
bool twoSymSides() const
True if the + and - sides of the calorimeter are identical (true layout).
Identifier region_id(int pos_neg, int sampling, int region) const
build a region identifier for a channel
size_type m_LAR_INDEX
int phi_min_init(const Identifier regId) const
void channel_id_checks(int pos_neg, int sampling, int region, int eta, int phi) const
static int get_nextInPhi(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList)
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
size_type m_SLAR_INDEX
id_range reg_range() const
Range over set of Region Identifiers.
void region_id_checks(int pos_neg, int sampling, int region) const
IdDictFieldImplementation m_hec_impl
Identifier region_id(const ExpandedIdentifier &exp_id) const
region identifier for a channel from ExpandedIdentifier
IdDictFieldImplementation m_slar_impl
size_type m_ETA_INDEX
IdDictFieldImplementation m_sampling_impl
std::vector< HashCalc > m_hash_calcs
Identifier region_id(int pos_neg, int sampling, int region, bool checks) const
int get_nextInSamp(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
MultiRange m_full_channel_range
std::vector< short int > m_vecOfPhiMin
int phi(const Identifier id) const
return phi[0,63] outer part [0,31] inner part
const std::vector< Identifier > & region_ids() const
provide access to region id vector, accessed via hash
IdDictFieldImplementation m_pn_impl
size_type m_hec_region_index
int get_prevInEta(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const float &gPhi, const unsigned int &minHash, int &neighbourIndex, IdentifierHash *neighbList, unsigned int &nBiggerCell) const
Identifier region_id(const Identifier channelId) const
allows to know in which region is a channel/cell – valid for both kinds of channels
size_type m_POSNEG_INDEX
int get_prevInSamp(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const unsigned int &minHash, const double &absEta, int &neighbourIndex, IdentifierHash *neighbList) const
IdDictFieldImplementation m_pn_reg_impl
id_iterator hec_begin() const
begin iterator over full set of Hec Identifiers for channels
MultiRange m_full_region_range
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
Identifier channel_id(int pos_neg, int sampling, int region, int eta, int phi) const
build a cell identifier for a channel
int eta(const Identifier id) const
return eta [0,9] outer part [0,3] inner part
size_type m_HEC_INDEX
int pos_neg(const Identifier id) const
return pos_neg -2 (C side) or 2 (A side)
int get_nextInEta(const LArHEC_region *hecRegion, const unsigned int &index, const short int &nPhi, const float &gPhi, const unsigned int &maxHash, int &neighbourIndex, IdentifierHash *neighbList, unsigned int &nBiggerCell) const
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 sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
id_range hec_range() const
Range over full set of HEC Identifiers.
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
std::vector< short int > m_vecOfCellInfo
IdDictFieldImplementation m_lar_impl
std::vector< LArHEC_region * > m_vecOfRegions
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
IdDictFieldImplementation m_eta_impl
Identifier channel_id(int pos_neg, int sampling, int region, int eta, int phi, bool checks) const
size_type m_PHI_INDEX
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
id_iterator reg_end() const
end iterator over set of region Identifiers
IdentifierHash channel_hash_binary_search(Identifier channelId) const
create hash id from channel id – method NOT optimised, please use channel_hash() above
This class provides an interface to deal with regions in the neighbours finding.
A MultiRange combines several Ranges.
Definition MultiRange.h:17
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition index.py:1