ATLAS Offline Software
Loading...
Searching...
No Matches
LArFCAL_Base_ID.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef CALOIDENTIFIER_LARFCAL_BASE_ID_H
6#define CALOIDENTIFIER_LARFCAL_BASE_ID_H
7
14#include <ranges>
15
16class IdDictRegion;
17
19{
20public:
21
22 typedef Identifier::size_type size_type ;
23
24 LArFCAL_Base_ID(const std::string& name,
25 const std::string& group,
26 bool supercell);
27
29 Identifier module_id (const ExpandedIdentifier& exp_id) const ;
30
33
35 Identifier module_id ( int pos_neg, int module ) const ;
36 Identifier module_id ( int pos_neg, int module, bool checks ) const ;
37
39 Identifier channel_id( int pos_neg, int module,
40 int eta, int phi ) const ;
41 Identifier channel_id( int pos_neg, int module,
42 int eta, int phi, bool checks ) const ;
43
46 Identifier module_id (const Identifier id ) const;
47
51 int eta, int phi) const ;
53 int eta, int phi, bool checks) const ;
54
56 Identifier module_id (IdentifierHash module_hash_id) const;
57
60
63
66
68 using id_iterator = std::vector<Identifier>::const_iterator;
70 using id_range = std::ranges::subrange<id_iterator>;
71
78
85
87 const std::vector<Identifier>& channel_ids() const;
88
89
91 int pos_neg (const Identifier id)const;
93 int module (const Identifier id)const;
95 int eta (const Identifier id)const;
97 int phi (const Identifier id)const;
98
100 bool is_supercell (const Identifier id)const;
101
104 int eta_min(const Identifier regId) const;
107 int eta_max(const Identifier regId) const;
110 int phi_min(const Identifier regId) const;
113 int phi_max(const Identifier regId) const;
114
117 IdContext module_context () const;
118
119
120
125 int get_neighbours(const IdentifierHash id,
126 const LArNeighbours::neighbourOption& option,
127 std::vector<IdentifierHash>& neighbourList) const;
128
129
130
132 virtual int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
133 const std::string& group_name);
134
135
138 // Inherited from CaloIDHelper:
139 //
140 //Identifier channel_id (IdentifierHash hashId) const;
141 //Identifier region_id (IdentifierHash hashId) const;
142 //IdentifierHash channel_hash (Identifier channelId) const;
143 //IdentifierHash region_hash (Identifier regionId) const;
144 //size_type channel_hash_max() const;
145 //size_type region_hash_max() const;
146 //IdContext channel_context() const;
147 //IdContext region_context() const;
148 //const std::vector<const IdDictRegion*>& dictRegions() const;
149 //float etaGranularity(const IdentifierHash regHash) const;
150 //float phiGranularity(const IdentifierHash regHash) const;
151 //float eta0(const IdentifierHash regHash) const;
152 //float phi0(const IdentifierHash regHash) const;
153 //virtual int get_id (const IdentifierHash& hash_id,
154 // Identifier& id,
155 // const IdContext* context = 0 ) const;
156 //virtual int get_hash (const Identifier& id,
157 // IdentifierHash& hash_id,
158 // const IdContext* context = 0 ) const;
159
160
161private:
162
163 enum {NOT_VALID_HASH = 64000};
164
165 int phi_min_init(const Identifier regId) const;
166
167 // Check methods
168
169 void module_id_checks ( int pos_neg, int module ) const;
170 void channel_id_checks ( int pos_neg, int module,
171 int eta, int phi ) const;
172 void channel_id_checks ( const Identifier moduleId,
173 int eta, int phi) const;
174
176 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
177
178 int initLevelsFromDict(const std::string& group_name) ;
179 int init_hashes();
180
181 int init_neighbours_from_file(const std::string& filename, std::vector<std::set<IdentifierHash> > &vec);
182
183 int init_neighbours_2d(const std::string& filename)
184 {
186 }
187
188 int init_neighbours_3d_next(const std::string& filename)
189 {
191 }
192
193 int init_neighbours_3d_prev(const std::string& filename)
194 {
196 }
197
198 int init_neighbours(const IdDictMgr& dict_mgr) ;
199
200
201private:
202 unsigned m_slar{0};
203
205
214
217
218 std::vector<short int> m_vecOfPhiMin;
219
227
229
232
233 std::vector<std::set<IdentifierHash> > m_neighbours_2d_vec;
234 std::vector<std::set<IdentifierHash> > m_neighbours_3d_next_vec;
235 std::vector<std::set<IdentifierHash> > m_neighbours_3d_prev_vec;
236};
237
239
240
241#endif // not CALOIDENTIFIER_LARFCAL_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.
std::vector< size_t > vec
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).
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
CaloIDHelper(const std::string &name, const std::string &group)
Constructor.
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.
id_range fcal_range() const
Range over full set of FCAL Identifiers.
size_type m_MODULE_INDEX
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
id_iterator mod_end() const
end iterator over set of module Identifiers
IdDictFieldImplementation m_slar_impl
int phi_min_init(const Identifier regId) const
int init_neighbours_3d_prev(const std::string &filename)
size_type m_POSNEG_INDEX
Identifier module_id(const Identifier id) const
allows to know in which region is a channel/cell – valid for both kinds of channels
IdDictFieldImplementation m_pn_impl
int init_neighbours_3d_next(const std::string &filename)
Identifier channel_id(int pos_neg, int module, int eta, int phi, bool checks) const
Identifier::size_type size_type
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
Identifier module_id(IdentifierHash module_hash_id) const
create module id from hash id
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
IdDictFieldImplementation m_fcal_impl
int init_neighbours_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
IdDictFieldImplementation m_eta_impl
size_type module_hash_max() const
region hash table max size
IdDictFieldImplementation m_module_impl
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
virtual int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
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 = all2D,...
id_iterator mod_begin() const
begin iterator over set of module Identifiers
std::vector< std::set< IdentifierHash > > m_neighbours_3d_next_vec
int init_neighbours(const IdDictMgr &dict_mgr)
Identifier channel_id(const Identifier moduleId, int eta, int phi, bool checks) const
LArFCAL_Base_ID(const LArFCAL_Base_ID &)
id_iterator fcal_end() const
end iterator over full set of Fcal Identifiers for channels
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
id_iterator fcal_begin() const
begin iterator over full set of Fcal Identifiers for channels
id_range mod_range() const
Range over full set of FCAL modules.
Identifier channel_id(int pos_neg, int module, int eta, int phi) const
build a cell identifier for a channel
int phi(const Identifier id) const
phi [0,15]
int init_neighbours_2d(const std::string &filename)
void module_id_checks(int pos_neg, int module) const
std::vector< std::set< IdentifierHash > > m_neighbours_3d_prev_vec
Identifier channel_id(const Identifier moduleId, int eta, int phi) const
allows to build a channel id starting from a module id (e.g.
std::vector< short int > m_vecOfPhiMin
IdDictFieldImplementation m_pn_mod_impl
IdDictFieldImplementation m_phi_impl
IdContext module_context() const
context for modules – method kept for backward compatibility.
int initLevelsFromDict(const std::string &group_name)
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
size_type m_fcal_region_index
std::vector< std::set< IdentifierHash > > m_neighbours_2d_vec
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
void channel_id_checks(int pos_neg, int module, int eta, int phi) const
MultiRange m_full_module_range
const std::vector< Identifier > & channel_ids() const
provide acces to channel id vector, accessed via hash
MultiRange m_full_channel_range
Identifier module_id(int pos_neg, int module) const
build a module identifier for a channel
LArFCAL_Base_ID & operator=(const LArFCAL_Base_ID &)
IdDictFieldImplementation m_lar_impl
Identifier module_id(int pos_neg, int module, bool checks) const
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
LArFCAL_Base_ID(const std::string &name, const std::string &group, bool supercell)
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
IdentifierHash module_hash(Identifier module_id) const
create hash id from module id
IdentifierHash channel_hash_binary_search(Identifier channelId) const
create hash id from channel id – method NOT optimised, please use channel_hash() above
A MultiRange combines several Ranges.
Definition MultiRange.h:17