ATLAS Offline Software
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 
12 #ifndef CALODETDESCR_CALODETDESCRMANAGER_H
13 #define CALODETDESCR_CALODETDESCRMANAGER_H
14 
15 #include "AthenaKernel/CLASS_DEF.h"
16 #include "AthenaKernel/CondCont.h"
19 #include <ranges>
20 
23 class CaloDetDescriptor;
24 class CaloCellPacker_400_500_test;
25 
26 class Identifier;
27 class IdentifierHash;
28 class 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  */
43 constexpr 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);
407 
408 private:
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 
468  : public CaloDetDescrManager_Base
469 {
470 public:
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 
481 CLASS_DEF( CaloDetDescrManager , 4548337 , 1 )
483 
485  : public CaloDetDescrManager_Base
486 {
487 public:
488  virtual ~CaloSuperCellDetDescrManager();
489 
492  const CaloCell_SuperCell_ID* getCaloCell_ID() const;
495  void set_helper (const CaloCell_SuperCell_ID* idHelper);
496  void set_helper (const CaloIdManager* idHelper);
497 
498 };
499 
500 
501 CLASS_DEF( CaloSuperCellDetDescrManager , 241807251 , 1 )
503 
504 inline const CaloDetDescrElement*
505 CaloDetDescrManager_Base::get_element (IdentifierHash caloCellHash) const
506 {
507  if ( caloCellHash < m_element_vec.size() )
508  return m_element_vec[caloCellHash] ;
509  else return nullptr ;
510 }
511 
512 inline 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
CaloDetDescrManager_Base::calo_element_vec
std::vector< CaloDetDescrElement * > calo_element_vec
Definition: CaloDetDescrManager.h:180
CaloDetDescrManager_Base::element_range
calo_element_range element_range() const
Range over element vector.
Definition: CaloDetDescrManager.cxx:123
CaloDetDescrManager_Base::m_subCalo_end
std::vector< calo_element_const_iterator > m_subCalo_end
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:441
CaloDetDescrManager_Base::tile_descriptors_size
calo_descr_size tile_descriptors_size() const
number of tile descriptors
Definition: CaloDetDescrManager.cxx:559
CaloDetDescrManager_Base::calo_descriptors_begin
calo_descr_const_iterator calo_descriptors_begin() const
first descriptor in the vector
Definition: CaloDetDescrManager.cxx:517
CaloDetDescrManager_Base::tile_descriptors_begin
calo_descr_const_iterator tile_descriptors_begin() const
first tile descriptor (they are in separate vector)
Definition: CaloDetDescrManager.cxx:547
CaloDetDescrManager_Base::set_helper
void set_helper(const CaloCell_Base_ID *idHelper)
set calo Cell ID helper
Definition: CaloDetDescrManager.cxx:783
CondCont.h
Hold mappings of ranges to condition objects.
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloDetDescrManager_Base::element_end
calo_element_const_iterator element_end() const
end of element vector
Definition: CaloDetDescrManager.cxx:117
CaloDetDescrManager_Base::m_subCalo_max
std::vector< IdentifierHash > m_subCalo_max
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:435
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloDetDescrManager_Base::calo_nonconst_element_range
std::ranges::subrange< calo_nonconst_element_const_iterator > calo_nonconst_element_range
Definition: CaloDetDescrManager.h:187
CaloDetDescrManager_Base::calo_descriptors_range_nonconst
calo_nonconst_descr_range calo_descriptors_range_nonconst()
Range over descriptors, with non-const elements.
Definition: CaloDetDescrManager.cxx:541
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::calo_descriptors_size
calo_descr_size calo_descriptors_size() const
number of descriptors
Definition: CaloDetDescrManager.cxx:529
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
CaloDetDescrManager_Base::calo_descr_vec
std::vector< CaloDetDescriptor * > calo_descr_vec
Definition: CaloDetDescrManager.h:318
CaloDetDescrManager_Base::calo_nonconst_element_const_iterator
calo_element_vec::const_iterator calo_nonconst_element_const_iterator
Definition: CaloDetDescrManager.h:186
CaloDetDescrManager_Base::calo_descr_range
std::ranges::subrange< calo_descr_const_iterator > calo_descr_range
Definition: CaloDetDescrManager.h:321
CaloDetDescrManager_Base
Definition: CaloDetDescrManager.h:145
CaloDetDescrManager_Base::add
void add(CaloDetDescrElement *element)
add Calo DD element to the elements vector
Definition: CaloDetDescrManager.cxx:755
CaloDetDescrManager_Base::calo_nonconst_descr_const_iterator
calo_descr_vec::const_iterator calo_nonconst_descr_const_iterator
Definition: CaloDetDescrManager.h:325
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CaloDetDescrManager_Base::calo_descriptors_end
calo_descr_const_iterator calo_descriptors_end() const
end of descriptors vector
Definition: CaloDetDescrManager.cxx:523
CaloDetDescrManager_Base::set_lar_geometry
void set_lar_geometry(const std::string &geom)
set lar geometry label, distinguish between full atlas and TB
Definition: CaloDetDescrManager.h:169
CaloConstIteratorAdaptor.h
Tranform iterator over pointers to iterator over const pointers.
CaloCell_ID.h
CaloDetDescrManager_Base::build_sample
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:
Definition: CaloDetDescrManager.cxx:1425
CaloDetDescrManager_Base::m_tile_descr_vec
calo_descr_vec m_tile_descr_vec
vector of descriptors
Definition: CaloDetDescrManager.h:445
CaloDetDescrManager_Base::print
void print() const
print out the contents
Definition: CaloDetDescrManager.cxx:79
CaloSuperCellDetDescrManager
Definition: CaloDetDescrManager.h:486
CaloDetDescrManager_Base::CaloDetDescrManager_Base
CaloDetDescrManager_Base()
Default Constructor.
Definition: CaloDetDescrManager.cxx:29
CaloDetDescrManager_Base::lar_geometry
const std::string & lar_geometry() const
get lar geometry label, distinguish between full atlas and TB
Definition: CaloDetDescrManager.h:166
CaloDetDescrManager_Base::isInitialized
bool isInitialized() const
for backwards compatibility only
Definition: CaloDetDescrManager.h:163
CaloDetDescrManager_Base::calo_element_vec_size
calo_element_vec::size_type calo_element_vec_size
Definition: CaloDetDescrManager.h:181
CaloDetDescrManager_Base::calo_element_range
std::ranges::subrange< calo_element_const_iterator > calo_element_range
Definition: CaloDetDescrManager.h:183
CaloDetDescrManager_Base::m_lar_geometry
std::string m_lar_geometry
LAr geometry label (full atlas/TB) for backwards compatibility.
Definition: CaloDetDescrManager.h:449
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
CaloCell_SuperCell_ID
Helper class for offline supercell identifiers.
Definition: CaloCell_SuperCell_ID.h:45
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloDetDescrManager_Base::m_calo_mgr
const CaloIdManager * m_calo_mgr
Calo ID Manager helper.
Definition: CaloDetDescrManager.h:421
CaloDetDescrManager::set_helper
void set_helper(const CaloCell_ID *idHelper)
set calo Cell ID helper
Definition: CaloDetDescrManager.cxx:1596
CaloDetDescrManager_Base::getCaloCell_ID
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:94
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:45
CaloDetDescrManager_Base::CaloCellPacker_400_500_test
friend class CaloCellPacker_400_500_test
Helper for CaloCompactCellTool_test.
Definition: CaloDetDescrManager.h:412
CaloDetDescrManager_Base::element_range_nonconst
calo_nonconst_element_range element_range_nonconst()
Range over element vector, with non-const elements.
Definition: CaloDetDescrManager.cxx:130
CaloDetDescrManager_Base::m_descr_vec
calo_descr_vec m_descr_vec
vector of descriptors
Definition: CaloDetDescrManager.h:428
python.TransformConfig.descr
descr
print "%s.properties()" % self.__name__
Definition: TransformConfig.py:359
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloDetDescrManager_Base::m_subCalo_min
std::vector< IdentifierHash > m_subCalo_min
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:432
CaloDetDescrManager_Base::cellsInZone
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
Definition: CaloDetDescrManager.cxx:793
CaloDetDescrManager_Base::getCalo_Mgr
const CaloIdManager * getCalo_Mgr() const
get calo ID manager
Definition: CaloDetDescrManager.cxx:99
CONDCONT_DEF
CONDCONT_DEF(CaloDetDescrManager, 206559529)
CaloDetDescrManager_Base::add_tile
void add_tile(CaloDetDescriptor *descr)
add tile descriptor to the tile descriptors vector
Definition: CaloDetDescrManager.cxx:771
CaloDetDescrManager_Base::~CaloDetDescrManager_Base
~CaloDetDescrManager_Base()
destructor
Definition: CaloDetDescrManager.cxx:35
CaloDetDescrManager_Base::tile_descriptors_end
calo_descr_const_iterator tile_descriptors_end() const
end of tile descriptors vector
Definition: CaloDetDescrManager.cxx:553
CaloDetDescrManager_Base::element_begin
calo_element_const_iterator element_begin() const
first element
Definition: CaloDetDescrManager.cxx:111
CaloDetDescrManager_Base::get_element_FCAL_raw
const CaloDetDescrElement * get_element_FCAL_raw(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element from raw eta,phi.
Definition: CaloDetDescrManager.cxx:479
CaloDetDescrManager_Base::is_in
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
Definition: CaloDetDescrManager.cxx:1348
CaloDetDescrManager_Base::calo_descriptors_range
calo_descr_range calo_descriptors_range() const
Range over descriptors.
Definition: CaloDetDescrManager.cxx:535
CaloDetDescrManager_Base::calo_descr_size
calo_descr_vec::size_type calo_descr_size
Definition: CaloDetDescrManager.h:319
CaloDetDescrManager_Base::get_element_FCAL
const CaloDetDescrElement * get_element_FCAL(const CaloDetDescriptor *reg, double eta, double phi) const
LArFCAl private methode to get element.
Definition: CaloDetDescrManager.cxx:443
CaloDetDescrManager_Base::get_element_nonconst
CaloDetDescrElement * get_element_nonconst(const Identifier &cellId)
get element by its identifier, non-const version.
Definition: CaloDetDescrManager.cxx:166
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:469
CaloDetDescriptor
This is a base class for LAr and Tile Descriptors The primary goal is to speed up loops over all the ...
Definition: CaloDetDescriptor.h:58
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
CaloDetDescrManager_Base::m_subCalo_begin
std::vector< calo_element_const_iterator > m_subCalo_begin
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:438
CaloDetDescrManager_Base::element_size
calo_element_vec_size element_size() const
total number of elements
Definition: CaloDetDescrManager.cxx:105
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
CaloDetDescrManager_Base::decode_sample
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:
Definition: CaloDetDescrManager.cxx:1468
DetectorZone::barrel
@ barrel
CaloDetDescrManager_Base::tile_descriptors_range_nonconst
calo_nonconst_descr_range tile_descriptors_range_nonconst()
Range over tile descriptors, with non-const elements.
Definition: CaloDetDescrManager.cxx:572
CaloDetDescrManager_Base::tile_descriptors_range
calo_descr_range tile_descriptors_range() const
Range over tile descriptors.
Definition: CaloDetDescrManager.cxx:565
CaloDetDescrManager_Base::release_element
CaloDetDescrElement * release_element(IdentifierHash hash)
Definition: CaloDetDescrManager.cxx:776
CaloDetDescrManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:1590
CaloDetDescrManager_Base::m_element_vec
calo_element_vec m_element_vec
vector of Calo DD elements
Definition: CaloDetDescrManager.h:425
CaloDetDescrManager_Base::initialize
void initialize()
initialization of the manager, used by the Converter when it creates the Manager
Definition: CaloDetDescrManager.cxx:49
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
LArDigits2NtupleDumper.geom
geom
Definition: LArDigits2NtupleDumper.py:150
CaloDetDescrManager_Base::get_element_raw
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)
Definition: CaloDetDescrManager.cxx:349
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition: CaloCell_Base_ID.h:40
CaloDetDescrManager_Base::calo_nonconst_descr_range
std::ranges::subrange< calo_nonconst_descr_const_iterator > calo_nonconst_descr_range
Definition: CaloDetDescrManager.h:326
CaloDetDescrManager_Base::get_descriptor_nonconst
CaloDetDescriptor * get_descriptor_nonconst(const Identifier &regionId)
get descriptor by region identifier, non-const version.
Definition: CaloDetDescrManager.cxx:589
CLASS_DEF.h
macros to associate a CLID to a type
CaloConstIteratorAdaptor
Tranform iterator over pointers to iterator over const pointers.
Definition: CaloConstIteratorAdaptor.h:47
CaloDetDescrManager_Base::m_cell_id
const CaloCell_Base_ID * m_cell_id
Calo Cell ID helper.
Definition: CaloDetDescrManager.h:418
CaloDetDescrManager_Base::get_descriptor_raw
const CaloDetDescriptor * get_descriptor_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
get descriptor by sample, eta and phi raw
Definition: CaloDetDescrManager.cxx:715
CaloDetDescrManager_Base::get_descriptor
const CaloDetDescriptor * get_descriptor(const Identifier &regionId) const
get descriptor by region identifier
Definition: CaloDetDescrManager.cxx:579
Identifier
Definition: IdentifierFieldParser.cxx:14