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

Evaluate cell kinematics with a different vertex. More...

#include <CaloVertexedCell.h>

Inheritance diagram for CaloVertexedCell:
Collaboration diagram for CaloVertexedCell:

Classes

struct  compE
 Helper to compare two of these objects by energy. More...

Public Types

enum  Kind {
  P4EETAPHIM , P4IPTCOTTHPHIM , P4PTETAPHIM , P4PXPYPZE ,
  UNKNOWN
}

Public Member Functions

 CaloVertexedCell (const CaloCell &cell)
 Constructor.
 CaloVertexedCell (const CaloCell &cell, const Amg::Vector3D &vx)
 Constructor.
const CaloCellcell () const
 Return the cell being proxied,.
virtual double eta () const final
 The pseudorapidity of the particle.
virtual double phi () const final
 The aximuthal angle of the particle.
virtual double e () const final
 The energy of the particle.
virtual double m () const final
 The mass of the particle.
virtual double sinTh () const final
 The sine of the polar angle of the particle.
virtual double cosTh () const final
 The cosine of the polar angle of the particle.
virtual double sinPhi () const final
 The sine of the azimuthal angle of the particle.
virtual double cosPhi () const final
 The cosine of the azimuthal angle of the particle.
double energy () const
 The energy of the particle.
virtual double px () const
 x component of momentum
virtual double py () const
 y component of momentum
virtual double pz () const
 z component of momentum
virtual double et () const
 transverse energy defined to be e*sin(theta)
virtual double p () const
 magnitude of 3-momentum.
virtual double p2 () const
 square of momentum magnitude
virtual double m2 () const
 mass squared
virtual double pt () const
 transverse momentum
virtual double iPt () const
 inverse of transverse momentum
virtual double rapidity () const
 rapidity
virtual double cotTh () const
 cottan theta
virtual double tanTh () const
 tan theta
virtual CLHEP::HepLorentzVector hlv () const
 HepLorentzVector Special implementation from Frank Paige : if negative energy, points in opposite direction but eta and phi still the same.
virtual const I4MomentumErrorerrors () const
 Access to errors, if available; returns 0 if no errors.
virtual void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION
virtual void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer DUMMY IMPLEMENTATION
virtual void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set all 4-mom from a CLHEP HepLorentzVector DUMMY IMPLEMENTATION
I4Momentum::Kind kind () const
 tells what kind of P4XYZT this is
virtual std::ostream & dump (std::ostream &out=std::cout) const
 Print I4Momentum content.

Private Member Functions

void computeVertexCorr (const Amg::Vector3D &vx)
 Calculate cell kinematics for a given vertex.

Private Attributes

const CaloCellm_cell
 The cell being proxied.
double m_eta
 The recalculated cell eta.
double m_phi
 The recalculated cell phi.
double m_sinth
 The recalculated cell sin(theta).
double m_costh
 The recalculated cell cos(theta).
double m_sinph
 The recalculated cell sin(phi).
double m_cosph
 The recalculated cell cos(phi).

Detailed Description

Evaluate cell kinematics with a different vertex.

This class acts as a proxy for a cell object. It the same I4Momentum interface, except that the cell kinematics are recalculated for a different vertex.

Definition at line 35 of file CaloVertexedCell.h.

Member Enumeration Documentation

◆ Kind

enum I4Momentum::Kind
inherited
Enumerator
P4EETAPHIM 
P4IPTCOTTHPHIM 
P4PTETAPHIM 
P4PXPYPZE 
UNKNOWN 

Definition at line 33 of file I4Momentum.h.

Constructor & Destructor Documentation

◆ CaloVertexedCell() [1/2]

CaloVertexedCell::CaloVertexedCell ( const CaloCell & cell)

Constructor.

Parameters
cellThe cell to proxy.

In this case, we'll return unchanged the kinematics of the cell.

Definition at line 24 of file CaloVertexedCell.cxx.

25 : m_cell (&cell),
26 m_eta (cell.eta()),
27 m_phi (cell.phi()),
28 m_sinth (cell.sinTh()),
29 m_costh (cell.cosTh()),
30 m_sinph (cell.sinPhi()),
31 m_cosph (cell.cosPhi())
32{
33}
double m_eta
The recalculated cell eta.
double m_cosph
The recalculated cell cos(phi).
const CaloCell & cell() const
Return the cell being proxied,.
double m_sinth
The recalculated cell sin(theta).
double m_sinph
The recalculated cell sin(phi).
double m_phi
The recalculated cell phi.
double m_costh
The recalculated cell cos(theta).
const CaloCell * m_cell
The cell being proxied.

◆ CaloVertexedCell() [2/2]

CaloVertexedCell::CaloVertexedCell ( const CaloCell & cell,
const Amg::Vector3D & vx )

Constructor.

Parameters
cellThe cell to proxy.
vxThe vertex to use for calculating cell kinematics.

In this case, we'll return the kinematics of the cell relative to vertex vx.

Definition at line 44 of file CaloVertexedCell.cxx.

46 : m_cell (&cell),
47 m_eta (cell.eta()),
48 m_phi (cell.phi()),
49 m_sinth (cell.sinTh()),
50 m_costh (cell.cosTh()),
51 m_sinph (cell.sinPhi()),
52 m_cosph (cell.cosPhi())
53{
55}
void computeVertexCorr(const Amg::Vector3D &vx)
Calculate cell kinematics for a given vertex.

Member Function Documentation

◆ cell()

const CaloCell & CaloVertexedCell::cell ( ) const
inline

Return the cell being proxied,.

Definition at line 62 of file CaloVertexedCell.h.

62{ return *m_cell; }

◆ computeVertexCorr()

void CaloVertexedCell::computeVertexCorr ( const Amg::Vector3D & vx)
private

Calculate cell kinematics for a given vertex.

Parameters
vxThe vertex to use for calculating cell kinematics.

Definition at line 63 of file CaloVertexedCell.cxx.

64{
65 const CaloDetDescrElement& dd = *m_cell->caloDDE();
66 m_eta += ((vx.x()*dd.cosPhi()+vx.y()*dd.sinPhi())*dd.cosTh()-vx.z()*dd.sinTh())/dd.r();
67 m_phi += (vx.x()*dd.sinPhi()-vx.y()*dd.cosPhi())/dd.r() ;
68
69 m_sinth += (vx.z()*dd.sinTh() - (vx.x()*dd.cosPhi() + vx.y()*dd.sinPhi())*dd.cosTh()) * dd.cosTh()*dd.sinTh()/dd.r();
70 m_costh += - (vx.z()*dd.sinTh() - (vx.x()*dd.cosPhi() + vx.y()*dd.sinPhi())*dd.cosTh()) * dd.sinTh()*dd.sinTh()/dd.r();
71
72 m_sinph += - ( vx.y()*dd.cosPhi() - vx.x()*dd.sinPhi())*dd.cosPhi()/dd.r();
73 m_cosph += + ( vx.y()*dd.cosPhi() - vx.x()*dd.sinPhi())*dd.sinPhi()/dd.r();
74}
float cosPhi() const
for fast px py pz computation
float sinTh() const
for algorithm working in transverse Energy
float sinPhi() const
for fast px py pz computation

◆ cosPhi()

virtual double CaloVertexedCell::cosPhi ( ) const
inlinefinalvirtual

The cosine of the azimuthal angle of the particle.

Reimplemented from P4EEtaPhiMBase.

Definition at line 86 of file CaloVertexedCell.h.

86{ return m_cosph; }

◆ cosTh()

virtual double CaloVertexedCell::cosTh ( ) const
inlinefinalvirtual

The cosine of the polar angle of the particle.

Reimplemented from P4EEtaPhiMBase.

Definition at line 80 of file CaloVertexedCell.h.

80{ return m_costh; }

◆ cotTh()

double P4EEtaPhiMBase::cotTh ( ) const
virtualinherited

cottan theta

Implements I4Momentum.

Reimplemented in CaloCell.

Definition at line 77 of file P4EEtaPhiMBase.cxx.

78{
79 return std::sinh(this->eta());
80}
virtual double eta() const =0
pseudo rapidity

◆ dump()

std::ostream & P4EEtaPhiMBase::dump ( std::ostream & out = std::cout) const
virtualinherited

Print I4Momentum content.

Implements I4Momentum.

Definition at line 159 of file P4EEtaPhiMBase.cxx.

160{
161
162 std::stringstream outx;
163 outx << "[e,eta,phi,m] ="
164 << std::right << std::scientific << std::setprecision(8)
165 << std::setw(16) << this->e()
166 << std::setw(16) << this->eta()
167 << std::setw(16) << this->phi()
168 << std::setw(16) << this->m();
169
170 out<<outx.str();
171
172 return out;
173}
virtual double m() const =0
mass
virtual double phi() const =0
phi in [-pi,pi[
virtual double e() const =0
energy

◆ e()

virtual double CaloVertexedCell::e ( ) const
inlinefinalvirtual

The energy of the particle.

Implements I4Momentum.

Definition at line 71 of file CaloVertexedCell.h.

71{ return m_cell->e(); }

◆ energy()

double CaloVertexedCell::energy ( ) const
inline

The energy of the particle.

Definition at line 89 of file CaloVertexedCell.h.

89{ return m_cell->energy(); }

◆ errors()

const I4MomentumError * P4EEtaPhiMBase::errors ( ) const
virtualinherited

Access to errors, if available; returns 0 if no errors.

Implements I4Momentum.

Reimplemented in P4EEtaPhiM.

Definition at line 175 of file P4EEtaPhiMBase.cxx.

176{
177 return 0;
178}

◆ et()

double P4EEtaPhiMBase::et ( ) const
virtualinherited

transverse energy defined to be e*sin(theta)

Implements I4Momentum.

Reimplemented in CaloCell.

Definition at line 106 of file P4EEtaPhiMBase.cxx.

107 {
108 return this->e()*this->sinTh();
109 }
virtual double sinTh() const
sinus theta

◆ eta()

virtual double CaloVertexedCell::eta ( void ) const
inlinefinalvirtual

The pseudorapidity of the particle.

Implements I4Momentum.

Definition at line 65 of file CaloVertexedCell.h.

65{ return m_eta; }

◆ hlv()

CLHEP::HepLorentzVector P4EEtaPhiMBase::hlv ( ) const
virtualinherited

HepLorentzVector Special implementation from Frank Paige : if negative energy, points in opposite direction but eta and phi still the same.

Implements I4Momentum.

Reimplemented in CaloCluster.

Definition at line 134 of file P4EEtaPhiMBase.cxx.

135{
136 //minimize the number of calculation and dereference
137 const double theCosTh=this->cosTh();
138
139 // DR from Frank Paige
140 // negative energy point in opposite direction
141 // BUT Eta and Phi still the same
142 // double theP=theE;
143
144 const double theP=this->p();
145
146 const double theSinTh=std::sqrt(1.-theCosTh*theCosTh);
147 const double thePt=theP*theSinTh;
148 const double thePx=thePt*this->cosPhi();
149 const double thePy=thePt*this->sinPhi();
150 const double thePz=theP*theCosTh;
151
152
153 return CLHEP::HepLorentzVector(thePx,thePy,thePz,this->e());
154
155}
virtual double cosPhi() const
cosinus phi
virtual double p() const
magnitude of 3-momentum.
virtual double sinPhi() const
sinus phi
virtual double cosTh() const
cosinus theta

◆ iPt()

double P4EEtaPhiMBase::iPt ( ) const
virtualinherited

inverse of transverse momentum

Implements I4Momentum.

Definition at line 111 of file P4EEtaPhiMBase.cxx.

112 { return 1./this->pt();
113 }
virtual double pt() const
transverse momentum

◆ kind()

I4Momentum::Kind P4EEtaPhiMBase::kind ( ) const
inlinevirtualinherited

tells what kind of P4XYZT this is

Implements I4Momentum.

Definition at line 65 of file P4EEtaPhiMBase.h.

65{ return I4Momentum::P4EETAPHIM; };

◆ m()

virtual double CaloVertexedCell::m ( void ) const
inlinefinalvirtual

The mass of the particle.

Implements I4Momentum.

Definition at line 74 of file CaloVertexedCell.h.

74{ return m_cell->m(); }

◆ m2()

double P4EEtaPhiMBase::m2 ( ) const
virtualinherited

mass squared

Implements I4Momentum.

Definition at line 14 of file P4EEtaPhiMBase.cxx.

14 {
15 const double theM = this->m();
16 return theM*theM;
17}

◆ p()

double P4EEtaPhiMBase::p ( ) const
virtualinherited

magnitude of 3-momentum.

Special implementation from Frank Paige : if negative energy p is negative but eta and phi still the same.

Implements I4Momentum.

Definition at line 21 of file P4EEtaPhiMBase.cxx.

22{
23 const double theM=this->m();
24 const double theE=this->e();
25 // if (theM==0.) return theE ;
26 // else return sqrt(theE*theE-theM*theM);
27 //DR from Frank Paige
28 // if negative energy point in the opposite direction
29 // BUT eta and phi still the same !!!
30 if (theM==0.) {
31 return theE;
32 } else {
33 double eSign = (theE >= 0) ? +1 : -1;
34 return eSign*std::sqrt(theE*theE-theM*theM);
35 }
36
37}

◆ p2()

double P4EEtaPhiMBase::p2 ( ) const
virtualinherited

square of momentum magnitude

This p2() implementaion is derived from the (somewhat unusual) Frank Paige implementation used to calculate p() above. What we do is look at what would happen if we were to square the answer returned by Frank's algorithm:

(1) The "eSign" would square to +1 and disappear, (2) The sqrt would disappear leaving theE*theE-theM*theM (3) In the event that theM==0, this theE*theE would indeed still equal theE*theE-theM*theM, so we simply return this quantity.

Implements I4Momentum.

Definition at line 39 of file P4EEtaPhiMBase.cxx.

40{
48 const double theM=this->m();
49 const double theE=this->e();
50
51 return theE*theE-theM*theM;
52}

◆ phi()

virtual double CaloVertexedCell::phi ( void ) const
inlinefinalvirtual

The aximuthal angle of the particle.

Implements I4Momentum.

Definition at line 68 of file CaloVertexedCell.h.

68{ return m_phi; }

◆ pt()

double P4EEtaPhiMBase::pt ( ) const
virtualinherited

transverse momentum

Implements I4Momentum.

Definition at line 101 of file P4EEtaPhiMBase.cxx.

102 {
103 return this->p()*this->sinTh();
104 }

◆ px()

double P4EEtaPhiMBase::px ( ) const
virtualinherited

x component of momentum

Implements I4Momentum.

Definition at line 122 of file P4EEtaPhiMBase.cxx.

123 { return this->pt()*this->cosPhi();
124 }

◆ py()

double P4EEtaPhiMBase::py ( ) const
virtualinherited

y component of momentum

Implements I4Momentum.

Definition at line 126 of file P4EEtaPhiMBase.cxx.

127 { return this->pt()*this->sinPhi();
128 }

◆ pz()

double P4EEtaPhiMBase::pz ( ) const
virtualinherited

z component of momentum

Implements I4Momentum.

Definition at line 130 of file P4EEtaPhiMBase.cxx.

131 { return this->p()*this->cosTh();
132 }

◆ rapidity()

double P4EEtaPhiMBase::rapidity ( ) const
virtualinherited

rapidity

Implements I4Momentum.

Definition at line 115 of file P4EEtaPhiMBase.cxx.

116 {
117 const double theE=this->e();
118 const double thePz=this->pz();
119 return 0.5*std::log((theE+thePz)/(theE-thePz));
120 }
virtual double pz() const
z component of momentum

◆ set4Mom() [1/3]

void P4EEtaPhiMBase::set4Mom ( const CLHEP::HepLorentzVector & theHlv)
virtualinherited

set all 4-mom from a CLHEP HepLorentzVector DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in CaloCell, CaloCluster, and P4EEtaPhiM.

Definition at line 194 of file P4EEtaPhiMBase.cxx.

195{
196 std::cout << "FATAL ERROR dummy P4EEtaPhiMBase::set4Mom called " << std::endl ;
197 std::abort();
198}

◆ set4Mom() [2/3]

void P4EEtaPhiMBase::set4Mom ( const I4Momentum & theI4Mom)
virtualinherited

set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in CaloCell, CaloCluster, and P4EEtaPhiM.

Definition at line 181 of file P4EEtaPhiMBase.cxx.

182{
183 std::cout << "FATAL ERROR dummy P4EEtaPhiMBase::set4Mom called " << std::endl; ;
184 std::abort();
185}

◆ set4Mom() [3/3]

void P4EEtaPhiMBase::set4Mom ( const I4Momentum *const theI4Mom)
virtualinherited

set all 4-mom from another I4Momentum pointer DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in CaloCell, CaloCluster, and P4EEtaPhiM.

Definition at line 187 of file P4EEtaPhiMBase.cxx.

188{
189 std::cout << "FATAL ERROR dummy P4EEtaPhiMBase::set4Mom called " << std::endl ;
190 std::abort();
191
192}

◆ sinPhi()

virtual double CaloVertexedCell::sinPhi ( ) const
inlinefinalvirtual

The sine of the azimuthal angle of the particle.

Reimplemented from P4EEtaPhiMBase.

Definition at line 83 of file CaloVertexedCell.h.

83{ return m_sinph; }

◆ sinTh()

virtual double CaloVertexedCell::sinTh ( ) const
inlinefinalvirtual

The sine of the polar angle of the particle.

Reimplemented from P4EEtaPhiMBase.

Definition at line 77 of file CaloVertexedCell.h.

77{ return m_sinth; }

◆ tanTh()

double P4EEtaPhiMBase::tanTh ( ) const
virtualinherited

tan theta

Implements I4Momentum.

Definition at line 64 of file P4EEtaPhiMBase.cxx.

65{
66 // avoid numeric overflow if very large eta
67
68 double theEta=this->eta();
69 if ( std::abs(theEta)>710) {
70 theEta=theEta>0 ? 710 : -710;
71 return 1./std::sinh(theEta);
72 }
73
74 return 1./this->cotTh();
75}
virtual double cotTh() const
cottan theta

Member Data Documentation

◆ m_cell

const CaloCell* CaloVertexedCell::m_cell
private

The cell being proxied.

Definition at line 113 of file CaloVertexedCell.h.

◆ m_cosph

double CaloVertexedCell::m_cosph
private

The recalculated cell cos(phi).

Definition at line 131 of file CaloVertexedCell.h.

◆ m_costh

double CaloVertexedCell::m_costh
private

The recalculated cell cos(theta).

Definition at line 125 of file CaloVertexedCell.h.

◆ m_eta

double CaloVertexedCell::m_eta
private

The recalculated cell eta.

Definition at line 116 of file CaloVertexedCell.h.

◆ m_phi

double CaloVertexedCell::m_phi
private

The recalculated cell phi.

Definition at line 119 of file CaloVertexedCell.h.

◆ m_sinph

double CaloVertexedCell::m_sinph
private

The recalculated cell sin(phi).

Definition at line 128 of file CaloVertexedCell.h.

◆ m_sinth

double CaloVertexedCell::m_sinth
private

The recalculated cell sin(theta).

Definition at line 122 of file CaloVertexedCell.h.


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