ATLAS Offline Software
Loading...
Searching...
No Matches
LArFCAL_Base_ID.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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
15#include <ranges>
16
17class IdDictRegion;
18
20{
21public:
22
23 typedef Identifier::size_type size_type ;
24
25 LArFCAL_Base_ID(const std::string& name,
26 const std::string& group,
27 bool supercell);
28
30 Identifier module_id (const ExpandedIdentifier& exp_id) const ;
31
34
36 Identifier module_id ( int pos_neg, int module ) const ;
37 Identifier module_id ( int pos_neg, int module, bool checks ) const ;
38
40 Identifier channel_id( int pos_neg, int module,
41 int eta, int phi ) const ;
42 Identifier channel_id( int pos_neg, int module,
43 int eta, int phi, bool checks ) const ;
44
47 Identifier module_id (const Identifier id ) const;
48
52 int eta, int phi) const ;
54 int eta, int phi, bool checks) const ;
55
57 Identifier module_id (IdentifierHash module_hash_id) const;
58
61
64
67
69 using id_iterator = std::vector<Identifier>::const_iterator;
71 using id_range = std::ranges::subrange<id_iterator>;
72
79
86
88 const std::vector<Identifier>& channel_ids() const;
89
90
92 int pos_neg (const Identifier id)const;
94 int module (const Identifier id)const;
96 int eta (const Identifier id)const;
98 int phi (const Identifier id)const;
99
101 bool is_supercell (const Identifier id)const;
102
105 int eta_min(const Identifier regId) const;
108 int eta_max(const Identifier regId) const;
111 int phi_min(const Identifier regId) const;
114 int phi_max(const Identifier regId) const;
115
118 IdContext module_context () const;
119
120
121
126 int get_neighbours(const IdentifierHash id,
127 const LArNeighbours::neighbourOption& option,
128 std::vector<IdentifierHash>& neighbourList) const;
129
130
131
133 virtual int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
134 const std::string& group_name);
135
136
139 // Inherited from CaloIDHelper:
140 //
141 //Identifier channel_id (IdentifierHash hashId) const;
142 //Identifier region_id (IdentifierHash hashId) const;
143 //IdentifierHash channel_hash (Identifier channelId) const;
144 //IdentifierHash region_hash (Identifier regionId) const;
145 //size_type channel_hash_max() const;
146 //size_type region_hash_max() const;
147 //IdContext channel_context() const;
148 //IdContext region_context() const;
149 //const std::vector<const IdDictRegion*>& dictRegions() const;
150 //float etaGranularity(const IdentifierHash regHash) const;
151 //float phiGranularity(const IdentifierHash regHash) const;
152 //float eta0(const IdentifierHash regHash) const;
153 //float phi0(const IdentifierHash regHash) const;
154 //virtual int get_id (const IdentifierHash& hash_id,
155 // Identifier& id,
156 // const IdContext* context = 0 ) const;
157 //virtual int get_hash (const Identifier& id,
158 // IdentifierHash& hash_id,
159 // const IdContext* context = 0 ) const;
160
161
162private:
163
164 enum {NOT_VALID_HASH = 64000};
165
166 int phi_min_init(const Identifier regId) const;
167
168 // Check methods
169
170 void module_id_checks ( int pos_neg, int module ) const;
171 void channel_id_checks ( int pos_neg, int module,
172 int eta, int phi ) const;
173 void channel_id_checks ( const Identifier moduleId,
174 int eta, int phi) const;
175
177 virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
178
179 int initLevelsFromDict(const std::string& group_name) ;
180 int init_hashes();
181
182 int init_neighbours_from_file(const std::string& filename, std::vector<std::set<IdentifierHash> > &vec);
183
184 int init_neighbours_2d(const std::string& filename)
185 {
187 }
188
189 int init_neighbours_3d_next(const std::string& filename)
190 {
192 }
193
194 int init_neighbours_3d_prev(const std::string& filename)
195 {
197 }
198
199 int init_neighbours(const IdDictMgr& dict_mgr) ;
200
201
202private:
203 unsigned m_slar{0};
204
206
215
218
219 std::vector<short int> m_vecOfPhiMin;
220
228
230
233
234 std::vector<std::set<IdentifierHash> > m_neighbours_2d_vec;
235 std::vector<std::set<IdentifierHash> > m_neighbours_3d_next_vec;
236 std::vector<std::set<IdentifierHash> > m_neighbours_3d_prev_vec;
237};
238CLASS_DEF( LArFCAL_Base_ID , 225948692 , 1 )
239
240
241#include "CaloIdentifier/LArFCAL_Base_ID.icc"
242
243
244#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
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.
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