ATLAS Offline Software
LArFCAL_Base_ID.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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 "boost/range/iterator_range.hpp"
15 
16 class IdDictRegion;
17 
19 {
20 public:
21 
23 
24  LArFCAL_Base_ID(const std::string& name, bool supercell);
25 
27  Identifier module_id (const ExpandedIdentifier& exp_id) const ;
28 
30  Identifier channel_id (const ExpandedIdentifier& exp_id) const ;
31 
33  Identifier module_id ( int pos_neg, int module ) const ;
34  Identifier module_id ( int pos_neg, int module, bool checks ) const ;
35 
38  int eta, int phi ) const ;
40  int eta, int phi, bool checks ) const ;
41 
44  Identifier module_id (const Identifier id ) const;
45 
48  Identifier channel_id( const Identifier moduleId,
49  int eta, int phi) const ;
50  Identifier channel_id( const Identifier moduleId,
51  int eta, int phi, bool checks) const ;
52 
54  Identifier module_id (IdentifierHash module_hash_id) const;
55 
58 
61 
63  size_type module_hash_max (void) const;
64 
66  typedef std::vector<Identifier>::const_iterator id_iterator;
68  typedef boost::iterator_range<id_iterator> id_range;
69 
71  id_iterator mod_begin (void) const;
73  id_iterator mod_end (void) const;
75  id_range mod_range () const;
76 
78  id_iterator fcal_begin (void) const;
80  id_iterator fcal_end (void) const;
82  id_range fcal_range () const;
83 
85  const std::vector<Identifier>& channel_ids() const;
86 
87 
89  int pos_neg (const Identifier id)const;
91  int module (const Identifier id)const;
93  int eta (const Identifier id)const;
95  int phi (const Identifier id)const;
96 
98  bool is_supercell (const Identifier id)const;
99 
102  int eta_min(const Identifier regId) const;
105  int eta_max(const Identifier regId) const;
108  int phi_min(const Identifier regId) const;
111  int phi_max(const Identifier regId) const;
112 
115  IdContext module_context (void) const;
116 
117 
118 
123  int get_neighbours(const IdentifierHash id,
124  const LArNeighbours::neighbourOption& option,
125  std::vector<IdentifierHash>& neighbourList) const;
126 
127 
128 
130  virtual int initialize_base_from_dictionary (const IdDictMgr& dict_mgr,
131  const std::string& group_name);
132 
133 
136  // Inherited from CaloIDHelper:
137  //
138  //Identifier channel_id (IdentifierHash hashId) const;
139  //Identifier region_id (IdentifierHash hashId) const;
140  //IdentifierHash channel_hash (Identifier channelId) const;
141  //IdentifierHash region_hash (Identifier regionId) const;
142  //size_type channel_hash_max() const;
143  //size_type region_hash_max() const;
144  //IdContext channel_context() const;
145  //IdContext region_context() const;
146  //const std::vector<const IdDictRegion*>& dictRegions() const;
147  //float etaGranularity(const IdentifierHash regHash) const;
148  //float phiGranularity(const IdentifierHash regHash) const;
149  //float eta0(const IdentifierHash regHash) const;
150  //float phi0(const IdentifierHash regHash) const;
151  //virtual int get_id (const IdentifierHash& hash_id,
152  // Identifier& id,
153  // const IdContext* context = 0 ) const;
154  //virtual int get_hash (const Identifier& id,
155  // IdentifierHash& hash_id,
156  // const IdContext* context = 0 ) const;
157 
158 
159 private:
160 
161  enum {NOT_VALID_HASH = 64000};
162 
163  int phi_min_init(const Identifier regId) const;
164 
165  // Check methods
166 
167  void module_id_checks ( int pos_neg, int module ) const;
168  void channel_id_checks ( int pos_neg, int module,
169  int eta, int phi ) const;
170  void channel_id_checks ( const Identifier moduleId,
171  int eta, int phi) const;
172 
174  virtual int get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const;
175 
176  int initLevelsFromDict(const std::string& group_name) ;
177  int init_hashes(void) ;
178 
179  int init_neighbours_from_file(const std::string& filename, std::vector<std::set<IdentifierHash> > &vec);
180 
181  int init_neighbours_2d(const std::string& filename)
182  {
184  }
185 
186  int init_neighbours_3d_next(const std::string& filename)
187  {
189  }
190 
191  int init_neighbours_3d_prev(const std::string& filename)
192  {
194  }
195 
196  int init_neighbours(const IdDictMgr& dict_mgr) ;
197 
198 
199 private:
200  unsigned m_slar;
201 
203 
212 
215 
216  std::vector<short int> m_vecOfPhiMin;
217 
225 
227 
230 
231  std::vector<std::set<IdentifierHash> > m_neighbours_2d_vec;
232  std::vector<std::set<IdentifierHash> > m_neighbours_3d_next_vec;
233  std::vector<std::set<IdentifierHash> > m_neighbours_3d_prev_vec;
234 };
235 
237 
238 
239 #endif // not CALOIDENTIFIER_LARFCAL_BASE_ID_H
LArFCAL_Base_ID::m_two_sym_sides
bool m_two_sym_sides
Definition: LArFCAL_Base_ID.h:202
LArNeighbours::neighbourOption
neighbourOption
Definition: LArNeighbours.h:12
LArFCAL_Base_ID
Definition: LArFCAL_Base_ID.h:19
LArFCAL_Base_ID::eta_max
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
Definition: LArFCAL_Base_ID.cxx:65
LArFCAL_Base_ID::m_fcal_impl
IdDictFieldImplementation m_fcal_impl
Definition: LArFCAL_Base_ID.h:219
LArFCAL_Base_ID.icc
LArFCAL_Base_ID::initialize_base_from_dictionary
virtual int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &group_name)
initialization from the identifier dictionary
Definition: LArFCAL_Base_ID.cxx:139
LArFCAL_Base_ID::m_neighbours_3d_next_vec
std::vector< std::set< IdentifierHash > > m_neighbours_3d_next_vec
Definition: LArFCAL_Base_ID.h:232
LArFCAL_Base_ID::operator=
LArFCAL_Base_ID & operator=(const LArFCAL_Base_ID &)
LArFCAL_Base_ID::LArFCAL_Base_ID
LArFCAL_Base_ID(const std::string &name, bool supercell)
Definition: LArFCAL_Base_ID.cxx:18
LArFCAL_Base_ID::mod_begin
id_iterator mod_begin(void) const
begin iterator over set of module Identifiers
LArFCAL_Base_ID::init_neighbours_2d
int init_neighbours_2d(const std::string &filename)
Definition: LArFCAL_Base_ID.h:181
LArFCAL_Base_ID::pos_neg
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
LArFCAL_Base_ID::module_hash_max
size_type module_hash_max(void) const
region hash table max size
LArFCAL_Base_ID::phi_max
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
Definition: LArFCAL_Base_ID.cxx:112
LArID_Exception.h
LArFCAL_Base_ID::module_context
IdContext module_context(void) const
context for modules – method kept for backward compatibility.
Definition: LArFCAL_Base_ID.cxx:134
LArFCAL_Base_ID::mod_range
id_range mod_range() const
Range over full set of FCAL modules.
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
LArFCAL_Base_ID::module
int module(const Identifier id) const
module [1,3]
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LArFCAL_Base_ID::get_neighbours
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,...
Definition: LArFCAL_Base_ID.cxx:537
LArFCAL_Base_ID::channel_id
Identifier channel_id(const Identifier moduleId, int eta, int phi) const
allows to build a channel id starting from a module id (e.g.
LArFCAL_Base_ID::eta_min
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
Definition: LArFCAL_Base_ID.cxx:39
LArFCAL_Base_ID::m_eta_impl
IdDictFieldImplementation m_eta_impl
Definition: LArFCAL_Base_ID.h:222
LArFCAL_Base_ID::module_id
Identifier module_id(const Identifier id) const
allows to know in which region is a channel/cell – valid for both kinds of channels
LArFCAL_Base_ID::mod_end
id_iterator mod_end(void) const
end iterator over set of module Identifiers
LArFCAL_Base_ID::module_id
Identifier module_id(IdentifierHash module_hash_id) const
create module id from hash id
LArFCAL_Base_ID::m_lar_impl
IdDictFieldImplementation m_lar_impl
Definition: LArFCAL_Base_ID.h:218
IdDictRegion
Definition: IdDictRegion.h:20
LArFCAL_Base_ID::size_type
Identifier::size_type size_type
Definition: LArFCAL_Base_ID.h:22
LArFCAL_Base_ID::m_full_channel_range
MultiRange m_full_channel_range
Definition: LArFCAL_Base_ID.h:213
LArFCAL_Base_ID::eta
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
LArFCAL_Base_ID::fcal_range
id_range fcal_range() const
Range over full set of FCAL Identifiers.
CaloIDHelper::size_type
Identifier::size_type size_type
Definition: CaloIDHelper.h:39
LArFCAL_Base_ID::module_id_checks
void module_id_checks(int pos_neg, int module) const
Definition: LArFCAL_Base_ID.cxx:250
LArFCAL_Base_ID::phi
int phi(const Identifier id) const
phi [0,15]
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdDictMgr
Definition: IdDictMgr.h:14
LArFCAL_Base_ID::m_ETA_INDEX
size_type m_ETA_INDEX
Definition: LArFCAL_Base_ID.h:210
LArFCAL_Base_ID::id_iterator
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
Definition: LArFCAL_Base_ID.h:66
LArFCAL_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide acces to channel id vector, accessed via hash
LArFCAL_Base_ID::channel_id_checks
void channel_id_checks(int pos_neg, int module, int eta, int phi) const
Definition: LArFCAL_Base_ID.cxx:265
CaloIDHelper
Base class to factor out code common among Calo ID helpers.
Definition: CaloIDHelper.h:34
LArFCAL_Base_ID::id_range
boost::iterator_range< id_iterator > id_range
Type for range over identifiers.
Definition: LArFCAL_Base_ID.h:68
LArFCAL_Base_ID::init_neighbours_3d_prev
int init_neighbours_3d_prev(const std::string &filename)
Definition: LArFCAL_Base_ID.h:191
LArFCAL_Base_ID::channel_id
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
LArFCAL_Base_ID::module_id
Identifier module_id(int pos_neg, int module) const
build a module identifier for a channel
LArFCAL_Base_ID::m_FCAL_INDEX
size_type m_FCAL_INDEX
Definition: LArFCAL_Base_ID.h:207
mc.group_name
group_name
Definition: mc.PhPy8EG_A14NNPDF23_NNLOPS_example.py:33
LArFCAL_Base_ID::m_full_module_range
MultiRange m_full_module_range
Definition: LArFCAL_Base_ID.h:214
LArFCAL_Base_ID::module_id
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
LArFCAL_Base_ID::channel_id
Identifier channel_id(int pos_neg, int module, int eta, int phi, bool checks) const
LArFCAL_Base_ID::module_id
Identifier module_id(int pos_neg, int module, bool checks) const
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
LArFCAL_Base_ID::channel_id
Identifier channel_id(const Identifier moduleId, int eta, int phi, bool checks) const
LArFCAL_Base_ID::init_hashes
int init_hashes(void)
Definition: LArFCAL_Base_ID.cxx:521
LArFCAL_Base_ID::m_SLAR_INDEX
size_type m_SLAR_INDEX
Definition: LArFCAL_Base_ID.h:206
LArFCAL_Base_ID::m_fcal_region_index
size_type m_fcal_region_index
Definition: LArFCAL_Base_ID.h:204
LArFCAL_Base_ID::m_neighbours_3d_prev_vec
std::vector< std::set< IdentifierHash > > m_neighbours_3d_prev_vec
Definition: LArFCAL_Base_ID.h:233
LArFCAL_Base_ID::module_hash
IdentifierHash module_hash(Identifier module_id) const
create hash id from module id
LArFCAL_Base_ID::m_phi_impl
IdDictFieldImplementation m_phi_impl
Definition: LArFCAL_Base_ID.h:223
LArFCAL_Base_ID::LArFCAL_Base_ID
LArFCAL_Base_ID(const LArFCAL_Base_ID &)
LArFCAL_Base_ID::init_neighbours_from_file
int init_neighbours_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
Definition: LArFCAL_Base_ID.cxx:606
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
LArFCAL_Base_ID::m_vecOfPhiMin
std::vector< short int > m_vecOfPhiMin
Definition: LArFCAL_Base_ID.h:216
CaloIDHelper::name
const std::string & name() const
Return the name for this helper.
IdentifierHash.h
LArFCAL_Base_ID::m_POSNEG_INDEX
size_type m_POSNEG_INDEX
Definition: LArFCAL_Base_ID.h:208
LArFCAL_Base_ID::m_slar
unsigned m_slar
Definition: LArFCAL_Base_ID.h:200
LArFCAL_Base_ID::m_pn_impl
IdDictFieldImplementation m_pn_impl
Definition: LArFCAL_Base_ID.h:220
IdDictFieldImplementation.h
LArFCAL_Base_ID::fcal_begin
id_iterator fcal_begin(void) const
begin iterator over full set of Fcal Identifiers for channels
LArFCAL_Base_ID::init_neighbours_3d_next
int init_neighbours_3d_next(const std::string &filename)
Definition: LArFCAL_Base_ID.h:186
LArFCAL_Base_ID::m_module_impl
IdDictFieldImplementation m_module_impl
Definition: LArFCAL_Base_ID.h:221
LArFCAL_Base_ID::get_expanded_id
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
Definition: LArFCAL_Base_ID.cxx:303
CaloIDHelper::channel_hash
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
LArFCAL_Base_ID::channel_id
Identifier channel_id(int pos_neg, int module, int eta, int phi) const
build a cell identifier for a channel
LArFCAL_Base_ID::m_neighbours_2d_vec
std::vector< std::set< IdentifierHash > > m_neighbours_2d_vec
Definition: LArFCAL_Base_ID.h:231
CaloIDHelper.h
Base class to factor out code common among Calo ID helpers.
LArFCAL_Base_ID::m_MODULE_INDEX
size_type m_MODULE_INDEX
Definition: LArFCAL_Base_ID.h:209
LArFCAL_Base_ID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: LArFCAL_Base_ID.h:161
LArFCAL_Base_ID::phi_min_init
int phi_min_init(const Identifier regId) const
Definition: LArFCAL_Base_ID.cxx:86
LArFCAL_Base_ID::m_PHI_INDEX
size_type m_PHI_INDEX
Definition: LArFCAL_Base_ID.h:211
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
LArFCAL_Base_ID::channel_hash_binary_search
IdentifierHash channel_hash_binary_search(Identifier channelId) const
create hash id from channel id – method NOT optimised, please use channel_hash() above
LArFCAL_Base_ID::fcal_end
id_iterator fcal_end(void) const
end iterator over full set of Fcal Identifiers for channels
Identifier::size_type
unsigned long long size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:29
CaloIDHelper::id_range
boost::iterator_range< id_iterator > id_range
Type for range over identifiers.
Definition: CaloIDHelper.h:44
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloIDHelper::id_iterator
std::vector< Identifier >::const_iterator id_iterator
Type for iterators over identifiers.
Definition: CaloIDHelper.h:42
LArNeighbours.h
LArFCAL_Base_ID::m_LAR_INDEX
size_type m_LAR_INDEX
Definition: LArFCAL_Base_ID.h:205
LArFCAL_Base_ID::is_supercell
bool is_supercell(const Identifier id) const
Test if the identifier represents a supercell.
Definition: LArFCAL_Base_ID.cxx:34
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
LArFCAL_Base_ID::phi_min
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
LArFCAL_Base_ID::m_pn_mod_impl
IdDictFieldImplementation m_pn_mod_impl
Definition: LArFCAL_Base_ID.h:224
LArFCAL_Base_ID::init_neighbours
int init_neighbours(const IdDictMgr &dict_mgr)
Definition: LArFCAL_Base_ID.cxx:683
LArFCAL_Base_ID::m_slar_impl
IdDictFieldImplementation m_slar_impl
Definition: LArFCAL_Base_ID.h:226
LArFCAL_Base_ID::initLevelsFromDict
int initLevelsFromDict(const std::string &group_name)
Definition: LArFCAL_Base_ID.cxx:323
CaloIDHelper::channel_id
Identifier channel_id(IdentifierHash hashId) const
Return the channel (cell) Identifier for a given hash code (no checking).
Identifier
Definition: IdentifierFieldParser.cxx:14