ATLAS Offline Software
TileDetDescrManager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILEDETDESCR_TILEDETDESCRMANAGER_H
6 #define TILEDETDESCR_TILEDETDESCRMANAGER_H
7 
8 #include "GeoModelKernel/GeoVDetectorManager.h"
13 
14 #include <vector>
15 #include <map>
16 #include <cmath>
17 #include <memory>
18 
19 // fwd
20 class TileDddbManager;
21 class TileDetDescrRegion;
22 class TileDetDescriptor;
23 class TileID;
24 class TileHWID;
25 class CaloDetDescriptor;
27 class TileCellDim;
28 class MsgStream;
29 
30 typedef std::shared_ptr<TileDddbManager> TileDddbManager_ptr;
31 
32 class TileDetDescrManager : public GeoVDetectorManager, public AthMessaging
33 {
34 public:
35  // Temporary solution for cell volumes
36  // these numbers are normally overwritten by numbers from GeoModel in releases after 12.0.0
37  static const double vBarrelCells[23];
38  static const double vExtendedCells[12];
39  static const double vItcGapCells[6];
40 
41  // TYPEDEFS
42  typedef std::vector <TileDetDescrRegion*> tile_region_vec;
43  typedef tile_region_vec::size_type tile_region_vec_size;
44  typedef tile_region_vec::const_iterator tile_region_const_iterator;
45 
46  typedef std::vector <TileDetDescriptor*> tile_descr_vec;
47  typedef tile_descr_vec::size_type tile_descr_vec_size;
48  typedef tile_descr_vec::const_iterator tile_descr_const_iterator;
49 
50  typedef std::vector <CaloDetDescriptor*> calo_descr_vec;
51  typedef calo_descr_vec::size_type calo_descr_vec_size;
52  typedef calo_descr_vec::const_iterator calo_descr_const_iterator;
53 
54  typedef std::vector <CaloDetDescrElement*> calo_element_vec;
55  typedef calo_element_vec::size_type calo_element_vec_size;
56  typedef calo_element_vec::const_iterator calo_element_const_iterator;
57 
58  typedef std::map <unsigned int, TileDetDescrRegion*, std::less<unsigned int> > tile_region_map;
59  typedef std::map <unsigned int, CaloDetDescriptor*, std::less<int> > scalo_descr_map;
60  typedef std::map <unsigned int, CaloDetDescriptor*, std::less<unsigned int> > calo_descr_map;
61  typedef std::map <unsigned int, CaloDetDescrElement*, std::less<unsigned int> > calo_element_map;
62  typedef std::map <unsigned int, TileCellDim*, std::less<unsigned int> > cell_dim_map;
63 
64  // --------------- TYPEDEFS
65 
68 
69  // Access to raw geometry:
70  virtual unsigned int getNumTreeTops() const override;
71  virtual PVConstLink getTreeTop(unsigned int i) const override;
72 
73  void addTreeTop(PVConstLink); // Add a Tree top:
74 
75  // ---------------- Access to raw geometry:
76 
77  // Access to TileDddbManager object
79  // Release Db manager
80  void releaseDbManager();
81 
82  // -------------- Readout geometry ---------------------
83 
84  // Access to Tile Regions
85  TileDetDescrRegion* find_tile_region(const Identifier& region_id) const // Region find()
86  { tile_region_map::const_iterator it = m_tile_region_map.find(region_id.get_identifier32().get_compact());
87  if (it != m_tile_region_map.end() ) return (*it).second; else return NULL;
88  }
89 
91  { return m_tile_region_vec.begin(); }
92 
94  { return m_tile_region_vec.end(); }
95 
97  { return m_tile_region_vec.size(); }
98 
99 
100  // Access to Tile Descriptors
102  { return m_tile_descr_vec.begin(); }
103 
105  { return m_tile_descr_vec.end(); }
106 
108  { return m_tile_descr_vec.size(); }
109 
110 
111  // Access to Calo Descriptors
113  { return m_calo_descr_vec.begin(); }
114 
116  { return m_calo_descr_vec.end(); }
117 
119  { return m_calo_descr_vec.size(); }
120 
122  { scalo_descr_map::const_iterator it = m_calo_descr_map.find((int)sample*side);
123  if (it != m_calo_descr_map.end() ) return (*it).second; else return NULL;
124  }
125 
126 
127  // Access to Tile Modules
129  { return m_tile_module_vec.begin(); }
130 
132  { return m_tile_module_vec.end(); }
133 
135  { return m_tile_module_vec.size(); }
136 
137  CaloDetDescriptor* get_module_element(const IdentifierHash module_hash) const // GetElement (Hash)
138  { return m_tile_module_vec[(unsigned int)module_hash]; }
139 
140  CaloDetDescriptor* get_module_element(const Identifier& module_id) const // GetElement (ID)
141  { calo_descr_map::const_iterator it = m_tile_module_map.find(module_id.get_identifier32().get_compact());
142  if (it != m_tile_module_map.end() ) return (*it).second; else return NULL;
143  }
144 
145 
146  // Access to Tile Cells
148  { return m_tile_cell_vec.begin(); }
149 
151  { return m_tile_cell_vec.end(); }
152 
154  { return m_tile_cell_vec.size(); }
155 
156  CaloDetDescrElement* get_cell_element(unsigned int cell_hash) const // GetCell (CellHash)
157  { return m_tile_cell_vec[cell_hash]; }
158 
159  CaloDetDescrElement* get_cell_element(const IdentifierHash cell_hash) const // GetCell (Hash)
160  { return m_tile_cell_vec[(unsigned int)cell_hash]; }
161 
162  CaloDetDescrElement* get_cell_element(const Identifier& cell_id) const // GetCell (ID)
163  { calo_element_map::const_iterator it = m_tile_cell_map.find(cell_id.get_identifier32().get_compact());
164  if (it != m_tile_cell_map.end() ) return (*it).second; else return NULL;
165  }
166 
167 
168  // Access TileCellDim-s
169  TileCellDim* get_cell_dim(const Identifier& cell_id) const;
170 
171  // Access to IdHelpers
172  const TileID* get_id() const { return m_tile_id;}
173  const TileHWID* get_hwid() const { return m_tile_hwid;}
174 
175  // Print
176  void print() const;
177 
178  // Create elements
179  void create_elements();
180  void create_elements(bool checks);
181 
182  // Insertion
183  void add(TileDetDescrRegion* region);
184  void add(TileDetDescriptor* descriptor);
185  void add_calodescr(CaloDetDescriptor* descriptor);
188  void add_cellDim(int section, int side, int tower, int sample, TileCellDim* cellDim);
189 
190  void set_helper(const TileID* id){ m_tile_id = id; }
191  void set_helper(const CaloCell_ID* id){ m_cell_id = id; }
192  void set_helper(const TileHWID* id){ m_tile_hwid = id; }
193 
194 private:
197 
198  // Delete regions and descriptors
199  void clear();
200 
201  // ----------- Data members -------------
202 
203  // Tree Tops
204  std::vector<PVConstLink> m_treeTops;
205 
206  // DB Manager
208 
210 
214 
218 
219  // calo descriptors : 1 map for CaloSample*sign and one unsorted vector
222 
223  // modules : 1 map for compact id, 1 vector for hashed
226 
227  // cells : 1 map for compact id, 1 vector for hashed
230 
232 
233  // z-shift operator-function definitions:
234  inline double shiftEta(double eta, double Rcen, double zshift) {
235  return eta + zshift * tanh(eta) * tan(2 * atan(exp(-eta))) / Rcen;
236  }
237 };
238 
239 #ifndef GAUDI_NEUTRAL
240 #include "AthenaKernel/CLASS_DEF.h"
242 #endif
243 
244 
245 #endif
246 
TileDetDescrManager::tile_descriptors_begin
tile_descr_const_iterator tile_descriptors_begin() const
Definition: TileDetDescrManager.h:101
TileDetDescrManager::get_cell_dim
TileCellDim * get_cell_dim(const Identifier &cell_id) const
Definition: TileDetDescrManager.cxx:952
TileDetDescrManager::add_cellDim
void add_cellDim(int section, int side, int tower, int sample, TileCellDim *cellDim)
Definition: TileDetDescrManager.cxx:946
TileDddbManager_ptr
std::shared_ptr< TileDddbManager > TileDddbManager_ptr
Definition: TileDetDescrManager.h:28
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
TileDetDescrManager::set_helper
void set_helper(const TileHWID *id)
Definition: TileDetDescrManager.h:192
TileDetDescrManager::calo_descriptors_size
calo_descr_vec_size calo_descriptors_size() const
Definition: TileDetDescrManager.h:118
TileDetDescrManager::m_cell_id
const CaloCell_ID * m_cell_id
Definition: TileDetDescrManager.h:212
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TileDetDescrManager::cell_dim_map
std::map< unsigned int, TileCellDim *, std::less< unsigned int > > cell_dim_map
Definition: TileDetDescrManager.h:62
TileDetDescrManager::m_tile_cell_map
calo_element_map m_tile_cell_map
Definition: TileDetDescrManager.h:229
TileDetDescrManager::add_cell
void add_cell(CaloDetDescrElement *cell)
Definition: TileDetDescrManager.cxx:939
TileDetDescrManager::tile_descriptors_size
tile_descr_vec_size tile_descriptors_size() const
Definition: TileDetDescrManager.h:107
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TileDetDescrManager::addTreeTop
void addTreeTop(PVConstLink)
Definition: TileDetDescrManager.cxx:88
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TileDetDescrManager::calo_descr_vec
std::vector< CaloDetDescriptor * > calo_descr_vec
Definition: TileDetDescrManager.h:50
TileDetDescrManager::m_tile_region_vec
tile_region_vec m_tile_region_vec
Definition: TileDetDescrManager.h:215
TileDetDescrManager::print
void print() const
Definition: TileDetDescrManager.cxx:105
TileDetDescrManager::create_elements
void create_elements()
Definition: TileDetDescrManager.cxx:139
TileDetDescrManager::m_tile_region_map
tile_region_map m_tile_region_map
Definition: TileDetDescrManager.h:216
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TileDetDescrManager::calo_element_vec_size
calo_element_vec::size_type calo_element_vec_size
Definition: TileDetDescrManager.h:55
TileDetDescrManager::tile_descriptors_end
tile_descr_const_iterator tile_descriptors_end() const
Definition: TileDetDescrManager.h:104
TileDetDescrManager::tile_region_vec_size
tile_region_vec::size_type tile_region_vec_size
Definition: TileDetDescrManager.h:43
CalibDbCompareRT.region_id
region_id
Definition: CalibDbCompareRT.py:68
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
CaloCell_ID.h
TileDetDescrManager::m_calo_descr_vec
calo_descr_vec m_calo_descr_vec
Definition: TileDetDescrManager.h:220
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TileDetDescrManager::m_cell_dim_map
cell_dim_map m_cell_dim_map
Definition: TileDetDescrManager.h:231
TileCellDim
Definition: TileCellDim.h:19
TileDetDescrManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const override
Definition: TileDetDescrManager.cxx:79
TileDetDescrManager::m_calo_descr_map
scalo_descr_map m_calo_descr_map
Definition: TileDetDescrManager.h:221
TileDetDescrManager::m_treeTops
std::vector< PVConstLink > m_treeTops
Definition: TileDetDescrManager.h:204
python.PyAthena.module
module
Definition: PyAthena.py:131
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileDetDescrManager::vExtendedCells
static const double vExtendedCells[12]
Definition: TileDetDescrManager.h:38
TileDetDescrManager::tile_cell_size
calo_element_vec_size tile_cell_size() const
Definition: TileDetDescrManager.h:153
TileDetDescrManager::tile_cell_begin
calo_element_const_iterator tile_cell_begin() const
Definition: TileDetDescrManager.h:147
TileDetDescrManager::m_tile_module_vec
calo_descr_vec m_tile_module_vec
Definition: TileDetDescrManager.h:224
TileDetDescrManager::get_hwid
const TileHWID * get_hwid() const
Definition: TileDetDescrManager.h:173
TileDetDescrManager::TileDetDescrManager
TileDetDescrManager(TileDddbManager_ptr dbManager)
Z-shift for ext.barrel introduced with Z-shift > 0, eta coordinate of the cell is shifted by Deta = t...
Definition: TileDetDescrManager.cxx:57
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
TileDetDescrManager::vBarrelCells
static const double vBarrelCells[23]
Definition: TileDetDescrManager.h:37
TileDetDescrManager
Definition: TileDetDescrManager.h:33
TileDetDescrManager::add_module
void add_module(IdentifierHash idhash, CaloDetDescriptor *module)
Definition: TileDetDescrManager.cxx:933
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
TileDetDescrManager::getNumTreeTops
virtual unsigned int getNumTreeTops() const override
Definition: TileDetDescrManager.cxx:74
TileDetDescrRegion
Definition: TileDetDescrRegion.h:40
TileDetDescrRegion.h
TileDetDescriptor
Definition: TileDetDescriptor.h:46
TileDetDescrManager::get_module_element
CaloDetDescriptor * get_module_element(const IdentifierHash module_hash) const
Definition: TileDetDescrManager.h:137
TileDetDescrManager::set_helper
void set_helper(const TileID *id)
Definition: TileDetDescrManager.h:190
TileDetDescrManager::m_tile_cell_vec
calo_element_vec m_tile_cell_vec
Definition: TileDetDescrManager.h:228
TileDetDescrManager::calo_element_vec
std::vector< CaloDetDescrElement * > calo_element_vec
Definition: TileDetDescrManager.h:54
TileDetDescrManager::find_tile_region
TileDetDescrRegion * find_tile_region(const Identifier &region_id) const
Definition: TileDetDescrManager.h:85
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
TileDetDescrManager::tile_cell_end
calo_element_const_iterator tile_cell_end() const
Definition: TileDetDescrManager.h:150
TileDetDescrManager::vItcGapCells
static const double vItcGapCells[6]
Definition: TileDetDescrManager.h:39
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
TileDetDescrManager::calo_descriptors_end
calo_descr_const_iterator calo_descriptors_end() const
Definition: TileDetDescrManager.h:115
TileDetDescrManager::get_calo_descriptor
CaloDetDescriptor * get_calo_descriptor(CaloCell_ID::CaloSample sample, int side) const
Definition: TileDetDescrManager.h:121
TileDetDescrManager::tile_module_end
calo_descr_const_iterator tile_module_end() const
Definition: TileDetDescrManager.h:131
TileDetDescrManager::calo_element_map
std::map< unsigned int, CaloDetDescrElement *, std::less< unsigned int > > calo_element_map
Definition: TileDetDescrManager.h:61
TileDetDescrManager::m_elements_created
bool m_elements_created
Definition: TileDetDescrManager.h:209
TileDetDescrManager::m_dbManager
TileDddbManager_ptr m_dbManager
Definition: TileDetDescrManager.h:207
TileDetDescrManager::calo_descr_const_iterator
calo_descr_vec::const_iterator calo_descr_const_iterator
Definition: TileDetDescrManager.h:52
TileDetDescrManager::tile_descr_vec_size
tile_descr_vec::size_type tile_descr_vec_size
Definition: TileDetDescrManager.h:47
TileDetDescrManager::get_cell_element
CaloDetDescrElement * get_cell_element(unsigned int cell_hash) const
Definition: TileDetDescrManager.h:156
TileDetDescrManager::shiftEta
double shiftEta(double eta, double Rcen, double zshift)
Definition: TileDetDescrManager.h:234
TileDetDescrManager::add_calodescr
void add_calodescr(CaloDetDescriptor *descriptor)
Definition: TileDetDescrManager.cxx:905
TileDetDescrManager::tile_region_begin
tile_region_const_iterator tile_region_begin() const
Definition: TileDetDescrManager.h:90
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
TileDetDescrManager::get_cell_element
CaloDetDescrElement * get_cell_element(const IdentifierHash cell_hash) const
Definition: TileDetDescrManager.h:159
IdentifierHash.h
TileDetDescrManager::tile_region_const_iterator
tile_region_vec::const_iterator tile_region_const_iterator
Definition: TileDetDescrManager.h:44
TileDetDescrManager::tile_module_begin
calo_descr_const_iterator tile_module_begin() const
Definition: TileDetDescrManager.h:128
TileDetDescrManager::~TileDetDescrManager
~TileDetDescrManager()
Definition: TileDetDescrManager.cxx:68
TileDetDescrManager::add
void add(TileDetDescrRegion *region)
Definition: TileDetDescrManager.cxx:894
TileDetDescrManager::m_tile_id
const TileID * m_tile_id
Definition: TileDetDescrManager.h:211
TileDetDescrManager::tile_region_size
tile_region_vec_size tile_region_size() const
Definition: TileDetDescrManager.h:96
TileDetDescrManager::tile_descr_const_iterator
tile_descr_vec::const_iterator tile_descr_const_iterator
Definition: TileDetDescrManager.h:48
TileDetDescrManager::get_module_element
CaloDetDescriptor * get_module_element(const Identifier &module_id) const
Definition: TileDetDescrManager.h:140
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
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
AthMessaging.h
TileDetDescrManager::tile_region_end
tile_region_const_iterator tile_region_end() const
Definition: TileDetDescrManager.h:93
TileDetDescrManager::get_cell_element
CaloDetDescrElement * get_cell_element(const Identifier &cell_id) const
Definition: TileDetDescrManager.h:162
TileDetDescrManager::getDbManager
TileDddbManager * getDbManager() const
Definition: TileDetDescrManager.cxx:94
TileDetDescrManager::calo_element_const_iterator
calo_element_vec::const_iterator calo_element_const_iterator
Definition: TileDetDescrManager.h:56
TileDetDescrManager::clear
void clear()
Definition: TileDetDescrManager.cxx:968
TileDetDescrManager::tile_descr_vec
std::vector< TileDetDescriptor * > tile_descr_vec
Definition: TileDetDescrManager.h:46
TileDetDescrManager::m_tile_module_map
calo_descr_map m_tile_module_map
Definition: TileDetDescrManager.h:225
TileDetDescrManager::tile_region_map
std::map< unsigned int, TileDetDescrRegion *, std::less< unsigned int > > tile_region_map
Definition: TileDetDescrManager.h:58
TileDetDescrManager::releaseDbManager
void releaseDbManager()
Definition: TileDetDescrManager.cxx:100
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
section
void section(const std::string &sec)
Definition: TestTriggerMenuAccess.cxx:22
TileDetDescrManager::calo_descr_vec_size
calo_descr_vec::size_type calo_descr_vec_size
Definition: TileDetDescrManager.h:51
TileDetDescrManager::calo_descriptors_begin
calo_descr_const_iterator calo_descriptors_begin() const
Definition: TileDetDescrManager.h:112
TileDddbManager
This class provides access to constants in the Geometry DB.
Definition: TileDddbManager.h:38
TileDetDescrManager::m_tile_hwid
const TileHWID * m_tile_hwid
Definition: TileDetDescrManager.h:213
TileDetDescrManager::m_tile_descr_vec
tile_descr_vec m_tile_descr_vec
Definition: TileDetDescrManager.h:217
TileDetDescrManager::operator=
const TileDetDescrManager & operator=(const TileDetDescrManager &right)
CLASS_DEF.h
macros to associate a CLID to a type
TileDetDescrManager::calo_descr_map
std::map< unsigned int, CaloDetDescriptor *, std::less< unsigned int > > calo_descr_map
Definition: TileDetDescrManager.h:60
TileDetDescrManager::set_helper
void set_helper(const CaloCell_ID *id)
Definition: TileDetDescrManager.h:191
TileDetDescrManager::tile_region_vec
std::vector< TileDetDescrRegion * > tile_region_vec
Definition: TileDetDescrManager.h:42
TileDetDescrManager::TileDetDescrManager
TileDetDescrManager(const TileDetDescrManager &right)
TileDetDescrManager::scalo_descr_map
std::map< unsigned int, CaloDetDescriptor *, std::less< int > > scalo_descr_map
Definition: TileDetDescrManager.h:59
TileDetDescrManager::tile_module_size
calo_descr_vec_size tile_module_size() const
Definition: TileDetDescrManager.h:134
TileDetDescrManager::get_id
const TileID * get_id() const
Definition: TileDetDescrManager.h:172
Identifier
Definition: IdentifierFieldParser.cxx:14