ATLAS Offline Software
CaloGeometryLookup.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_CALOGEOMETRYLOOKUP_H
6 #define ISF_FASTCALOSIMPARAMETRIZATION_CALOGEOMETRYLOOKUP_H
7 
8 #include <TMath.h>
9 
10 #include <vector>
11 #include <map>
12 #include <iostream>
13 
14 //#include "ISF_FastCaloSimEvent/ICaloGeometry.h"
17 
19 class TCanvas;
20 class TGraphErrors;
21 
22 typedef std::map< Identifier , const CaloDetDescrElement* > t_cellmap;
23 typedef std::map< double , const CaloDetDescrElement* > t_eta_cellmap;
24 
26  public:
27  CaloGeometryLookup(int ind=0);
29 
31  void add(const CaloDetDescrElement* cell);
32  t_cellmap::size_type size() const {return m_cells.size();};
33  int index() const {return m_index;};
34  void set_index(int ind) {m_index=ind;};
35  void post_process();
38  //void CalculateTransformation();
39 
40  float mineta() const {return m_mineta;};
41  float maxeta() const {return m_maxeta;};
42  float minphi() const {return m_minphi;};
43  float maxphi() const {return m_maxphi;};
44 
45  float mineta_raw() const {return m_mineta_raw;};
46  float maxeta_raw() const {return m_maxeta_raw;};
47  float minphi_raw() const {return m_minphi_raw;};
48  float maxphi_raw() const {return m_maxphi_raw;};
49 
50 #ifdef USE_GPU
51  //the geometry for GPU EDM are constructed with following functions
52  float mineta_correction() const {return m_mineta_correction;};
53  float maxeta_correction() const {return m_maxeta_correction;};
54  float minphi_correction() const {return m_minphi_correction;};
55  float maxphi_correction() const {return m_maxphi_correction;};
56 #endif
57 
58  float minx() const {return m_mineta;};
59  float maxx() const {return m_maxeta;};
60  float miny() const {return m_minphi;};
61  float maxy() const {return m_maxphi;};
62 
63  float minx_raw() const {return m_mineta_raw;};
64  float maxx_raw() const {return m_maxeta_raw;};
65  float miny_raw() const {return m_minphi_raw;};
66  float maxy_raw() const {return m_maxphi_raw;};
67 
68  const MeanAndRMS& deta() {return m_deta;};
69  const MeanAndRMS& dphi() {return m_dphi;};
70  float mindeta() {return m_mindeta;};
71  float mindphi() {return m_mindphi;};
72  const MeanAndRMS& dx() {return m_deta;};
73  const MeanAndRMS& dy() {return m_dphi;};
74  float mindx() {return m_mindeta;};
75  float mindy() {return m_mindphi;};
76 
81 
82  int cell_grid_eta() const {return m_cell_grid_eta;};
83  int cell_grid_phi() const {return m_cell_grid_phi;};
85 
86  virtual const CaloDetDescrElement* getDDE(float eta,float phi,float* distance=0,int* steps=0);
87 
88 #ifdef USE_GPU
89  //used by FCS-GPU
90  float xy_grid_adjustment_factor() const {return m_xy_grid_adjustment_factor;};
91  float deta_double() const {return m_deta_double;};
92  float dphi_double() const {return m_dphi_double;};
93  const std::vector< std::vector< const CaloDetDescrElement* > > * cell_grid(){ return & m_cell_grid ; } ;
94 #endif
95 
96  protected:
97  float neta_double() {return (maxeta_raw()-mineta_raw())/deta().mean();};
98  float nphi_double() {return (maxphi_raw()-minphi_raw())/dphi().mean();};
99  Int_t neta() {return TMath::Nint( neta_double() );};
100  Int_t nphi() {return TMath::Nint( nphi_double() );};
101 
102  //FCal is not sufficiently regular to use submaps with regular mapping
103  float nx_double() {return (maxx_raw()-minx_raw())/mindx();};
104  float ny_double() {return (maxy_raw()-miny_raw())/mindy();};
105  Int_t nx() {return TMath::Nint(TMath::Ceil( nx_double() ));};
106  Int_t ny() {return TMath::Nint(TMath::Ceil( ny_double() ));};
107 
109 
110  int raw_eta_position_to_index(float eta_raw) const {return TMath::Floor((eta_raw-mineta_raw())/m_deta_double);};
111  int raw_phi_position_to_index(float phi_raw) const {return TMath::Floor((phi_raw-minphi_raw())/m_dphi_double);};
112  bool index_range_adjust(int& ieta,int& iphi) const;
113  float calculate_distance_eta_phi(const CaloDetDescrElement* DDE,float eta,float phi,float& dist_eta0,float& dist_phi0) const;
114 
115  int m_index;
117  std::vector< std::vector< const CaloDetDescrElement* > > m_cell_grid;
122 
126 };
127 #endif
128 
129 
CaloGeometryLookup::mindphi
float mindphi()
Definition: CaloGeometryLookup.h:71
CaloGeometryLookup::m_maxphi_raw
float m_maxphi_raw
Definition: CaloGeometryLookup.h:120
CaloGeometryLookup::set_index
void set_index(int ind)
Definition: CaloGeometryLookup.h:34
CaloGeometryLookup::IsCompatible
bool IsCompatible(const CaloDetDescrElement *cell)
Definition: CaloGeometryLookup.cxx:72
CaloGeometryLookup::CaloGeometryLookup
CaloGeometryLookup(int ind=0)
Definition: CaloGeometryLookup.cxx:24
CaloGeometryLookup::mineta_raw
float mineta_raw() const
Definition: CaloGeometryLookup.h:45
CaloGeometryLookup::m_xy_grid_adjustment_factor
float m_xy_grid_adjustment_factor
Definition: CaloGeometryLookup.h:106
CaloGeometryLookup::ny
Int_t ny()
Definition: CaloGeometryLookup.h:106
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloGeometryLookup::x_correction
const MeanAndRMS & x_correction()
Definition: CaloGeometryLookup.h:79
CaloGeometryLookup::maxx_raw
float maxx_raw() const
Definition: CaloGeometryLookup.h:64
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloGeometryLookup::maxy
float maxy() const
Definition: CaloGeometryLookup.h:61
CaloGeometryLookup::minx_raw
float minx_raw() const
Definition: CaloGeometryLookup.h:63
CaloGeometryLookup::mindy
float mindy()
Definition: CaloGeometryLookup.h:75
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloGeometryLookup::index_range_adjust
bool index_range_adjust(int &ieta, int &iphi) const
Definition: CaloGeometryLookup.cxx:172
CaloGeometryLookup::m_dphi
MeanAndRMS m_dphi
Definition: CaloGeometryLookup.h:123
CaloGeometryLookup::m_cell_grid_phi
int m_cell_grid_phi
Definition: CaloGeometryLookup.h:118
CaloGeometryLookup::ny_double
float ny_double()
Definition: CaloGeometryLookup.h:104
CaloGeometryLookup::deta
const MeanAndRMS & deta()
Definition: CaloGeometryLookup.h:68
CaloGeometryLookup::raw_phi_position_to_index
int raw_phi_position_to_index(float phi_raw) const
Definition: CaloGeometryLookup.h:111
CaloGeometryLookup::maxx
float maxx() const
Definition: CaloGeometryLookup.h:59
CaloGeometryLookup::m_deta
MeanAndRMS m_deta
Definition: CaloGeometryLookup.h:123
CaloGeometryLookup::mindx
float mindx()
Definition: CaloGeometryLookup.h:74
CaloGeometryLookup::m_cell_grid_eta
int m_cell_grid_eta
Definition: CaloGeometryLookup.h:118
CaloGeometryLookup::m_maxphi_correction
float m_maxphi_correction
Definition: CaloGeometryLookup.h:121
CaloGeometryLookup::m_maxeta_correction
float m_maxeta_correction
Definition: CaloGeometryLookup.h:121
CaloGeometryLookup::add
void add(const CaloDetDescrElement *cell)
Definition: CaloGeometryLookup.cxx:122
CaloGeometryLookup::m_deta_double
float m_deta_double
Definition: CaloGeometryLookup.h:125
CaloGeometryLookup::m_eta_correction
MeanAndRMS m_eta_correction
Definition: CaloGeometryLookup.h:123
CaloGeometryLookup::neta
Int_t neta()
Definition: CaloGeometryLookup.h:99
CaloGeometryLookup::eta_correction
const MeanAndRMS & eta_correction()
Definition: CaloGeometryLookup.h:77
beamspotman.steps
int steps
Definition: beamspotman.py:505
CaloGeometryLookup::minphi_raw
float minphi_raw() const
Definition: CaloGeometryLookup.h:47
CaloGeometryLookup::y_correction
const MeanAndRMS & y_correction()
Definition: CaloGeometryLookup.h:80
CaloGeometryLookup::neta_double
float neta_double()
Definition: CaloGeometryLookup.h:97
MeanAndRMS
Definition: MeanAndRMS.h:10
CaloGeometryLookup::m_maxeta
float m_maxeta
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup
Definition: CaloGeometryLookup.h:25
CaloGeometryLookup::mindeta
float mindeta()
Definition: CaloGeometryLookup.h:70
CaloGeometryLookup::m_phi_correction
MeanAndRMS m_phi_correction
Definition: CaloGeometryLookup.h:123
t_eta_cellmap
std::map< double, const CaloDetDescrElement * > t_eta_cellmap
Definition: CaloGeometryLookup.h:23
CaloGeometryLookup::m_minphi_correction
float m_minphi_correction
Definition: CaloGeometryLookup.h:121
CaloGeometryLookup::has_overlap
bool has_overlap(CaloGeometryLookup *ref)
Definition: CaloGeometryLookup.cxx:53
FSmap.h
CaloGeometryLookup::m_mindeta
float m_mindeta
Definition: CaloGeometryLookup.h:124
CaloGeometryLookup::set_xy_grid_adjustment_factor
void set_xy_grid_adjustment_factor(float factor)
Definition: CaloGeometryLookup.h:84
CaloGeometryLookup::m_maxphi
float m_maxphi
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::dy
const MeanAndRMS & dy()
Definition: CaloGeometryLookup.h:73
CaloGeometryLookup::dphi
const MeanAndRMS & dphi()
Definition: CaloGeometryLookup.h:69
CaloGeometryLookup::merge_into_ref
void merge_into_ref(CaloGeometryLookup *ref)
Definition: CaloGeometryLookup.cxx:63
CaloGeometryLookup::m_cells
t_cellmap m_cells
Definition: CaloGeometryLookup.h:116
CaloGeometryLookup::m_minphi
float m_minphi
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::~CaloGeometryLookup
virtual ~CaloGeometryLookup()
CaloGeometryLookup::maxy_raw
float maxy_raw() const
Definition: CaloGeometryLookup.h:66
CaloGeometryLookup::nx
Int_t nx()
Definition: CaloGeometryLookup.h:105
CaloGeometryLookup::m_mineta
float m_mineta
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::minx
float minx() const
Definition: CaloGeometryLookup.h:58
CaloGeometryLookup::post_process
void post_process()
Definition: CaloGeometryLookup.cxx:187
CaloGeometryLookup::nphi
Int_t nphi()
Definition: CaloGeometryLookup.h:100
CaloGeometryLookup::mineta
float mineta() const
Definition: CaloGeometryLookup.h:40
CaloGeometryLookup::m_maxeta_raw
float m_maxeta_raw
Definition: CaloGeometryLookup.h:120
CaloGeometryLookup::minphi
float minphi() const
Definition: CaloGeometryLookup.h:42
CaloGeometryLookup::m_cell_grid
std::vector< std::vector< const CaloDetDescrElement * > > m_cell_grid
Definition: CaloGeometryLookup.h:117
CaloGeometryLookup::maxeta
float maxeta() const
Definition: CaloGeometryLookup.h:41
CaloGeometryLookup::maxeta_raw
float maxeta_raw() const
Definition: CaloGeometryLookup.h:46
CaloGeometryLookup::nx_double
float nx_double()
Definition: CaloGeometryLookup.h:103
CaloGeometryLookup::phi_correction
const MeanAndRMS & phi_correction()
Definition: CaloGeometryLookup.h:78
ref
const boost::regex ref(r_ef)
MeanAndRMS::mean
double mean() const
Definition: MeanAndRMS.h:22
CaloGeometryLookup::getDDE
virtual const CaloDetDescrElement * getDDE(float eta, float phi, float *distance=0, int *steps=0)
Definition: CaloGeometryLookup.cxx:258
t_cellmap
std::map< Identifier, const CaloDetDescrElement * > t_cellmap
Definition: CaloGeometryLookup.h:20
CaloGeometryLookup::m_index
int m_index
Definition: CaloGeometryLookup.h:115
CaloGeometryLookup::m_mindphi
float m_mindphi
Definition: CaloGeometryLookup.h:124
CaloGeometryLookup::size
t_cellmap::size_type size() const
Definition: CaloGeometryLookup.h:32
CaloGeometryLookup::dx
const MeanAndRMS & dx()
Definition: CaloGeometryLookup.h:72
CaloGeometryLookup::cell_grid_eta
int cell_grid_eta() const
Definition: CaloGeometryLookup.h:82
CaloGeometryLookup::m_mineta_correction
float m_mineta_correction
Definition: CaloGeometryLookup.h:121
CaloGeometryLookup::miny_raw
float miny_raw() const
Definition: CaloGeometryLookup.h:65
CaloGeometryLookup::miny
float miny() const
Definition: CaloGeometryLookup.h:60
CaloGeometryLookup::cell_grid_phi
int cell_grid_phi() const
Definition: CaloGeometryLookup.h:83
CaloGeometryLookup::calculate_distance_eta_phi
float calculate_distance_eta_phi(const CaloDetDescrElement *DDE, float eta, float phi, float &dist_eta0, float &dist_phi0) const
Definition: CaloGeometryLookup.cxx:249
CaloGeometryLookup::m_minphi_raw
float m_minphi_raw
Definition: CaloGeometryLookup.h:120
CaloGeometryLookup::nphi_double
float nphi_double()
Definition: CaloGeometryLookup.h:98
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
CaloGeometryLookup::raw_eta_position_to_index
int raw_eta_position_to_index(float eta_raw) const
Definition: CaloGeometryLookup.h:110
CaloGeometryLookup::maxphi_raw
float maxphi_raw() const
Definition: CaloGeometryLookup.h:48
CaloGeometryLookup::maxphi
float maxphi() const
Definition: CaloGeometryLookup.h:43
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
CaloGeometryLookup::m_mineta_raw
float m_mineta_raw
Definition: CaloGeometryLookup.h:120
MeanAndRMS.h
CaloGeometryLookup::index
int index() const
Definition: CaloGeometryLookup.h:33
CaloGeometryLookup::m_dphi_double
float m_dphi_double
Definition: CaloGeometryLookup.h:125