ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CaloGeometryLookup Class Reference

#include <CaloGeometryLookup.h>

Collaboration diagram for CaloGeometryLookup:

Public Member Functions

 CaloGeometryLookup (int ind=0)
 
virtual ~CaloGeometryLookup ()
 
bool IsCompatible (const CaloDetDescrElement *cell)
 
void add (const CaloDetDescrElement *cell)
 
t_cellmap::size_type size () const
 
int index () const
 
void set_index (int ind)
 
void post_process ()
 
bool has_overlap (CaloGeometryLookup *ref)
 
void merge_into_ref (CaloGeometryLookup *ref)
 
float mineta () const
 
float maxeta () const
 
float minphi () const
 
float maxphi () const
 
float mineta_raw () const
 
float maxeta_raw () const
 
float minphi_raw () const
 
float maxphi_raw () const
 
float minx () const
 
float maxx () const
 
float miny () const
 
float maxy () const
 
float minx_raw () const
 
float maxx_raw () const
 
float miny_raw () const
 
float maxy_raw () const
 
const MeanAndRMSdeta ()
 
const MeanAndRMSdphi ()
 
float mindeta ()
 
float mindphi ()
 
const MeanAndRMSdx ()
 
const MeanAndRMSdy ()
 
float mindx ()
 
float mindy ()
 
const MeanAndRMSeta_correction ()
 
const MeanAndRMSphi_correction ()
 
const MeanAndRMSx_correction ()
 
const MeanAndRMSy_correction ()
 
int cell_grid_eta () const
 
int cell_grid_phi () const
 
void set_xy_grid_adjustment_factor (float factor)
 
virtual const CaloDetDescrElementgetDDE (float eta, float phi, float *distance=0, int *steps=0)
 

Protected Member Functions

float neta_double ()
 
float nphi_double ()
 
Int_t neta ()
 
Int_t nphi ()
 
float nx_double ()
 
float ny_double ()
 
Int_t nx ()
 
Int_t ny ()
 
int raw_eta_position_to_index (float eta_raw) const
 
int raw_phi_position_to_index (float phi_raw) const
 
bool index_range_adjust (int &ieta, int &iphi) const
 
float calculate_distance_eta_phi (const CaloDetDescrElement *DDE, float eta, float phi, float &dist_eta0, float &dist_phi0) const
 

Protected Attributes

float m_xy_grid_adjustment_factor
 
int m_index
 
t_cellmap m_cells
 
std::vector< std::vector< const CaloDetDescrElement * > > m_cell_grid
 
int m_cell_grid_eta
 
int m_cell_grid_phi
 
float m_mineta
 
float m_maxeta
 
float m_minphi
 
float m_maxphi
 
float m_mineta_raw
 
float m_maxeta_raw
 
float m_minphi_raw
 
float m_maxphi_raw
 
float m_mineta_correction
 
float m_maxeta_correction
 
float m_minphi_correction
 
float m_maxphi_correction
 
MeanAndRMS m_deta
 
MeanAndRMS m_dphi
 
MeanAndRMS m_eta_correction
 
MeanAndRMS m_phi_correction
 
float m_mindeta
 
float m_mindphi
 
float m_deta_double
 
float m_dphi_double
 

Detailed Description

Definition at line 25 of file CaloGeometryLookup.h.

Constructor & Destructor Documentation

◆ CaloGeometryLookup()

CaloGeometryLookup::CaloGeometryLookup ( int  ind = 0)

Definition at line 24 of file CaloGeometryLookup.cxx.

25 {
26  m_mineta=+10000;
27  m_maxeta=-10000;
28  m_minphi=+10000;
29  m_maxphi=-10000;
30 
31  m_mineta_raw=+10000;
32  m_maxeta_raw=-10000;
33  m_minphi_raw=+10000;
34  m_maxphi_raw=-10000;
35 
36  m_mindeta=10000;
37  m_mindphi=10000;
38 
39  m_mineta_correction=+10000;
40  m_maxeta_correction=-10000;
41  m_minphi_correction=+10000;
42  m_maxphi_correction=-10000;
43 
44  m_cell_grid_eta=0.;
45  m_cell_grid_phi=0.;
46  m_deta_double =0.;
47  m_dphi_double =0.;
48 }

◆ ~CaloGeometryLookup()

CaloGeometryLookup::~CaloGeometryLookup ( )
virtualdefault

Member Function Documentation

◆ add()

void CaloGeometryLookup::add ( const CaloDetDescrElement cell)

Definition at line 122 of file CaloGeometryLookup.cxx.

123 {
124  if(cell->getSampling()<21) {
125  m_deta.add(cell->deta());
126  m_dphi.add(cell->dphi());
127  m_mindeta=TMath::Min(cell->deta(),m_mindeta);
128  m_mindphi=TMath::Min(cell->dphi(),m_mindphi);
129 
130  m_eta_correction.add(cell->eta_raw()-cell->eta());
131  m_phi_correction.add(cell->phi_raw()-cell->phi());
132  m_mineta_correction=TMath::Min(cell->eta_raw()-cell->eta() , m_mineta_correction);
133  m_maxeta_correction=TMath::Max(cell->eta_raw()-cell->eta() , m_maxeta_correction);
134  m_minphi_correction=TMath::Min(cell->phi_raw()-cell->phi() , m_minphi_correction);
135  m_maxphi_correction=TMath::Max(cell->phi_raw()-cell->phi() , m_maxphi_correction);
136 
137  m_mineta=TMath::Min(cell->eta()-cell->deta()/2,m_mineta);
138  m_maxeta=TMath::Max(cell->eta()+cell->deta()/2,m_maxeta);
139  m_minphi=TMath::Min(cell->phi()-cell->dphi()/2,m_minphi);
140  m_maxphi=TMath::Max(cell->phi()+cell->dphi()/2,m_maxphi);
141 
142  m_mineta_raw=TMath::Min(cell->eta_raw()-cell->deta()/2,m_mineta_raw);
143  m_maxeta_raw=TMath::Max(cell->eta_raw()+cell->deta()/2,m_maxeta_raw);
144  m_minphi_raw=TMath::Min(cell->phi_raw()-cell->dphi()/2,m_minphi_raw);
145  m_maxphi_raw=TMath::Max(cell->phi_raw()+cell->dphi()/2,m_maxphi_raw);
146  } else {
147  m_deta.add(cell->dx());
148  m_dphi.add(cell->dy());
149  m_mindeta=TMath::Min(cell->dx(),m_mindeta);
150  m_mindphi=TMath::Min(cell->dy(),m_mindphi);
151 
152  m_eta_correction.add(cell->x_raw()-cell->x());
153  m_phi_correction.add(cell->y_raw()-cell->y());
154  m_mineta_correction=TMath::Min(cell->x_raw()-cell->x() , m_mineta_correction);
155  m_maxeta_correction=TMath::Max(cell->x_raw()-cell->x() , m_maxeta_correction);
156  m_minphi_correction=TMath::Min(cell->y_raw()-cell->y() , m_minphi_correction);
157  m_maxphi_correction=TMath::Max(cell->y_raw()-cell->y() , m_maxphi_correction);
158 
159  m_mineta=TMath::Min(cell->x()-cell->dx()/2,m_mineta);
160  m_maxeta=TMath::Max(cell->x()+cell->dx()/2,m_maxeta);
161  m_minphi=TMath::Min(cell->y()-cell->dy()/2,m_minphi);
162  m_maxphi=TMath::Max(cell->y()+cell->dy()/2,m_maxphi);
163 
164  m_mineta_raw=TMath::Min(cell->x_raw()-cell->dx()/2,m_mineta_raw);
165  m_maxeta_raw=TMath::Max(cell->x_raw()+cell->dx()/2,m_maxeta_raw);
166  m_minphi_raw=TMath::Min(cell->y_raw()-cell->dy()/2,m_minphi_raw);
167  m_maxphi_raw=TMath::Max(cell->y_raw()+cell->dy()/2,m_maxphi_raw);
168  }
169  m_cells[cell->identify()]=cell;
170 }

◆ calculate_distance_eta_phi()

float CaloGeometryLookup::calculate_distance_eta_phi ( const CaloDetDescrElement DDE,
float  eta,
float  phi,
float &  dist_eta0,
float &  dist_phi0 
) const
protected

Definition at line 249 of file CaloGeometryLookup.cxx.

250 {
251  dist_eta0=(eta - DDE->eta())/m_deta_double;
252  dist_phi0=(TVector2::Phi_mpi_pi(phi - DDE->phi()))/m_dphi_double;
253  float abs_dist_eta0=TMath::Abs(dist_eta0);
254  float abs_dist_phi0=TMath::Abs(dist_phi0);
255  return TMath::Max(abs_dist_eta0,abs_dist_phi0)-0.5;
256 }

◆ cell_grid_eta()

int CaloGeometryLookup::cell_grid_eta ( ) const
inline

Definition at line 82 of file CaloGeometryLookup.h.

82 {return m_cell_grid_eta;};

◆ cell_grid_phi()

int CaloGeometryLookup::cell_grid_phi ( ) const
inline

Definition at line 83 of file CaloGeometryLookup.h.

83 {return m_cell_grid_phi;};

◆ deta()

const MeanAndRMS& CaloGeometryLookup::deta ( )
inline

Definition at line 68 of file CaloGeometryLookup.h.

68 {return m_deta;};

◆ dphi()

const MeanAndRMS& CaloGeometryLookup::dphi ( )
inline

Definition at line 69 of file CaloGeometryLookup.h.

69 {return m_dphi;};

◆ dx()

const MeanAndRMS& CaloGeometryLookup::dx ( )
inline

Definition at line 72 of file CaloGeometryLookup.h.

72 {return m_deta;};

◆ dy()

const MeanAndRMS& CaloGeometryLookup::dy ( )
inline

Definition at line 73 of file CaloGeometryLookup.h.

73 {return m_dphi;};

◆ eta_correction()

const MeanAndRMS& CaloGeometryLookup::eta_correction ( )
inline

Definition at line 77 of file CaloGeometryLookup.h.

77 {return m_eta_correction;};

◆ getDDE()

const CaloDetDescrElement * CaloGeometryLookup::getDDE ( float  eta,
float  phi,
float *  distance = 0,
int *  steps = 0 
)
virtual

Definition at line 258 of file CaloGeometryLookup.cxx.

259 {
260  float dist = 0;
261  const CaloDetDescrElement* bestDDE=nullptr;
262  if(!distance) distance=&dist;
263  *distance=+10000000;
264  int intsteps=0;
265  if(!steps) steps=&intsteps;
266 
267  float best_eta_corr=m_eta_correction;
268  float best_phi_corr=m_phi_correction;
269 
270  float raw_eta=eta+best_eta_corr;
271  float raw_phi=phi+best_phi_corr;
272 
273  int ieta=raw_eta_position_to_index(raw_eta);
274  int iphi=raw_phi_position_to_index(raw_phi);
275  index_range_adjust(ieta,iphi);
276 
277  const CaloDetDescrElement* newDDE=m_cell_grid[ieta][iphi];
278  float bestdist=+10000000;
279  ++(*steps);
280  int nsearch=0;
281  while(newDDE && nsearch<3) {
282  float dist_eta0,dist_phi0;
283  *distance=calculate_distance_eta_phi(newDDE,eta,phi,dist_eta0,dist_phi0);
284  bestDDE=newDDE;
285  bestdist=*distance;
286 
288  cout<<"CaloGeometryLookup::getDDE, search iteration "<<nsearch<<endl;
289  cout<<"cell id="<<newDDE->identify()<<" steps "<<*steps<<" steps, eta="<<eta<<" phi="<<phi<<" dist="<<*distance<<" cell_grid_eta="<<cell_grid_eta()<<" cell_grid_phi="<<cell_grid_phi()<<" m_deta_double="<<m_deta_double<<" m_dphi_double="<<m_dphi_double<<" 1st_eta_corr="<<best_eta_corr<<" 1st_phi_corr="<<best_phi_corr<<endl;
290  cout<<" input sampling="<<newDDE->getSampling()<<" eta="<<newDDE->eta()<<" eta_raw="<<newDDE->eta_raw()<<" deta="<<newDDE->deta()<<" ("<<(newDDE->eta_raw()-newDDE->eta())/newDDE->deta()<<") phi="<<newDDE->phi()<<" phi_raw="<<newDDE->phi_raw()<<" dphi="<<newDDE->dphi()<<" ("<<(newDDE->phi_raw()-newDDE->phi())/newDDE->dphi()<<")"<<endl;
291  cout<<" ieta="<<ieta<<" iphi="<<iphi<<endl;
292  cout<<" dist_eta0="<<dist_eta0<<" ,dist_phi0="<<dist_phi0<<endl;
293  }
294 
295  if(*distance<0) return newDDE;
296  //correct ieta and iphi by the observed difference to the hit cell
297  ieta+=TMath::Nint(dist_eta0);
298  iphi+=TMath::Nint(dist_phi0);
299  index_range_adjust(ieta,iphi);
300  const CaloDetDescrElement* oldDDE=newDDE;
301  newDDE=m_cell_grid[ieta][iphi];
302  ++(*steps);
303  ++nsearch;
304  if(oldDDE==newDDE) break;
305  }
306  if(CaloGeometry::m_debug && !newDDE) {
307  cout<<"CaloGeometryLookup::getDDE, direct search ieta="<<ieta<<" iphi="<<iphi<<" is empty"<<endl;
308  }
309  float minieta=ieta+TMath::Nint(TMath::Floor(m_mineta_correction/cell_grid_eta()));
310  float maxieta=ieta+TMath::Nint(TMath::Ceil(m_maxeta_correction/cell_grid_eta()));
311  float miniphi=iphi+TMath::Nint(TMath::Floor(m_minphi_correction/cell_grid_phi()));
312  float maxiphi=iphi+TMath::Nint(TMath::Ceil(m_maxphi_correction/cell_grid_phi()));
313  if(minieta<0) minieta=0;
314  if(maxieta>=m_cell_grid_eta) maxieta=m_cell_grid_eta-1;
315  for(int iieta=minieta;iieta<=maxieta;++iieta) {
316  for(int iiphi=miniphi;iiphi<=maxiphi;++iiphi) {
317  ieta=iieta;
318  iphi=iiphi;
319  index_range_adjust(ieta,iphi);
320  newDDE=m_cell_grid[ieta][iphi];
321  ++(*steps);
322  if(newDDE) {
323  float dist_eta0,dist_phi0;
324  *distance=calculate_distance_eta_phi(newDDE,eta,phi,dist_eta0,dist_phi0);
325 
327  cout<<"CaloGeometryLookup::getDDE, windows search! minieta="<<m_mineta_correction/cell_grid_eta()<<" maxieta="<<m_maxeta_correction/cell_grid_eta()<<" miniphi="<<m_minphi_correction/cell_grid_phi()<<" maxiphi="<<m_maxphi_correction/cell_grid_phi()<<endl;
328  cout<<"cell id="<<newDDE->identify()<<" steps "<<*steps<<" steps, eta="<<eta<<" phi="<<phi<<" dist="<<*distance<<endl;
329  cout<<" input sampling="<<newDDE->getSampling()<<" eta="<<newDDE->eta()<<" eta_raw="<<newDDE->eta_raw()<<" deta="<<newDDE->deta()<<" ("<<(newDDE->eta_raw()-newDDE->eta())/newDDE->deta()<<") phi="<<newDDE->phi()<<" phi_raw="<<newDDE->phi_raw()<<" dphi="<<newDDE->dphi()<<" ("<<(newDDE->phi_raw()-newDDE->phi())/newDDE->dphi()<<")"<<endl;
330  cout<<" ieta="<<ieta<<" iphi="<<iphi<<endl;
331  cout<<" dist_eta0="<<dist_eta0<<" ,dist_phi0="<<dist_phi0<<endl;
332  }
333 
334  if(*distance<0) return newDDE;
335  if(*distance<bestdist) {
336  bestDDE=newDDE;
337  bestdist=*distance;
338  }
339  } else if(CaloGeometry::m_debug) {
340  cout<<"CaloGeometryLookup::getDDE, windows search ieta="<<ieta<<" iphi="<<iphi<<" is empty"<<endl;
341  }
342  }
343  }
344  *distance=bestdist;
345  return bestDDE;
346 }

◆ has_overlap()

bool CaloGeometryLookup::has_overlap ( CaloGeometryLookup ref)

Definition at line 53 of file CaloGeometryLookup.cxx.

54 {
55  if(m_cells.empty()) return false;
56  for(t_cellmap::iterator ic=m_cells.begin();ic!=m_cells.end();++ic) {
57  const CaloDetDescrElement* cell=ic->second;
58  if(ref->IsCompatible(cell)) return true;
59  }
60  return false;
61 }

◆ index()

int CaloGeometryLookup::index ( ) const
inline

Definition at line 33 of file CaloGeometryLookup.h.

33 {return m_index;};

◆ index_range_adjust()

bool CaloGeometryLookup::index_range_adjust ( int &  ieta,
int &  iphi 
) const
protected

Definition at line 172 of file CaloGeometryLookup.cxx.

173 {
174  while(iphi<0) {iphi+=m_cell_grid_phi;};
175  while(iphi>=m_cell_grid_phi) {iphi-=m_cell_grid_phi;};
176  if(ieta<0) {
177  ieta=0;
178  return false;
179  }
180  if(ieta>=m_cell_grid_eta) {
181  ieta=m_cell_grid_eta-1;
182  return false;
183  }
184  return true;
185 }

◆ IsCompatible()

bool CaloGeometryLookup::IsCompatible ( const CaloDetDescrElement cell)

Definition at line 72 of file CaloGeometryLookup.cxx.

73 {
74  if(m_cells.empty()) return true;
76  const CaloDetDescrElement* refcell=ic->second;
77  int sampling=refcell->getSampling();
78  if(cell->getSampling()!=sampling) return false;
79  if(cell->eta_raw()*refcell->eta_raw()<0) return false;
80  if(sampling<21) { // keep only cells reasonable close in eta to each other
81  if(TMath::Abs(cell->deta()-refcell->deta())>0.001) return false;
82  if(TMath::Abs(cell->dphi()-refcell->dphi())>0.001) return false;
83 
84  if( cell->eta()<mineta()-2.1*cell->deta() ) return false;
85  if( cell->eta()>maxeta()+2.1*cell->deta() ) return false;
86 
87  double delta_eta=(cell->eta_raw()-refcell->eta_raw())/cell->deta();
88  double delta_phi=(cell->phi_raw()-refcell->phi_raw())/cell->dphi();
89  if(TMath::Abs(delta_eta-TMath::Nint(delta_eta)) > 0.01) return false;
90  if(TMath::Abs(delta_phi-TMath::Nint(delta_phi)) > 0.01) return false;
91 
92  /*
93  cout<<"Compatible: s="<<cell->getSampling()<<"~"<<refcell->getSampling()<<"; ";
94  cout<<"eta="<<cell->eta_raw()<<","<<refcell->eta_raw()<<"; ";
95  cout<<"phi="<<cell->phi_raw()<<","<<refcell->phi_raw()<<"; ";
96  cout<<"deta="<<cell->deta()<<"~"<<refcell->deta()<<"; ";
97  cout<<"dphi="<<cell->dphi()<<"~"<<refcell->dphi()<<";";
98  cout<<"mineta="<<mineta()<<", maxeta="<<maxeta()<<"; ";
99  cout<<endl;
100  */
101  } else {
102  //FCal is not sufficiently regular to use submaps with regular mapping
103  return true;
104  /*
105  if(TMath::Abs(cell->dx()-refcell->dx())>0.001) return false;
106  if(TMath::Abs(cell->dy()-refcell->dy())>0.001) return false;
107  if( cell->x()<minx()-20*cell->dx() ) return false;
108  if( cell->x()>maxx()+20*cell->dx() ) return false;
109  if( cell->y()<miny()-20*cell->dy() ) return false;
110  if( cell->y()>maxy()+20*cell->dy() ) return false;
111 
112  double delta_x=(cell->x_raw()-refcell->x_raw())/cell->dx();
113  double delta_y=(cell->y_raw()-refcell->y_raw())/cell->dy();
114  if(TMath::Abs(delta_x-TMath::Nint(delta_x)) > 0.01) return false;
115  if(TMath::Abs(delta_y-TMath::Nint(delta_y)) > 0.01) return false;
116  */
117  }
118 
119  return true;
120 }

◆ maxeta()

float CaloGeometryLookup::maxeta ( ) const
inline

Definition at line 41 of file CaloGeometryLookup.h.

41 {return m_maxeta;};

◆ maxeta_raw()

float CaloGeometryLookup::maxeta_raw ( ) const
inline

Definition at line 46 of file CaloGeometryLookup.h.

46 {return m_maxeta_raw;};

◆ maxphi()

float CaloGeometryLookup::maxphi ( ) const
inline

Definition at line 43 of file CaloGeometryLookup.h.

43 {return m_maxphi;};

◆ maxphi_raw()

float CaloGeometryLookup::maxphi_raw ( ) const
inline

Definition at line 48 of file CaloGeometryLookup.h.

48 {return m_maxphi_raw;};

◆ maxx()

float CaloGeometryLookup::maxx ( ) const
inline

Definition at line 59 of file CaloGeometryLookup.h.

59 {return m_maxeta;};

◆ maxx_raw()

float CaloGeometryLookup::maxx_raw ( ) const
inline

Definition at line 64 of file CaloGeometryLookup.h.

64 {return m_maxeta_raw;};

◆ maxy()

float CaloGeometryLookup::maxy ( ) const
inline

Definition at line 61 of file CaloGeometryLookup.h.

61 {return m_maxphi;};

◆ maxy_raw()

float CaloGeometryLookup::maxy_raw ( ) const
inline

Definition at line 66 of file CaloGeometryLookup.h.

66 {return m_maxphi_raw;};

◆ merge_into_ref()

void CaloGeometryLookup::merge_into_ref ( CaloGeometryLookup ref)

Definition at line 63 of file CaloGeometryLookup.cxx.

64 {
65  for(t_cellmap::iterator ic=m_cells.begin();ic!=m_cells.end();++ic) {
66  const CaloDetDescrElement* cell=ic->second;
67  ref->add(cell);
68  }
69 }

◆ mindeta()

float CaloGeometryLookup::mindeta ( )
inline

Definition at line 70 of file CaloGeometryLookup.h.

70 {return m_mindeta;};

◆ mindphi()

float CaloGeometryLookup::mindphi ( )
inline

Definition at line 71 of file CaloGeometryLookup.h.

71 {return m_mindphi;};

◆ mindx()

float CaloGeometryLookup::mindx ( )
inline

Definition at line 74 of file CaloGeometryLookup.h.

74 {return m_mindeta;};

◆ mindy()

float CaloGeometryLookup::mindy ( )
inline

Definition at line 75 of file CaloGeometryLookup.h.

75 {return m_mindphi;};

◆ mineta()

float CaloGeometryLookup::mineta ( ) const
inline

Definition at line 40 of file CaloGeometryLookup.h.

40 {return m_mineta;};

◆ mineta_raw()

float CaloGeometryLookup::mineta_raw ( ) const
inline

Definition at line 45 of file CaloGeometryLookup.h.

45 {return m_mineta_raw;};

◆ minphi()

float CaloGeometryLookup::minphi ( ) const
inline

Definition at line 42 of file CaloGeometryLookup.h.

42 {return m_minphi;};

◆ minphi_raw()

float CaloGeometryLookup::minphi_raw ( ) const
inline

Definition at line 47 of file CaloGeometryLookup.h.

47 {return m_minphi_raw;};

◆ minx()

float CaloGeometryLookup::minx ( ) const
inline

Definition at line 58 of file CaloGeometryLookup.h.

58 {return m_mineta;};

◆ minx_raw()

float CaloGeometryLookup::minx_raw ( ) const
inline

Definition at line 63 of file CaloGeometryLookup.h.

63 {return m_mineta_raw;};

◆ miny()

float CaloGeometryLookup::miny ( ) const
inline

Definition at line 60 of file CaloGeometryLookup.h.

60 {return m_minphi;};

◆ miny_raw()

float CaloGeometryLookup::miny_raw ( ) const
inline

Definition at line 65 of file CaloGeometryLookup.h.

65 {return m_minphi_raw;};

◆ neta()

Int_t CaloGeometryLookup::neta ( )
inlineprotected

Definition at line 99 of file CaloGeometryLookup.h.

99 {return TMath::Nint( neta_double() );};

◆ neta_double()

float CaloGeometryLookup::neta_double ( )
inlineprotected

Definition at line 97 of file CaloGeometryLookup.h.

97 {return (maxeta_raw()-mineta_raw())/deta().mean();};

◆ nphi()

Int_t CaloGeometryLookup::nphi ( )
inlineprotected

Definition at line 100 of file CaloGeometryLookup.h.

100 {return TMath::Nint( nphi_double() );};

◆ nphi_double()

float CaloGeometryLookup::nphi_double ( )
inlineprotected

Definition at line 98 of file CaloGeometryLookup.h.

98 {return (maxphi_raw()-minphi_raw())/dphi().mean();};

◆ nx()

Int_t CaloGeometryLookup::nx ( )
inlineprotected

Definition at line 105 of file CaloGeometryLookup.h.

105 {return TMath::Nint(TMath::Ceil( nx_double() ));};

◆ nx_double()

float CaloGeometryLookup::nx_double ( )
inlineprotected

Definition at line 103 of file CaloGeometryLookup.h.

103 {return (maxx_raw()-minx_raw())/mindx();};

◆ ny()

Int_t CaloGeometryLookup::ny ( )
inlineprotected

Definition at line 106 of file CaloGeometryLookup.h.

106 {return TMath::Nint(TMath::Ceil( ny_double() ));};

◆ ny_double()

float CaloGeometryLookup::ny_double ( )
inlineprotected

Definition at line 104 of file CaloGeometryLookup.h.

104 {return (maxy_raw()-miny_raw())/mindy();};

◆ phi_correction()

const MeanAndRMS& CaloGeometryLookup::phi_correction ( )
inline

Definition at line 78 of file CaloGeometryLookup.h.

78 {return m_phi_correction;};

◆ post_process()

void CaloGeometryLookup::post_process ( )

Definition at line 187 of file CaloGeometryLookup.cxx.

188 {
189  if(size()==0) return;
191  const CaloDetDescrElement* refcell=ic->second;
192  int sampling=refcell->getSampling();
193  if(sampling<21) {
194  double rneta=neta_double()-neta();
195  double rnphi=nphi_double()-nphi();
196  if(TMath::Abs(rneta)>0.05 || TMath::Abs(rnphi)>0.05) {
197  cout<<"ERROR: can't map cells into a regular grid for sampling "<<sampling<<", map index "<<index()<<endl;
198  return;
199  }
204  } else {
205  //double rnx=nx_double()-nx();
206  //double rny=ny_double()-ny();
207  //if(TMath::Abs(rnx)>0.05 || TMath::Abs(rny)>0.05) {
208  // cout<<"Grid: Sampling "<<sampling<<"_"<<index()<<": mapping cells into a regular grid, although cells don't fit well"<<endl;
209  //}
210 
211  m_cell_grid_eta=TMath::Nint(TMath::Ceil(nx_double()/m_xy_grid_adjustment_factor));
212  m_cell_grid_phi=TMath::Nint(TMath::Ceil(ny_double()/m_xy_grid_adjustment_factor));
215  }
216 
217  m_cell_grid.resize(m_cell_grid_eta);
218  for(int ieta=0;ieta<m_cell_grid_eta;++ieta) {
219  m_cell_grid[ieta].resize(m_cell_grid_phi,nullptr);
220  }
221 
222  for(ic=m_cells.begin();ic!=m_cells.end();++ic) {
223  refcell=ic->second;
224  int ieta,iphi;
225  if(sampling<21) {
226  ieta=raw_eta_position_to_index(refcell->eta_raw());
227  iphi=raw_phi_position_to_index(refcell->phi_raw());
228  } else {
229  ieta=raw_eta_position_to_index(refcell->x_raw());
230  iphi=raw_phi_position_to_index(refcell->y_raw());
231  }
232  if(index_range_adjust(ieta,iphi)) {
233  if(m_cell_grid[ieta][iphi]) {
234  cout<<"Grid: Sampling "<<sampling<<"_"<<index()<<": Already cell found at pos ("<<ieta<<","<<iphi<<"): id="
235  <<m_cell_grid[ieta][iphi]->identify()<<"->"<<refcell->identify()<<endl;
236  cout<<" x="<<m_cells[m_cell_grid[ieta][iphi]->identify()]->x_raw()<<" -> "<<refcell->x_raw();
237  cout<<" , y="<<m_cells[m_cell_grid[ieta][iphi]->identify()]->y_raw()<<" -> "<<refcell->y_raw();
238  cout<<" mindx="<<m_deta_double<<" mindy="<<m_dphi_double<<endl;
239  cout<<endl;
240  }
241  m_cell_grid[ieta][iphi]=refcell;
242  } else {
243  cout<<"Grid: Sampling "<<sampling<<"_"<<index()<<": Cell at pos ("<<ieta<<","<<iphi<<"): id="
244  <<refcell->identify()<<" outside eta range"<<endl;
245  }
246  }
247 }

◆ raw_eta_position_to_index()

int CaloGeometryLookup::raw_eta_position_to_index ( float  eta_raw) const
inlineprotected

Definition at line 110 of file CaloGeometryLookup.h.

110 {return TMath::Floor((eta_raw-mineta_raw())/m_deta_double);};

◆ raw_phi_position_to_index()

int CaloGeometryLookup::raw_phi_position_to_index ( float  phi_raw) const
inlineprotected

Definition at line 111 of file CaloGeometryLookup.h.

111 {return TMath::Floor((phi_raw-minphi_raw())/m_dphi_double);};

◆ set_index()

void CaloGeometryLookup::set_index ( int  ind)
inline

Definition at line 34 of file CaloGeometryLookup.h.

34 {m_index=ind;};

◆ set_xy_grid_adjustment_factor()

void CaloGeometryLookup::set_xy_grid_adjustment_factor ( float  factor)
inline

Definition at line 84 of file CaloGeometryLookup.h.

◆ size()

t_cellmap::size_type CaloGeometryLookup::size ( ) const
inline

Definition at line 32 of file CaloGeometryLookup.h.

32 {return m_cells.size();};

◆ x_correction()

const MeanAndRMS& CaloGeometryLookup::x_correction ( )
inline

Definition at line 79 of file CaloGeometryLookup.h.

79 {return m_eta_correction;};

◆ y_correction()

const MeanAndRMS& CaloGeometryLookup::y_correction ( )
inline

Definition at line 80 of file CaloGeometryLookup.h.

80 {return m_phi_correction;};

Member Data Documentation

◆ m_cell_grid

std::vector< std::vector< const CaloDetDescrElement* > > CaloGeometryLookup::m_cell_grid
protected

Definition at line 117 of file CaloGeometryLookup.h.

◆ m_cell_grid_eta

int CaloGeometryLookup::m_cell_grid_eta
protected

Definition at line 118 of file CaloGeometryLookup.h.

◆ m_cell_grid_phi

int CaloGeometryLookup::m_cell_grid_phi
protected

Definition at line 118 of file CaloGeometryLookup.h.

◆ m_cells

t_cellmap CaloGeometryLookup::m_cells
protected

Definition at line 116 of file CaloGeometryLookup.h.

◆ m_deta

MeanAndRMS CaloGeometryLookup::m_deta
protected

Definition at line 123 of file CaloGeometryLookup.h.

◆ m_deta_double

float CaloGeometryLookup::m_deta_double
protected

Definition at line 125 of file CaloGeometryLookup.h.

◆ m_dphi

MeanAndRMS CaloGeometryLookup::m_dphi
protected

Definition at line 123 of file CaloGeometryLookup.h.

◆ m_dphi_double

float CaloGeometryLookup::m_dphi_double
protected

Definition at line 125 of file CaloGeometryLookup.h.

◆ m_eta_correction

MeanAndRMS CaloGeometryLookup::m_eta_correction
protected

Definition at line 123 of file CaloGeometryLookup.h.

◆ m_index

int CaloGeometryLookup::m_index
protected

Definition at line 115 of file CaloGeometryLookup.h.

◆ m_maxeta

float CaloGeometryLookup::m_maxeta
protected

Definition at line 119 of file CaloGeometryLookup.h.

◆ m_maxeta_correction

float CaloGeometryLookup::m_maxeta_correction
protected

Definition at line 121 of file CaloGeometryLookup.h.

◆ m_maxeta_raw

float CaloGeometryLookup::m_maxeta_raw
protected

Definition at line 120 of file CaloGeometryLookup.h.

◆ m_maxphi

float CaloGeometryLookup::m_maxphi
protected

Definition at line 119 of file CaloGeometryLookup.h.

◆ m_maxphi_correction

float CaloGeometryLookup::m_maxphi_correction
protected

Definition at line 121 of file CaloGeometryLookup.h.

◆ m_maxphi_raw

float CaloGeometryLookup::m_maxphi_raw
protected

Definition at line 120 of file CaloGeometryLookup.h.

◆ m_mindeta

float CaloGeometryLookup::m_mindeta
protected

Definition at line 124 of file CaloGeometryLookup.h.

◆ m_mindphi

float CaloGeometryLookup::m_mindphi
protected

Definition at line 124 of file CaloGeometryLookup.h.

◆ m_mineta

float CaloGeometryLookup::m_mineta
protected

Definition at line 119 of file CaloGeometryLookup.h.

◆ m_mineta_correction

float CaloGeometryLookup::m_mineta_correction
protected

Definition at line 121 of file CaloGeometryLookup.h.

◆ m_mineta_raw

float CaloGeometryLookup::m_mineta_raw
protected

Definition at line 120 of file CaloGeometryLookup.h.

◆ m_minphi

float CaloGeometryLookup::m_minphi
protected

Definition at line 119 of file CaloGeometryLookup.h.

◆ m_minphi_correction

float CaloGeometryLookup::m_minphi_correction
protected

Definition at line 121 of file CaloGeometryLookup.h.

◆ m_minphi_raw

float CaloGeometryLookup::m_minphi_raw
protected

Definition at line 120 of file CaloGeometryLookup.h.

◆ m_phi_correction

MeanAndRMS CaloGeometryLookup::m_phi_correction
protected

Definition at line 123 of file CaloGeometryLookup.h.

◆ m_xy_grid_adjustment_factor

float CaloGeometryLookup::m_xy_grid_adjustment_factor
protected

Definition at line 108 of file CaloGeometryLookup.h.


The documentation for this class was generated from the following files:
CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloGeometryLookup::m_maxphi_raw
float m_maxphi_raw
Definition: CaloGeometryLookup.h:120
MeanAndRMS::add
MeanAndRMS & add(double xadd, double weight=1)
Definition: MeanAndRMS.h:16
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
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloGeometryLookup::maxx_raw
float maxx_raw() const
Definition: CaloGeometryLookup.h:64
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
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
Phi_mpi_pi
__HOSTDEV__ double Phi_mpi_pi(double)
Definition: GeoRegion.cxx:7
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
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloGeometryLookup::m_deta_double
float m_deta_double
Definition: CaloGeometryLookup.h:125
CaloGeometryLookup::m_eta_correction
MeanAndRMS m_eta_correction
Definition: CaloGeometryLookup.h:123
CaloDetDescrElement::identify
Identifier identify() const override final
cell identifier
Definition: CaloDetDescrElement.cxx:64
CaloGeometryLookup::neta
Int_t neta()
Definition: CaloGeometryLookup.h:99
CaloGeometry::m_debug_identify
static const Identifier m_debug_identify
Definition: CaloGeometry.h:31
beamspotman.steps
int steps
Definition: beamspotman.py:505
CaloGeometryLookup::minphi_raw
float minphi_raw() const
Definition: CaloGeometryLookup.h:47
CaloGeometryLookup::neta_double
float neta_double()
Definition: CaloGeometryLookup.h:97
CaloGeometryLookup::m_maxeta
float m_maxeta
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::m_phi_correction
MeanAndRMS m_phi_correction
Definition: CaloGeometryLookup.h:123
CaloGeometryLookup::m_minphi_correction
float m_minphi_correction
Definition: CaloGeometryLookup.h:121
CaloGeometryLookup::m_mindeta
float m_mindeta
Definition: CaloGeometryLookup.h:124
CaloGeometryLookup::m_maxphi
float m_maxphi
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::dphi
const MeanAndRMS & dphi()
Definition: CaloGeometryLookup.h:69
grepfile.ic
int ic
Definition: grepfile.py:33
CaloGeometryLookup::m_cells
t_cellmap m_cells
Definition: CaloGeometryLookup.h:116
CaloGeometryLookup::m_minphi
float m_minphi
Definition: CaloGeometryLookup.h:119
CaloGeometryLookup::maxy_raw
float maxy_raw() const
Definition: CaloGeometryLookup.h:66
CaloGeometryLookup::m_mineta
float m_mineta
Definition: CaloGeometryLookup.h:119
CaloDetDescrElement::x_raw
float x_raw() const
cell x_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:369
CaloGeometry::m_debug
static std::atomic< bool > m_debug
Definition: CaloGeometry.h:32
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
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
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
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
ref
const boost::regex ref(r_ef)
MeanAndRMS::mean
double mean() const
Definition: MeanAndRMS.h:22
eFEXNTuple.delta_phi
def delta_phi(phi1, phi2)
Definition: eFEXNTuple.py:15
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::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::cell_grid_phi
int cell_grid_phi() const
Definition: CaloGeometryLookup.h:83
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
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
CaloDetDescrElement::y_raw
float y_raw() const
cell y_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:371
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
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloGeometryLookup::m_mineta_raw
float m_mineta_raw
Definition: CaloGeometryLookup.h:120
CaloGeometryLookup::index
int index() const
Definition: CaloGeometryLookup.h:33
CaloGeometryLookup::m_dphi_double
float m_dphi_double
Definition: CaloGeometryLookup.h:125