ATLAS Offline Software
CaloGeometry.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_FASTCALOSIMPARAMETRIZATION_CALOGEOMETRY_H
6 #define ISF_FASTCALOSIMPARAMETRIZATION_CALOGEOMETRY_H
7 
8 #include <TMath.h>
9 
10 #include <atomic>
11 #include <vector>
12 #include <map>
13 #include <iostream>
14 
19 #include "LArReadoutGeometry/FCAL_ChannelMap.h"
21 
23 class TCanvas;
24 class TGraph;
25 class TGraphErrors;
26 
27 class CaloGeometry : virtual public ICaloGeometry {
28  public :
29  static const int MAX_SAMPLING;
30 
32  static std::atomic<bool> m_debug;
33 
34  CaloGeometry();
35  virtual ~CaloGeometry();
36 
37  virtual bool PostProcessGeometry();
38 
39  virtual void Validate ATLAS_NOT_THREAD_SAFE (int nrnd=100);
40 
42  virtual const CaloDetDescrElement* getDDE(int sampling, Identifier identify);
43 
44  virtual const CaloDetDescrElement* getDDE(int sampling,float eta,float phi,float* distance=0,int* steps=0);
45  virtual const CaloDetDescrElement* getFCalDDE(int sampling,float x,float y,float z,float* distance=0,int* steps=0);
46  bool getClosestFCalCellIndex(int sampling,float x,float y,int& ieta, int& iphi,int* steps=0);
47 
48  double deta(int sample,double eta) const;
49  void minmaxeta(int sample,double eta,double& mineta,double& maxeta) const;
50  double rzmid(int sample,double eta) const;
51  double rzent(int sample,double eta) const;
52  double rzext(int sample,double eta) const;
53  double rmid(int sample,double eta) const;
54  double rent(int sample,double eta) const;
55  double rext(int sample,double eta) const;
56  double zmid(int sample,double eta) const;
57  double zent(int sample,double eta) const;
58  double zext(int sample,double eta) const;
59  double rpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
60  double zpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
61  double rzpos(int sample,double eta,int subpos = CaloSubPos::SUBPOS_MID) const;
62  bool isCaloBarrel(int sample) const {return m_isCaloBarrel[sample];};
63  static std::string SamplingName(int sample);
64 
65  TGraphErrors* GetGraph(unsigned int sample) const {return m_graph_layers[sample];};
66  void SetDoGraphs(bool dographs=true) {m_dographs=dographs;};
67  bool DoGraphs() const {return m_dographs;};
68 
69  TGraph* DrawGeoSampleForPhi0(int sample, int calocol, bool print=false);
70  TCanvas* DrawGeoForPhi0();
71 
73  void SetFCal_ChannelMap(const FCAL_ChannelMap* fcal_ChannnelMap){m_FCal_ChannelMap=*fcal_ChannnelMap;}
74  void calculateFCalRminRmax();
75  virtual bool checkFCalGeometryConsistency();
76  virtual void PrintMapInfo(int i, int j);
77 
78 #ifdef USE_GPU
79  //needed by the FCS-GPU
80  t_cellmap * get_cells() { return &m_cells ; } ;
81  size_t get_n_regions(int sample ){ return m_cells_in_regions[sample].size() ;} ;
82  size_t get_region_size(int sample, int region ){ return m_cells_in_regions[sample][region]->size() ; } ;
83  int get_tot_regions() {
84  int n=0 ;
85  for (int s =0 ; s<MAX_SAMPLING; ++s) n += m_cells_in_regions[s].size();
86  return n ;
87  }
88  CaloGeometryLookup* get_region(int sample, int region) { return m_cells_in_regions[sample][region] ; } ;
89 #endif
90 
91  protected:
92  virtual void addcell(const CaloDetDescrElement* cell);
93 
94  virtual void post_process(int layer);
95 
96 
97 
98  virtual void InitRZmaps();
99 
101  std::vector< t_cellmap > m_cells_in_sampling;
102  std::vector< t_eta_cellmap > m_cells_in_sampling_for_phi0;
103  std::vector< std::vector< CaloGeometryLookup* > > m_cells_in_regions;
104 
105  std::vector< bool > m_isCaloBarrel;
106  std::vector< double > m_min_eta_sample[2]; //[side][calosample]
107  std::vector< double > m_max_eta_sample[2]; //[side][calosample]
108  std::vector< FSmap< double , double > > m_rmid_map[2]; //[side][calosample]
109  std::vector< FSmap< double , double > > m_zmid_map[2]; //[side][calosample]
110  std::vector< FSmap< double , double > > m_rent_map[2]; //[side][calosample]
111  std::vector< FSmap< double , double > > m_zent_map[2]; //[side][calosample]
112  std::vector< FSmap< double , double > > m_rext_map[2]; //[side][calosample]
113  std::vector< FSmap< double , double > > m_zext_map[2]; //[side][calosample]
114 
116  std::vector< TGraphErrors* > m_graph_layers;
117  FCAL_ChannelMap m_FCal_ChannelMap; // for hit-to-cell assignment in FCal
118  std::vector<double> m_FCal_rmin,m_FCal_rmax;
119 
120 
121  /*
122  double m_min_eta_sample[2][MAX_SAMPLING]; //[side][calosample]
123  double m_max_eta_sample[2][MAX_SAMPLING]; //[side][calosample]
124  FSmap< double , double > m_rmid_map[2][MAX_SAMPLING]; //[side][calosample]
125  FSmap< double , double > m_zmid_map[2][MAX_SAMPLING]; //[side][calosample]
126  FSmap< double , double > m_rent_map[2][MAX_SAMPLING]; //[side][calosample]
127  FSmap< double , double > m_zent_map[2][MAX_SAMPLING]; //[side][calosample]
128  FSmap< double , double > m_rext_map[2][MAX_SAMPLING]; //[side][calosample]
129  FSmap< double , double > m_zext_map[2][MAX_SAMPLING]; //[side][calosample]
130  */
131 };
132 
133 #endif
CaloGeometry::PostProcessGeometry
virtual bool PostProcessGeometry()
Definition: CaloGeometry.cxx:627
CaloGeometry::ATLAS_NOT_THREAD_SAFE
virtual void Validate ATLAS_NOT_THREAD_SAFE(int nrnd=100)
CaloGeometry::m_max_eta_sample
std::vector< double > m_max_eta_sample[2]
Definition: CaloGeometry.h:107
CaloGeometry::post_process
virtual void post_process(int layer)
Definition: CaloGeometry.cxx:121
CaloGeometry::rpos
double rpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition: CaloGeometry.cxx:862
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
CaloGeometry::DrawGeoSampleForPhi0
TGraph * DrawGeoSampleForPhi0(int sample, int calocol, bool print=false)
Definition: CaloGeometry.cxx:349
CaloGeometry::rent
double rent(int sample, double eta) const
Definition: CaloGeometry.cxx:812
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CaloGeometry::MAX_SAMPLING
static const int MAX_SAMPLING
Definition: CaloGeometry.h:29
CaloGeometry::checkFCalGeometryConsistency
virtual bool checkFCalGeometryConsistency()
Definition: CaloGeometry.cxx:922
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloGeometry::m_graph_layers
std::vector< TGraphErrors * > m_graph_layers
Definition: CaloGeometry.h:116
CaloGeometry::m_FCal_rmax
std::vector< double > m_FCal_rmax
Definition: CaloGeometry.h:118
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloGeometry::rzpos
double rzpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition: CaloGeometry.cxx:884
CaloGeometry::isCaloBarrel
bool isCaloBarrel(int sample) const
Definition: CaloGeometry.h:62
CaloGeometry::m_zext_map
std::vector< FSmap< double, double > > m_zext_map[2]
Definition: CaloGeometry.h:113
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
FCAL_ChannelMap
This class contains the tube and tile maps for the FCAL A tile is of a set of FCAL tubes.
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h:34
CaloGeometry::rzmid
double rzmid(int sample, double eta) const
Definition: CaloGeometry.cxx:803
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloGeometry::rzext
double rzext(int sample, double eta) const
Definition: CaloGeometry.cxx:853
CaloGeometry::addcell
virtual void addcell(const CaloDetDescrElement *cell)
Definition: CaloGeometry.cxx:67
CaloGeometry::GetFCAL_ChannelMap
FCAL_ChannelMap * GetFCAL_ChannelMap()
Definition: CaloGeometry.h:72
CaloGeometry::zmid
double zmid(int sample, double eta) const
Definition: CaloGeometry.cxx:795
CaloGeometry::CaloGeometry
CaloGeometry()
Definition: CaloGeometry.cxx:41
CaloGeometry::rext
double rext(int sample, double eta) const
Definition: CaloGeometry.cxx:837
CaloGeometry::m_rent_map
std::vector< FSmap< double, double > > m_rent_map[2]
Definition: CaloGeometry.h:110
x
#define x
CaloGeometry
Definition: CaloGeometry.h:27
CaloGeometry::m_FCal_ChannelMap
FCAL_ChannelMap m_FCal_ChannelMap
Definition: CaloGeometry.h:117
CaloGeometry::zent
double zent(int sample, double eta) const
Definition: CaloGeometry.cxx:820
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
SUBPOS_MID
@ SUBPOS_MID
Definition: FastCaloSim_CaloCell_ID.h:11
CaloGeometry::SamplingName
static std::string SamplingName(int sample)
Definition: CaloGeometry.cxx:900
CaloGeometry::m_rmid_map
std::vector< FSmap< double, double > > m_rmid_map[2]
Definition: CaloGeometry.h:108
CaloGeometry::m_debug_identify
static const Identifier m_debug_identify
Definition: CaloGeometry.h:31
beamspotman.steps
int steps
Definition: beamspotman.py:505
CaloGeometry::getClosestFCalCellIndex
bool getClosestFCalCellIndex(int sampling, float x, float y, int &ieta, int &iphi, int *steps=0)
Definition: CaloGeometry.cxx:592
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:113
CaloGeometry::rzent
double rzent(int sample, double eta) const
Definition: CaloGeometry.cxx:828
CaloGeometry::SetFCal_ChannelMap
void SetFCal_ChannelMap(const FCAL_ChannelMap *fcal_ChannnelMap)
Definition: CaloGeometry.h:73
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
CaloGeometry::m_cells
t_cellmap m_cells
Definition: CaloGeometry.h:100
CaloGeometry::m_rext_map
std::vector< FSmap< double, double > > m_rext_map[2]
Definition: CaloGeometry.h:112
ICaloGeometry
Definition: ICaloGeometry.h:14
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CaloGeometry::m_FCal_rmin
std::vector< double > m_FCal_rmin
Definition: CaloGeometry.h:118
CaloGeometryLookup
Definition: CaloGeometryLookup.h:25
CaloGeometry::m_min_eta_sample
std::vector< double > m_min_eta_sample[2]
Definition: CaloGeometry.h:106
CaloGeometry::DrawGeoForPhi0
TCanvas * DrawGeoForPhi0()
Definition: CaloGeometry.cxx:440
FSmap.h
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
CaloGeometry::m_cells_in_sampling_for_phi0
std::vector< t_eta_cellmap > m_cells_in_sampling_for_phi0
Definition: CaloGeometry.h:102
CaloGeometry::DoGraphs
bool DoGraphs() const
Definition: CaloGeometry.h:67
CaloGeometry::m_debug
static std::atomic< bool > m_debug
Definition: CaloGeometry.h:32
CaloGeometry::m_zmid_map
std::vector< FSmap< double, double > > m_zmid_map[2]
Definition: CaloGeometry.h:109
CaloGeometry::PrintMapInfo
virtual void PrintMapInfo(int i, int j)
Definition: CaloGeometry.cxx:93
CaloGeometry::m_cells_in_sampling
std::vector< t_cellmap > m_cells_in_sampling
Definition: CaloGeometry.h:101
y
#define y
CaloGeometry::getDDE
virtual const CaloDetDescrElement * getDDE(Identifier identify)
Definition: CaloGeometry.cxx:466
CaloGeometry::deta
double deta(int sample, double eta) const
Definition: CaloGeometry.cxx:752
CaloGeometry::SetDoGraphs
void SetDoGraphs(bool dographs=true)
Definition: CaloGeometry.h:66
t_cellmap
std::map< Identifier, const CaloDetDescrElement * > t_cellmap
Definition: CaloGeometryLookup.h:20
CaloGeometry::InitRZmaps
virtual void InitRZmaps()
Definition: CaloGeometry.cxx:197
CaloGeometry::getFCalDDE
virtual const CaloDetDescrElement * getFCalDDE(int sampling, float x, float y, float z, float *distance=0, int *steps=0)
Definition: CaloGeometry.cxx:550
CaloGeometry::m_cells_in_regions
std::vector< std::vector< CaloGeometryLookup * > > m_cells_in_regions
Definition: CaloGeometry.h:103
CaloGeometry::m_zent_map
std::vector< FSmap< double, double > > m_zent_map[2]
Definition: CaloGeometry.h:111
CaloGeometry::zpos
double zpos(int sample, double eta, int subpos=CaloSubPos::SUBPOS_MID) const
Definition: CaloGeometry.cxx:874
CaloGeometry::zext
double zext(int sample, double eta) const
Definition: CaloGeometry.cxx:845
CaloGeometry::rmid
double rmid(int sample, double eta) const
Definition: CaloGeometry.cxx:787
CaloGeometry::GetGraph
TGraphErrors * GetGraph(unsigned int sample) const
Definition: CaloGeometry.h:65
CaloGeometry::calculateFCalRminRmax
void calculateFCalRminRmax()
Definition: CaloGeometry.cxx:905
ICaloGeometry.h
checker_macros.h
Define macros for attributes used to control the static checker.
CaloGeometryLookup.h
CaloGeometry::~CaloGeometry
virtual ~CaloGeometry()
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
CaloGeometry::minmaxeta
void minmaxeta(int sample, double eta, double &mineta, double &maxeta) const
Definition: CaloGeometry.cxx:778
CaloGeometry::m_isCaloBarrel
std::vector< bool > m_isCaloBarrel
Definition: CaloGeometry.h:105
CaloGeometry::m_dographs
bool m_dographs
Definition: CaloGeometry.h:115
MeanAndRMS.h
Identifier
Definition: IdentifierFieldParser.cxx:14