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-2022 CERN for the benefit of the ATLAS collaboration
4 */
5 
14 #ifndef CALODETDESCR_CALODETDESCRMANAGER_H
15 #define CALODETDESCR_CALODETDESCRMANAGER_H
16 
17 #include "AthenaKernel/CLASS_DEF.h"
18 #include "AthenaKernel/CondCont.h"
21 #include "boost/range/iterator_range.hpp"
22 
25 class CaloDetDescriptor;
26 class CaloCellPacker_400_500_test;
27 
28 class Identifier;
29 class IdentifierHash;
30 class CaloIdManager;
31 
32 /*
33  Detector Store Key for the manager which gets built by one of the clients which
34  still need to access it at initialization. The number of such clients is very limited.
35 
36  If such a manager is built in a simulation job, then at this point the initial set
37  of alignment corrections has already been applied to the GeoModel tree. Therefore these
38  alignments will be applied to the Calo DD too. No more alignment corrections will be
39  applied to the Calo DD through the rest of the simulation job.
40 
41  If one of the clients builds such a manager in some other type of job (e.g., Reconstruction),
42  then at this point no alignment corrections have been applied to Calo DD. Therefore the
43  clients get an ideal Calo DD, which, again, will not change through the rest of the given job.
44  */
45 constexpr static const char* caloMgrStaticKey = "CaloMgrStatic";
46 
147 {
148  public:
155 
158  void initialize();
161  void print() const;
162 
165  inline bool isInitialized() const {return true;}
168  inline const std::string& lar_geometry() const {return m_lar_geometry;}
171  inline void set_lar_geometry(const std::string& geom) { m_lar_geometry = geom;}
172 
175  const CaloCell_Base_ID* getCaloCell_ID() const;
178  const CaloIdManager* getCalo_Mgr() const;
179 
180  // Iterator over detector elements.
181  // Value type is `const CaloDetDescrElement*'.
182  typedef std::vector <CaloDetDescrElement*> calo_element_vec;
183  typedef calo_element_vec::size_type calo_element_vec_size;
186  typedef boost::iterator_range<calo_element_const_iterator> calo_element_range;
187 
188  // Iterator over non-const detector elements.
189  typedef calo_element_vec::const_iterator calo_nonconst_element_const_iterator;
190  typedef boost::iterator_range<calo_nonconst_element_const_iterator> calo_nonconst_element_range;
191 
192 
214 
218 
222  const CaloDetDescrElement* get_element(const Identifier& cellId) const;
230  const CaloDetDescrElement* get_element(IdentifierHash caloCellHash) const;
240  IdentifierHash subCaloCellHash) const;
244  int sampling_or_module,
245  bool barrel,
246  double eta, double phi) const;
250  double eta,
251  double phi) const;
252 
256  double eta,
257  double phi) const;
258 
261  void cellsInZone(double eta_min, double eta_max,
262  double phi_min, double phi_max,
263  std::vector<IdentifierHash> & cell_list) const;
264 
267  void cellsInZone(double eta_min, double eta_max, double phi_min,
268  double phi_max, CaloCell_ID::SUBCALO subCalo,
269  std::vector<IdentifierHash> & cell_list) const;
270 
273  void cellsInZone(double eta_min, double eta_max, double phi_min,
274  double phi_max, CaloCell_ID::CaloSample sample,
275  std::vector<IdentifierHash> & cell_list) const;
276 
279  void cellsInZone(double eta_min, double eta_max,double phi_min,
280  double phi_max, CaloCell_ID::SUBCALO subCalo,
281  int sampling_or_module,
282  std::vector<IdentifierHash> & cell_list) const;
283 
286  void cellsInZone(double eta, double phi, int ncell_eta,
287  int ncell_phi, CaloCell_ID::SUBCALO subCalo,
288  int sampling_or_module, bool barrel,
289  std::vector<IdentifierHash> & cell_list) const;
290 
293  void cellsInZone(double eta_min, double eta_max, double phi_min,
294  double phi_max, const CaloDetDescriptor* descr,
295  std::vector<IdentifierHash> & cell_list) const;
296 
303  bool is_in (double eta, double phi, CaloCell_ID::CaloSample sample, double& etadist) const;
304 
307  static
308  void build_sample (CaloCell_ID::SUBCALO subCalo, bool barrel,
309  int sampling_or_module,
313  static
314  void decode_sample (CaloCell_ID::SUBCALO& subCalo, bool& barrel,
315  int& sampling_or_module,
317 
318 
319  // Iterator over detector descriptors.
320  // Value type is `const CaloDetDescriptor*'.
321  typedef std::vector <CaloDetDescriptor*> calo_descr_vec;
322  typedef calo_descr_vec::size_type calo_descr_size;
325  typedef boost::iterator_range<calo_descr_const_iterator> calo_descr_range;
326 
327 
328  // Iterator over non-const detector descriptors.
329  typedef calo_descr_vec::const_iterator calo_nonconst_descr_const_iterator;
330  typedef boost::iterator_range<calo_nonconst_descr_const_iterator> calo_nonconst_descr_range;
331 
332 
348 
351  const CaloDetDescriptor* get_descriptor (const Identifier& regionId) const;
358  int sampling_or_module,
359  bool barrel,
360  double eta,
361  double phi) const;
365  double eta, double phi) const;
366 
370  double eta, double phi) const;
371 
372 
388 
391  void set_helper (const CaloCell_Base_ID* idHelper);
394  void set_helper (const CaloIdManager* idHelper);
395 
398  void add(CaloDetDescrElement* element);
404  void add(CaloDetDescriptor* descr);
407  void add(std::unique_ptr<CaloDetDescriptor> descr);
411 
412 private:
418 
419 
426 
433 
436  std::vector <IdentifierHash> m_subCalo_min;
439  std::vector <IdentifierHash> m_subCalo_max;
442  std::vector <calo_element_const_iterator> m_subCalo_begin;
445  std::vector <calo_element_const_iterator> m_subCalo_end;
446 
450 
453  std::string m_lar_geometry;
454 
458  double eta,
459  double phi) const;
460 
464  double eta,
465  double phi) const;
466 
467 
468 };
469 
470 
472  : public CaloDetDescrManager_Base
473 {
474 public:
477  const CaloCell_ID* getCaloCell_ID() const;
480  void set_helper (const CaloCell_ID* idHelper);
481  void set_helper (const CaloIdManager* idHelper);
482 
483 };
484 
485 CLASS_DEF( CaloDetDescrManager , 4548337 , 1 )
487 
489  : public CaloDetDescrManager_Base
490 {
491 public:
492  virtual ~CaloSuperCellDetDescrManager();
493 
496  const CaloCell_SuperCell_ID* getCaloCell_ID() const;
499  void set_helper (const CaloCell_SuperCell_ID* idHelper);
500  void set_helper (const CaloIdManager* idHelper);
501 
502 };
503 
504 
505 CLASS_DEF( CaloSuperCellDetDescrManager , 241807251 , 1 )
507 
508 inline const CaloDetDescrElement*
509 CaloDetDescrManager_Base::get_element (IdentifierHash caloCellHash) const
510 {
511  if ( caloCellHash < m_element_vec.size() )
512  return m_element_vec[caloCellHash] ;
513  else return nullptr ;
514 }
515 
516 inline CaloDetDescrElement*
518 {
519  if ( caloCellHash < m_element_vec.size() )
520  return m_element_vec[caloCellHash] ;
521  else return nullptr ;
522 }
523 
524 
525 #endif // CALODETDESCR_CALODETDESCRMANAGER_H
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:445
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:64
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:439
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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_element_range
boost::iterator_range< calo_element_const_iterator > calo_element_range
Definition: CaloDetDescrManager.h:186
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
Definition: CaloDetDescrManager.h:147
CaloDetDescrManager_Base::add
void add(CaloDetDescrElement *element)
add Calo DD element to the elements vector
Definition: CaloDetDescrManager.cxx:755
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
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:171
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:449
CaloDetDescrManager_Base::print
void print() const
print out the contents
Definition: CaloDetDescrManager.cxx:79
CaloSuperCellDetDescrManager
Definition: CaloDetDescrManager.h:490
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:168
CaloDetDescrManager_Base::isInitialized
bool isInitialized() const
for backwards compatibility only
Definition: CaloDetDescrManager.h:165
CaloDetDescrManager_Base::m_lar_geometry
std::string m_lar_geometry
LAr geometry label (full atlas/TB) for backwards compatibility.
Definition: CaloDetDescrManager.h:453
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
CaloDetDescrManager_Base::calo_nonconst_element_range
boost::iterator_range< calo_nonconst_element_const_iterator > calo_nonconst_element_range
Definition: CaloDetDescrManager.h:190
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
CaloCell_SuperCell_ID
Helper class for offline supercell identifiers.
Definition: CaloCell_SuperCell_ID.h:48
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:425
CaloDetDescrManager::set_helper
void set_helper(const CaloCell_ID *idHelper)
set calo Cell ID helper
Definition: CaloDetDescrManager.cxx:1596
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
CaloDetDescrManager_Base::getCaloCell_ID
const CaloCell_Base_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:94
CaloDetDescrManager_Base::calo_element_vec
std::vector< CaloDetDescrElement * > calo_element_vec
Definition: CaloDetDescrManager.h:182
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
CaloDetDescrManager_Base::CaloCellPacker_400_500_test
friend class CaloCellPacker_400_500_test
Helper for CaloCompactCellTool_test.
Definition: CaloDetDescrManager.h:416
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::calo_element_const_iterator
CaloConstIteratorAdaptor< calo_element_vec::const_iterator > calo_element_const_iterator
Definition: CaloDetDescrManager.h:185
CaloDetDescrManager_Base::m_descr_vec
calo_descr_vec m_descr_vec
vector of descriptors
Definition: CaloDetDescrManager.h:432
python.TransformConfig.descr
descr
print "%s.properties()" % self.__name__
Definition: TransformConfig.py:360
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloDetDescrManager_Base::calo_descr_vec
std::vector< CaloDetDescriptor * > calo_descr_vec
Definition: CaloDetDescrManager.h:321
CaloDetDescrManager_Base::m_subCalo_min
std::vector< IdentifierHash > m_subCalo_min
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:436
CaloDetDescrManager_Base::calo_descr_range
boost::iterator_range< calo_descr_const_iterator > calo_descr_range
Definition: CaloDetDescrManager.h:325
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::calo_nonconst_descr_const_iterator
calo_descr_vec::const_iterator calo_nonconst_descr_const_iterator
Definition: CaloDetDescrManager.h:329
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::calo_descr_const_iterator
CaloConstIteratorAdaptor< calo_descr_vec::const_iterator > calo_descr_const_iterator
Definition: CaloDetDescrManager.h:324
CaloDetDescrManager_Base::calo_nonconst_element_const_iterator
calo_element_vec::const_iterator calo_nonconst_element_const_iterator
Definition: CaloDetDescrManager.h:189
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::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_Base::calo_nonconst_descr_range
boost::iterator_range< calo_nonconst_descr_const_iterator > calo_nonconst_descr_range
Definition: CaloDetDescrManager.h:330
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
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:109
CaloDetDescrManager_Base::m_subCalo_begin
std::vector< calo_element_const_iterator > m_subCalo_begin
offsets for subcalo's elements
Definition: CaloDetDescrManager.h:442
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:64
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::calo_descr_size
calo_descr_vec::size_type calo_descr_size
Definition: CaloDetDescrManager.h:322
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:429
CaloDetDescrManager_Base::initialize
void initialize()
initialization of the manager, used by the Converter when it creates the Manager
Definition: CaloDetDescrManager.cxx:49
IdentifierHash
Definition: IdentifierHash.h:38
LArDigits2NtupleDumper.geom
geom
Definition: LArDigits2NtupleDumper.py:133
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:41
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:422
CaloDetDescrManager_Base::calo_element_vec_size
calo_element_vec::size_type calo_element_vec_size
Definition: CaloDetDescrManager.h:183
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