ATLAS Offline Software
Loading...
Searching...
No Matches
GeoRegion Class Reference

#include <GeoRegion.h>

Collaboration diagram for GeoRegion:

Public Member Functions

__HOSTDEV__ GeoRegion ()
__HOSTDEV__ ~GeoRegion ()
__HOSTDEV__ void set_all_cells (CaloDetDescrElement_Gpu *c)
__HOSTDEV__ void set_xy_grid_adjustment_factor (float f)
__HOSTDEV__ void set_index (int i)
__HOSTDEV__ void set_cell_grid_eta (int i)
__HOSTDEV__ void set_cell_grid_phi (int i)
__HOSTDEV__ void set_mineta (float f)
__HOSTDEV__ void set_maxeta (float f)
__HOSTDEV__ void set_minphi (float f)
__HOSTDEV__ void set_maxphi (float f)
__HOSTDEV__ void set_minphi_raw (float f)
__HOSTDEV__ void set_maxphi_raw (float f)
__HOSTDEV__ void set_mineta_raw (float f)
__HOSTDEV__ void set_maxeta_raw (float f)
__HOSTDEV__ void set_mineta_correction (float f)
__HOSTDEV__ void set_maxeta_correction (float f)
__HOSTDEV__ void set_minphi_correction (float f)
__HOSTDEV__ void set_maxphi_correction (float f)
__HOSTDEV__ void set_eta_correction (float f)
__HOSTDEV__ void set_phi_correction (float f)
__HOSTDEV__ void set_deta (float f)
__HOSTDEV__ void set_dphi (float f)
__HOSTDEV__ void set_deta_double (float f)
__HOSTDEV__ void set_dphi_double (float f)
__HOSTDEV__ void set_cell_grid (long long *cells)
__HOSTDEV__ void set_cell_grid_g (long long *cells)
__HOSTDEV__ long long * cell_grid () const
__HOSTDEV__ long long * cell_grid_g () const
__HOSTDEV__ int cell_grid_eta () const
__HOSTDEV__ int cell_grid_phi () const
__HOSTDEV__ int index () const
__HOSTDEV__ float mineta_raw () const
__HOSTDEV__ float minphi_raw () const
__HOSTDEV__ CaloDetDescrElement_Gpuall_cells () const
__HOSTDEV__ float maxeta () const
__HOSTDEV__ float mineta () const
__HOSTDEV__ float maxphi () const
__HOSTDEV__ float minphi () const
__HOSTDEV__ int raw_eta_position_to_index (float eta_raw) const
__HOSTDEV__ int raw_phi_position_to_index (float phi_raw) const
__HOSTDEV__ bool index_range_adjust (int &ieta, int &iphi) const
__HOSTDEV__ float calculate_distance_eta_phi (const long long DDE, float eta, float phi, float &dist_eta0, float &dist_phi0) const
__HOSTDEV__ long long getDDE (float eta, float phi, float *distance=0, int *steps=0)

Protected Attributes

long long * m_cells
long long * m_cells_g
CaloDetDescrElement_Gpum_all_cells
float m_xy_grid_adjustment_factor
int m_index
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
float m_deta
float m_dphi
float m_eta_correction
float m_phi_correction
float m_dphi_double
float m_deta_double

Detailed Description

Definition at line 18 of file GeoRegion.h.

Constructor & Destructor Documentation

◆ GeoRegion()

__HOSTDEV__ GeoRegion::GeoRegion ( )
inline

Definition at line 20 of file GeoRegion.h.

20 {
21 m_all_cells = 0;
23 m_index = 0;
26 m_mineta = 0;
27 m_maxeta = 0;
28 m_minphi = 0;
29 m_maxphi = 0;
30 m_mineta_raw = 0;
31 m_maxeta_raw = 0;
32 m_minphi_raw = 0;
33 m_maxphi_raw = 0;
38 m_deta = 0;
39 m_dphi = 0;
42 m_dphi_double = 0;
43 m_deta_double = 0;
44 m_cells = 0;
45 m_cells_g = 0;
46 };
int m_cell_grid_phi
Definition GeoRegion.h:109
float m_dphi_double
Definition GeoRegion.h:114
float m_xy_grid_adjustment_factor
Definition GeoRegion.h:107
float m_minphi_correction
Definition GeoRegion.h:112
float m_mineta_correction
Definition GeoRegion.h:112
long long * m_cells
Definition GeoRegion.h:103
float m_minphi_raw
Definition GeoRegion.h:111
float m_eta_correction
Definition GeoRegion.h:113
int m_cell_grid_eta
Definition GeoRegion.h:109
CaloDetDescrElement_Gpu * m_all_cells
Definition GeoRegion.h:105
float m_deta_double
Definition GeoRegion.h:114
float m_dphi
Definition GeoRegion.h:113
float m_minphi
Definition GeoRegion.h:110
float m_mineta
Definition GeoRegion.h:110
float m_deta
Definition GeoRegion.h:113
float m_maxeta
Definition GeoRegion.h:110
float m_mineta_raw
Definition GeoRegion.h:111
float m_maxphi_correction
Definition GeoRegion.h:112
float m_maxeta_raw
Definition GeoRegion.h:111
int m_index
Definition GeoRegion.h:108
long long * m_cells_g
Definition GeoRegion.h:104
float m_maxeta_correction
Definition GeoRegion.h:112
float m_maxphi_raw
Definition GeoRegion.h:111
float m_maxphi
Definition GeoRegion.h:110
float m_phi_correction
Definition GeoRegion.h:113

◆ ~GeoRegion()

__HOSTDEV__ GeoRegion::~GeoRegion ( )
inline

Definition at line 48 of file GeoRegion.h.

48{ free( m_cells ); };

Member Function Documentation

◆ all_cells()

__HOSTDEV__ CaloDetDescrElement_Gpu * GeoRegion::all_cells ( ) const
inline

Definition at line 83 of file GeoRegion.h.

83{ return m_all_cells; };

◆ calculate_distance_eta_phi()

__HOSTDEV__ float GeoRegion::calculate_distance_eta_phi ( const long long DDE,
float eta,
float phi,
float & dist_eta0,
float & dist_phi0 ) const

Definition at line 30 of file GeoRegion.cxx.

31 {
32
33 dist_eta0 = ( eta - m_all_cells[DDE].eta() ) / m_deta_double;
34 dist_phi0 = ( Phi_mpi_pi( phi - m_all_cells[DDE].phi() ) ) / m_dphi_double;
35 float abs_dist_eta0 = abs( dist_eta0 );
36 float abs_dist_phi0 = abs( dist_phi0 );
37 return max( abs_dist_eta0, abs_dist_phi0 ) - 0.5;
38}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
__HOSTDEV__ double Phi_mpi_pi(double)
Definition GeoRegion.cxx:10
#define max(a, b)
Definition cfImp.cxx:41

◆ cell_grid()

__HOSTDEV__ long long * GeoRegion::cell_grid ( ) const
inline

Definition at line 76 of file GeoRegion.h.

76{ return m_cells; };

◆ cell_grid_eta()

__HOSTDEV__ int GeoRegion::cell_grid_eta ( ) const
inline

Definition at line 78 of file GeoRegion.h.

78{ return m_cell_grid_eta; };

◆ cell_grid_g()

__HOSTDEV__ long long * GeoRegion::cell_grid_g ( ) const
inline

Definition at line 77 of file GeoRegion.h.

77{ return m_cells_g; };

◆ cell_grid_phi()

__HOSTDEV__ int GeoRegion::cell_grid_phi ( ) const
inline

Definition at line 79 of file GeoRegion.h.

79{ return m_cell_grid_phi; };

◆ getDDE()

__HOSTDEV__ long long GeoRegion::getDDE ( float eta,
float phi,
float * distance = 0,
int * steps = 0 )

Definition at line 40 of file GeoRegion.cxx.

40 {
41
42 float dist;
43 long long bestDDE = -1;
44 if ( !distance ) distance = &dist;
45 *distance = +10000000;
46 int intsteps = 0;
47 if ( !steps ) steps = &intsteps;
48
49 float best_eta_corr = m_eta_correction;
50 float best_phi_corr = m_phi_correction;
51
52 float raw_eta = eta + best_eta_corr;
53 float raw_phi = phi + best_phi_corr;
54
55 int ieta = raw_eta_position_to_index( raw_eta );
56 int iphi = raw_phi_position_to_index( raw_phi );
57 index_range_adjust( ieta, iphi );
58
59 long long newDDE = m_cells_g[ieta * m_cell_grid_phi + iphi];
60 float bestdist = +10000000;
61 ++( *steps );
62 int nsearch = 0;
63 while ( ( newDDE >= 0 ) && nsearch < 3 ) {
64 float dist_eta0, dist_phi0;
65
66 *distance = calculate_distance_eta_phi( newDDE, eta, phi, dist_eta0, dist_phi0 );
67
68 bestDDE = newDDE;
69 bestdist = *distance;
70
71 if ( *distance < 0 ) return newDDE;
72
73 // correct ieta and iphi by the observed difference to the hit cell
74 ieta += round( dist_eta0 );
75 iphi += round( dist_phi0 );
76 index_range_adjust( ieta, iphi );
77 long long oldDDE = newDDE;
78 newDDE = m_cells_g[ieta * m_cell_grid_phi + iphi];
79 ++( *steps );
80 ++nsearch;
81 if ( oldDDE == newDDE ) break;
82 }
83 float minieta = ieta + floor( m_mineta_correction / cell_grid_eta() );
84 float maxieta = ieta + ceil( m_maxeta_correction / cell_grid_eta() );
85 float miniphi = iphi + floor( m_minphi_correction / cell_grid_phi() );
86 float maxiphi = iphi + ceil( m_maxphi_correction / cell_grid_phi() );
87 if ( minieta < 0 ) minieta = 0;
88 if ( maxieta >= m_cell_grid_eta ) maxieta = m_cell_grid_eta - 1;
89 for ( int iieta = minieta; iieta <= maxieta; ++iieta ) {
90 for ( int iiphi = miniphi; iiphi <= maxiphi; ++iiphi ) {
91 ieta = iieta;
92 iphi = iiphi;
93 index_range_adjust( ieta, iphi );
94 newDDE = m_cells_g[ieta * m_cell_grid_phi + iphi];
95 ++( *steps );
96 if ( newDDE >= 0 ) {
97 float dist_eta0, dist_phi0;
98 *distance = calculate_distance_eta_phi( newDDE, eta, phi, dist_eta0, dist_phi0 );
99
100 if ( *distance < 0 ) return newDDE;
101 if ( *distance < bestdist ) {
102 bestDDE = newDDE;
103 bestdist = *distance;
104 }
105 } else {
106 printf( "GeoRegin::getDDE, windows search ieta=%d iphi=%d is empty\n", ieta, iphi );
107 }
108 }
109 }
110 *distance = bestdist;
111 return bestDDE;
112}
__HOSTDEV__ int raw_phi_position_to_index(float phi_raw) const
Definition GeoRegion.h:92
__HOSTDEV__ bool index_range_adjust(int &ieta, int &iphi) const
Definition GeoRegion.cxx:16
__HOSTDEV__ int cell_grid_phi() const
Definition GeoRegion.h:79
__HOSTDEV__ float calculate_distance_eta_phi(const long long DDE, float eta, float phi, float &dist_eta0, float &dist_phi0) const
Definition GeoRegion.cxx:30
__HOSTDEV__ int cell_grid_eta() const
Definition GeoRegion.h:78
__HOSTDEV__ int raw_eta_position_to_index(float eta_raw) const
Definition GeoRegion.h:89
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
float round(const float toRound, const unsigned int decimals)
Definition Mdt.cxx:27

◆ index()

__HOSTDEV__ int GeoRegion::index ( ) const
inline

Definition at line 80 of file GeoRegion.h.

80{ return m_index; };

◆ index_range_adjust()

__HOSTDEV__ bool GeoRegion::index_range_adjust ( int & ieta,
int & iphi ) const

Definition at line 16 of file GeoRegion.cxx.

16 {
17 while ( iphi < 0 ) { iphi += m_cell_grid_phi; };
18 while ( iphi >= m_cell_grid_phi ) { iphi -= m_cell_grid_phi; };
19 if ( ieta < 0 ) {
20 ieta = 0;
21 return false;
22 }
23 if ( ieta >= m_cell_grid_eta ) {
24 ieta = m_cell_grid_eta - 1;
25 return false;
26 }
27 return true;
28}

◆ maxeta()

__HOSTDEV__ float GeoRegion::maxeta ( ) const
inline

Definition at line 84 of file GeoRegion.h.

84{ return m_maxeta; };

◆ maxphi()

__HOSTDEV__ float GeoRegion::maxphi ( ) const
inline

Definition at line 86 of file GeoRegion.h.

86{ return m_maxphi; };

◆ mineta()

__HOSTDEV__ float GeoRegion::mineta ( ) const
inline

Definition at line 85 of file GeoRegion.h.

85{ return m_mineta; };

◆ mineta_raw()

__HOSTDEV__ float GeoRegion::mineta_raw ( ) const
inline

Definition at line 81 of file GeoRegion.h.

81{ return m_mineta_raw; };

◆ minphi()

__HOSTDEV__ float GeoRegion::minphi ( ) const
inline

Definition at line 87 of file GeoRegion.h.

87{ return m_minphi; };

◆ minphi_raw()

__HOSTDEV__ float GeoRegion::minphi_raw ( ) const
inline

Definition at line 82 of file GeoRegion.h.

82{ return m_minphi_raw; };

◆ raw_eta_position_to_index()

__HOSTDEV__ int GeoRegion::raw_eta_position_to_index ( float eta_raw) const
inline

Definition at line 89 of file GeoRegion.h.

89 {
90 return floor( ( eta_raw - m_mineta_raw ) / m_deta_double );
91 };

◆ raw_phi_position_to_index()

__HOSTDEV__ int GeoRegion::raw_phi_position_to_index ( float phi_raw) const
inline

Definition at line 92 of file GeoRegion.h.

92 {
93 return floor( ( phi_raw - m_minphi_raw ) / m_dphi_double );
94 };

◆ set_all_cells()

__HOSTDEV__ void GeoRegion::set_all_cells ( CaloDetDescrElement_Gpu * c)
inline

Definition at line 50 of file GeoRegion.h.

◆ set_cell_grid()

__HOSTDEV__ void GeoRegion::set_cell_grid ( long long * cells)
inline

Definition at line 73 of file GeoRegion.h.

◆ set_cell_grid_eta()

__HOSTDEV__ void GeoRegion::set_cell_grid_eta ( int i)
inline

Definition at line 53 of file GeoRegion.h.

53{ m_cell_grid_eta = i; };

◆ set_cell_grid_g()

__HOSTDEV__ void GeoRegion::set_cell_grid_g ( long long * cells)
inline

Definition at line 74 of file GeoRegion.h.

74{ m_cells_g = cells; };

◆ set_cell_grid_phi()

__HOSTDEV__ void GeoRegion::set_cell_grid_phi ( int i)
inline

Definition at line 54 of file GeoRegion.h.

54{ m_cell_grid_phi = i; };

◆ set_deta()

__HOSTDEV__ void GeoRegion::set_deta ( float f)
inline

Definition at line 69 of file GeoRegion.h.

◆ set_deta_double()

__HOSTDEV__ void GeoRegion::set_deta_double ( float f)
inline

Definition at line 71 of file GeoRegion.h.

71{ m_deta_double = f; };

◆ set_dphi()

__HOSTDEV__ void GeoRegion::set_dphi ( float f)
inline

Definition at line 70 of file GeoRegion.h.

70{ m_dphi = f; };

◆ set_dphi_double()

__HOSTDEV__ void GeoRegion::set_dphi_double ( float f)
inline

Definition at line 72 of file GeoRegion.h.

72{ m_dphi_double = f; };

◆ set_eta_correction()

__HOSTDEV__ void GeoRegion::set_eta_correction ( float f)
inline

Definition at line 67 of file GeoRegion.h.

67{ m_eta_correction = f; };

◆ set_index()

__HOSTDEV__ void GeoRegion::set_index ( int i)
inline

Definition at line 52 of file GeoRegion.h.

52{ m_index = i; };

◆ set_maxeta()

__HOSTDEV__ void GeoRegion::set_maxeta ( float f)
inline

Definition at line 56 of file GeoRegion.h.

56{ m_maxeta = f; };

◆ set_maxeta_correction()

__HOSTDEV__ void GeoRegion::set_maxeta_correction ( float f)
inline

Definition at line 64 of file GeoRegion.h.

◆ set_maxeta_raw()

__HOSTDEV__ void GeoRegion::set_maxeta_raw ( float f)
inline

Definition at line 62 of file GeoRegion.h.

62{ m_maxeta_raw = f; };

◆ set_maxphi()

__HOSTDEV__ void GeoRegion::set_maxphi ( float f)
inline

Definition at line 58 of file GeoRegion.h.

58{ m_maxphi = f; };

◆ set_maxphi_correction()

__HOSTDEV__ void GeoRegion::set_maxphi_correction ( float f)
inline

Definition at line 66 of file GeoRegion.h.

◆ set_maxphi_raw()

__HOSTDEV__ void GeoRegion::set_maxphi_raw ( float f)
inline

Definition at line 60 of file GeoRegion.h.

60{ m_maxphi_raw = f; };

◆ set_mineta()

__HOSTDEV__ void GeoRegion::set_mineta ( float f)
inline

Definition at line 55 of file GeoRegion.h.

55{ m_mineta = f; };

◆ set_mineta_correction()

__HOSTDEV__ void GeoRegion::set_mineta_correction ( float f)
inline

Definition at line 63 of file GeoRegion.h.

◆ set_mineta_raw()

__HOSTDEV__ void GeoRegion::set_mineta_raw ( float f)
inline

Definition at line 61 of file GeoRegion.h.

61{ m_mineta_raw = f; };

◆ set_minphi()

__HOSTDEV__ void GeoRegion::set_minphi ( float f)
inline

Definition at line 57 of file GeoRegion.h.

57{ m_minphi = f; };

◆ set_minphi_correction()

__HOSTDEV__ void GeoRegion::set_minphi_correction ( float f)
inline

Definition at line 65 of file GeoRegion.h.

◆ set_minphi_raw()

__HOSTDEV__ void GeoRegion::set_minphi_raw ( float f)
inline

Definition at line 59 of file GeoRegion.h.

59{ m_minphi_raw = f; };

◆ set_phi_correction()

__HOSTDEV__ void GeoRegion::set_phi_correction ( float f)
inline

Definition at line 68 of file GeoRegion.h.

68{ m_phi_correction = f; };

◆ set_xy_grid_adjustment_factor()

__HOSTDEV__ void GeoRegion::set_xy_grid_adjustment_factor ( float f)
inline

Definition at line 51 of file GeoRegion.h.

Member Data Documentation

◆ m_all_cells

CaloDetDescrElement_Gpu* GeoRegion::m_all_cells
protected

Definition at line 105 of file GeoRegion.h.

◆ m_cell_grid_eta

int GeoRegion::m_cell_grid_eta
protected

Definition at line 109 of file GeoRegion.h.

◆ m_cell_grid_phi

int GeoRegion::m_cell_grid_phi
protected

Definition at line 109 of file GeoRegion.h.

◆ m_cells

long long* GeoRegion::m_cells
protected

Definition at line 103 of file GeoRegion.h.

◆ m_cells_g

long long* GeoRegion::m_cells_g
protected

Definition at line 104 of file GeoRegion.h.

◆ m_deta

float GeoRegion::m_deta
protected

Definition at line 113 of file GeoRegion.h.

◆ m_deta_double

float GeoRegion::m_deta_double
protected

Definition at line 114 of file GeoRegion.h.

◆ m_dphi

float GeoRegion::m_dphi
protected

Definition at line 113 of file GeoRegion.h.

◆ m_dphi_double

float GeoRegion::m_dphi_double
protected

Definition at line 114 of file GeoRegion.h.

◆ m_eta_correction

float GeoRegion::m_eta_correction
protected

Definition at line 113 of file GeoRegion.h.

◆ m_index

int GeoRegion::m_index
protected

Definition at line 108 of file GeoRegion.h.

◆ m_maxeta

float GeoRegion::m_maxeta
protected

Definition at line 110 of file GeoRegion.h.

◆ m_maxeta_correction

float GeoRegion::m_maxeta_correction
protected

Definition at line 112 of file GeoRegion.h.

◆ m_maxeta_raw

float GeoRegion::m_maxeta_raw
protected

Definition at line 111 of file GeoRegion.h.

◆ m_maxphi

float GeoRegion::m_maxphi
protected

Definition at line 110 of file GeoRegion.h.

◆ m_maxphi_correction

float GeoRegion::m_maxphi_correction
protected

Definition at line 112 of file GeoRegion.h.

◆ m_maxphi_raw

float GeoRegion::m_maxphi_raw
protected

Definition at line 111 of file GeoRegion.h.

◆ m_mineta

float GeoRegion::m_mineta
protected

Definition at line 110 of file GeoRegion.h.

◆ m_mineta_correction

float GeoRegion::m_mineta_correction
protected

Definition at line 112 of file GeoRegion.h.

◆ m_mineta_raw

float GeoRegion::m_mineta_raw
protected

Definition at line 111 of file GeoRegion.h.

◆ m_minphi

float GeoRegion::m_minphi
protected

Definition at line 110 of file GeoRegion.h.

◆ m_minphi_correction

float GeoRegion::m_minphi_correction
protected

Definition at line 112 of file GeoRegion.h.

◆ m_minphi_raw

float GeoRegion::m_minphi_raw
protected

Definition at line 111 of file GeoRegion.h.

◆ m_phi_correction

float GeoRegion::m_phi_correction
protected

Definition at line 113 of file GeoRegion.h.

◆ m_xy_grid_adjustment_factor

float GeoRegion::m_xy_grid_adjustment_factor
protected

Definition at line 107 of file GeoRegion.h.


The documentation for this class was generated from the following files: