ATLAS Offline Software
Loading...
Searching...
No Matches
CaloDetDescrManager.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*/
5
11
12#ifndef CALODETDESCR_CALODETDESCRMANAGER_H
13#define CALODETDESCR_CALODETDESCRMANAGER_H
14
19#include <ranges>
20
24class CaloCellPacker_400_500_test;
25
26class Identifier;
27class IdentifierHash;
28class CaloIdManager;
29
30/*
31 Detector Store Key for the manager which gets built by one of the clients which
32 still need to access it at initialization. The number of such clients is very limited.
33
34 If such a manager is built in a simulation job, then at this point the initial set
35 of alignment corrections has already been applied to the GeoModel tree. Therefore these
36 alignments will be applied to the Calo DD too. No more alignment corrections will be
37 applied to the Calo DD through the rest of the simulation job.
38
39 If one of the clients builds such a manager in some other type of job (e.g., Reconstruction),
40 then at this point no alignment corrections have been applied to Calo DD. Therefore the
41 clients get an ideal Calo DD, which, again, will not change through the rest of the given job.
42 */
43constexpr static const char* caloMgrStaticKey = "CaloMgrStatic";
44
145{
146 public:
153
156 void initialize();
159 void print() const;
160
163 inline bool isInitialized() const {return true;}
166 inline const std::string& lar_geometry() const {return m_lar_geometry;}
169 inline void set_lar_geometry(const std::string& geom) { m_lar_geometry = geom;}
170
173 const CaloCell_Base_ID* getCaloCell_ID() const;
176 const CaloIdManager* getCalo_Mgr() const;
177
178 // Iterator over detector elements.
179 // Value type is `const CaloDetDescrElement*'.
180 using calo_element_vec = std::vector<CaloDetDescrElement*>;
181 using calo_element_vec_size = calo_element_vec::size_type;
183 using calo_element_range = std::ranges::subrange<calo_element_const_iterator>;
184
185 // Iterator over non-const detector elements.
186 using calo_nonconst_element_const_iterator = calo_element_vec::const_iterator;
187 using calo_nonconst_element_range = std::ranges::subrange<calo_nonconst_element_const_iterator>;
188
189
211
215
219 const CaloDetDescrElement* get_element(const Identifier& cellId) const;
227 const CaloDetDescrElement* get_element(IdentifierHash caloCellHash) const;
237 IdentifierHash subCaloCellHash) const;
241 int sampling_or_module,
242 bool barrel,
243 double eta, double phi) const;
247 double eta,
248 double phi) const;
249
253 double eta,
254 double phi) const;
255
258 void cellsInZone(double eta_min, double eta_max,
259 double phi_min, double phi_max,
260 std::vector<IdentifierHash> & cell_list) const;
261
264 void cellsInZone(double eta_min, double eta_max, double phi_min,
265 double phi_max, CaloCell_ID::SUBCALO subCalo,
266 std::vector<IdentifierHash> & cell_list) const;
267
270 void cellsInZone(double eta_min, double eta_max, double phi_min,
271 double phi_max, CaloCell_ID::CaloSample sample,
272 std::vector<IdentifierHash> & cell_list) const;
273
276 void cellsInZone(double eta_min, double eta_max,double phi_min,
277 double phi_max, CaloCell_ID::SUBCALO subCalo,
278 int sampling_or_module,
279 std::vector<IdentifierHash> & cell_list) const;
280
283 void cellsInZone(double eta, double phi, int ncell_eta,
284 int ncell_phi, CaloCell_ID::SUBCALO subCalo,
285 int sampling_or_module, bool barrel,
286 std::vector<IdentifierHash> & cell_list) const;
287
290 void cellsInZone(double eta_min, double eta_max, double phi_min,
291 double phi_max, const CaloDetDescriptor* descr,
292 std::vector<IdentifierHash> & cell_list) const;
293
300 bool is_in (double eta, double phi, CaloCell_ID::CaloSample sample, double& etadist) const;
301
304 static
305 void build_sample (CaloCell_ID::SUBCALO subCalo, bool barrel,
306 int sampling_or_module,
310 static
311 void decode_sample (CaloCell_ID::SUBCALO& subCalo, bool& barrel,
312 int& sampling_or_module,
314
315
316 // Iterator over detector descriptors.
317 // Value type is `const CaloDetDescriptor*'.
318 using calo_descr_vec = std::vector <CaloDetDescriptor*>;
319 using calo_descr_size = calo_descr_vec::size_type;
321 using calo_descr_range = std::ranges::subrange<calo_descr_const_iterator>;
322
323
324 // Iterator over non-const detector descriptors.
325 using calo_nonconst_descr_const_iterator = calo_descr_vec::const_iterator;
326 using calo_nonconst_descr_range = std::ranges::subrange<calo_nonconst_descr_const_iterator>;
327
328
344
347 const CaloDetDescriptor* get_descriptor (const Identifier& regionId) const;
354 int sampling_or_module,
355 bool barrel,
356 double eta,
357 double phi) const;
361 double eta, double phi) const;
362
366 double eta, double phi) const;
367
368
384
387 void set_helper (const CaloCell_Base_ID* idHelper);
390 void set_helper (const CaloIdManager* idHelper);
391
394 void add(CaloDetDescrElement* element);
400 void add(CaloDetDescriptor* descr);
403 void add(std::unique_ptr<CaloDetDescriptor> descr);
406 void add_tile(CaloDetDescriptor* descr);
407
408private:
414
415
422
429
432 std::vector <IdentifierHash> m_subCalo_min;
435 std::vector <IdentifierHash> m_subCalo_max;
438 std::vector <calo_element_const_iterator> m_subCalo_begin;
441 std::vector <calo_element_const_iterator> m_subCalo_end;
442
446
449 std::string m_lar_geometry;
450
454 double eta,
455 double phi) const;
456
460 double eta,
461 double phi) const;
462
463
464};
465
466
469{
470public:
473 const CaloCell_ID* getCaloCell_ID() const;
476 void set_helper (const CaloCell_ID* idHelper);
477 void set_helper (const CaloIdManager* idHelper);
478
479};
480
481CLASS_DEF( CaloDetDescrManager , 4548337 , 1 )
483
486{
487public:
489
495 void set_helper (const CaloCell_SuperCell_ID* idHelper);
496 void set_helper (const CaloIdManager* idHelper);
497
498};
499
500
503
506{
507 if ( caloCellHash < m_element_vec.size() )
508 return m_element_vec[caloCellHash] ;
509 else return nullptr ;
510}
511
512inline CaloDetDescrElement*
514{
515 if ( caloCellHash < m_element_vec.size() )
516 return m_element_vec[caloCellHash] ;
517 else return nullptr ;
518}
519
520
521#endif // CALODETDESCR_CALODETDESCRMANAGER_H
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Tranform iterator over pointers to iterator over const pointers.
static constexpr const char * caloMgrStaticKey
Hold mappings of ranges to condition objects.
#define CONDCONT_DEF(...)
Definition CondCont.h:1413
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Helper base class for offline cell identifiers.
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
Helper class for offline supercell identifiers.
Tranform iterator over pointers to iterator over const pointers.
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element_FCAL_raw(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element from raw eta,phi.
static void build_sample(CaloCell_ID::SUBCALO subCalo, bool barrel, int sampling_or_module, CaloCell_ID::CaloSample &sample)
translate between the 2 ways to label a sub-detector:
CaloDetDescriptor * get_descriptor_nonconst(const Identifier &regionId)
get descriptor by region identifier, non-const version.
CaloDetDescrElement * get_element_nonconst(const Identifier &cellId)
get element by its identifier, non-const version.
calo_element_const_iterator element_begin() const
first element
const std::string & lar_geometry() const
get lar geometry label, distinguish between full atlas and TB
std::ranges::subrange< calo_nonconst_element_const_iterator > calo_nonconst_element_range
calo_descr_const_iterator calo_descriptors_end() const
end of descriptors vector
calo_descr_const_iterator tile_descriptors_end() const
end of tile descriptors vector
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
calo_nonconst_element_range element_range_nonconst()
Range over element vector, with non-const elements.
std::string m_lar_geometry
LAr geometry label (full atlas/TB) for backwards compatibility.
std::vector< calo_element_const_iterator > m_subCalo_begin
offsets for subcalo's elements
void add_tile(CaloDetDescriptor *descr)
add tile descriptor to the tile descriptors vector
calo_descr_const_iterator tile_descriptors_begin() const
first tile descriptor (they are in separate vector)
CaloConstIteratorAdaptor< calo_element_vec::const_iterator > calo_element_const_iterator
calo_descr_vec::const_iterator calo_nonconst_descr_const_iterator
bool isInitialized() const
for backwards compatibility only
std::vector< IdentifierHash > m_subCalo_min
offsets for subcalo's elements
const CaloDetDescriptor * get_descriptor_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
get descriptor by sample, eta and phi raw
CaloDetDescrElement * release_element(IdentifierHash hash)
calo_element_const_iterator element_end() const
end of element vector
std::vector< CaloDetDescriptor * > calo_descr_vec
void set_helper(const CaloCell_Base_ID *idHelper)
set calo Cell ID helper
std::vector< calo_element_const_iterator > m_subCalo_end
offsets for subcalo's elements
std::ranges::subrange< calo_element_const_iterator > calo_element_range
const CaloDetDescrElement * get_element_FCAL(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element.
const CaloIdManager * m_calo_mgr
Calo ID Manager helper.
calo_descr_size tile_descriptors_size() const
number of tile descriptors
std::vector< CaloDetDescrElement * > calo_element_vec
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper
calo_nonconst_descr_range calo_descriptors_range_nonconst()
Range over descriptors, with non-const elements.
friend class CaloCellPacker_400_500_test
Helper for CaloCompactCellTool_test.
void add(CaloDetDescrElement *element)
add Calo DD element to the elements vector
calo_descr_size calo_descriptors_size() const
number of descriptors
calo_descr_vec m_descr_vec
vector of descriptors
calo_element_vec::const_iterator calo_nonconst_element_const_iterator
const CaloIdManager * getCalo_Mgr() const
get calo ID manager
void initialize()
initialization of the manager, used by the Converter when it creates the Manager
calo_nonconst_descr_range tile_descriptors_range_nonconst()
Range over tile descriptors, with non-const elements.
void set_lar_geometry(const std::string &geom)
set lar geometry label, distinguish between full atlas and TB
const CaloDetDescriptor * get_descriptor(const Identifier &regionId) const
get descriptor by region identifier
calo_element_vec::size_type calo_element_vec_size
static void decode_sample(CaloCell_ID::SUBCALO &subCalo, bool &barrel, int &sampling_or_module, CaloCell_ID::CaloSample sample)
translate between the 2 ways to label a sub-detector:
calo_element_range element_range() const
Range over element vector.
calo_descr_const_iterator calo_descriptors_begin() const
first descriptor in the vector
std::ranges::subrange< calo_nonconst_descr_const_iterator > calo_nonconst_descr_range
calo_element_vec m_element_vec
vector of Calo DD elements
const CaloDetDescrElement * get_element_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
Get element from raw quantities (to build real fixed size clusters)
calo_descr_vec::size_type calo_descr_size
const CaloCell_Base_ID * m_cell_id
Calo Cell ID helper.
void cellsInZone(double eta_min, double eta_max, double phi_min, double phi_max, std::vector< IdentifierHash > &cell_list) const
the only client is CaloCellList class
calo_descr_range calo_descriptors_range() const
Range over descriptors.
calo_element_vec_size element_size() const
total number of elements
void print() const
print out the contents
CaloConstIteratorAdaptor< calo_descr_vec::const_iterator > calo_descr_const_iterator
calo_descr_vec m_tile_descr_vec
vector of descriptors
std::ranges::subrange< calo_descr_const_iterator > calo_descr_range
calo_descr_range tile_descriptors_range() const
Range over tile descriptors.
CaloDetDescrManager_Base()
Default Constructor.
bool is_in(double eta, double phi, CaloCell_ID::CaloSample sample, double &etadist) const
return true if direction eta,phi crosses ANY of the corresponding descriptors
std::vector< IdentifierHash > m_subCalo_max
offsets for subcalo's elements
This class provides the client interface for accessing the detector description information common to...
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
void set_helper(const CaloCell_ID *idHelper)
set calo Cell ID helper
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
This class initializes the Calo (LAr and Tile) offline identifiers.
void set_helper(const CaloCell_SuperCell_ID *idHelper)
set calo Cell ID helper
const CaloCell_SuperCell_ID * getCaloCell_ID() const
get calo cell ID helper
This is a "hash" representation of an Identifier.