ATLAS Offline Software
Loading...
Searching...
No Matches
P4BaseEEtaPhiM Class Referenceabstract

P4BaseEEtaPhiM is a base class for classes with 4-momentum behavior, for which E, eta, phi and M are natural parameters, which is typically the case for a calorimeter object. More...

#include <P4BaseEEtaPhiM.h>

Inheritance diagram for P4BaseEEtaPhiM:
Collaboration diagram for P4BaseEEtaPhiM:

Public Member Functions

virtual ~P4BaseEEtaPhiM ()
 virtual destructor needed for inheritance
double px () const
 {@ a la I4Momentum -like interface
double py () const
double pz () const
virtual double m () const =0
double m2 () const
double rapidity () const
double p () const
double p2 () const
virtual double eta () const =0
virtual double phi () const =0
virtual double e () const =0
double et () const
double pt () const
double iPt () const
double sinPhi () const
double cosPhi () const
double tanTh () const
double cosTh () const
double sinTh () const
double cotTh () const
CLHEP::HepLorentzVector hlv () const
std::ostream & dump (std::ostream &out) const
 Print I4Momentum content.

Detailed Description

P4BaseEEtaPhiM is a base class for classes with 4-momentum behavior, for which E, eta, phi and M are natural parameters, which is typically the case for a calorimeter object.

Any class deriving from it should implement e(), eta(), phi(), m().

Author
David Rousseau rouss.nosp@m.eau@.nosp@m.lal.i.nosp@m.n2p3.nosp@m..fr

Definition at line 32 of file P4BaseEEtaPhiM.h.

Constructor & Destructor Documentation

◆ ~P4BaseEEtaPhiM()

P4BaseEEtaPhiM::~P4BaseEEtaPhiM ( )
inlinevirtual

virtual destructor needed for inheritance

Definition at line 87 of file P4BaseEEtaPhiM.h.

88{}

Member Function Documentation

◆ cosPhi()

double P4BaseEEtaPhiM::cosPhi ( ) const
inline

Definition at line 166 of file P4BaseEEtaPhiM.h.

167{
168 return std::cos(this->phi());
169}
virtual double phi() const =0

◆ cosTh()

double P4BaseEEtaPhiM::cosTh ( ) const
inline

Definition at line 187 of file P4BaseEEtaPhiM.h.

188{
189 return std::tanh(this->eta());
190}
virtual double eta() const =0

◆ cotTh()

double P4BaseEEtaPhiM::cotTh ( ) const
inline

Definition at line 204 of file P4BaseEEtaPhiM.h.

205{
206 return std::sinh(this->eta());
207}

◆ dump()

std::ostream & P4BaseEEtaPhiM::dump ( std::ostream & out) const
inline

Print I4Momentum content.

Definition at line 231 of file P4BaseEEtaPhiM.h.

232{
233 std::stringstream s;
234 s << "[e,eta,phi,m] ="
235 << std::right << std::scientific << std::setprecision(8)
236 << std::setw(16) << this->e()
237 << std::setw(16) << this->eta()
238 << std::setw(16) << this->phi()
239 << std::setw(16) << this->m();
240
241 out << s.str();
242 return out;
243
244}
virtual double m() const =0
virtual double e() const =0

◆ e()

virtual double P4BaseEEtaPhiM::e ( ) const
pure virtual

◆ et()

double P4BaseEEtaPhiM::et ( ) const
inline

Definition at line 144 of file P4BaseEEtaPhiM.h.

145{
146 return this->e()*this->sinTh();
147}
double sinTh() const

◆ eta()

virtual double P4BaseEEtaPhiM::eta ( ) const
pure virtual

◆ hlv()

CLHEP::HepLorentzVector P4BaseEEtaPhiM::hlv ( ) const
inline

Definition at line 209 of file P4BaseEEtaPhiM.h.

210{
211 //minimize the number of calculation and dereference
212 const double theE = this->e();
213 const double theCosTh = this->cosTh();
214
215 // DR from Frank Paige
216 // negative energy point in opposite direction
217 // BUT Eta and Phi still the same
218 // double theP=theE;
219
220 const double theP = this->p();
221
222 const double theSinTh = std::sqrt(1.-theCosTh*theCosTh);
223 const double thePt = theP*theSinTh;
224 const double thePx = thePt*this->cosPhi();
225 const double thePy = thePt*this->sinPhi();
226 const double thePz = theP*theCosTh;
227
228 return CLHEP::HepLorentzVector(thePx,thePy,thePz,theE);
229}
double sinPhi() const
double cosPhi() const
double cosTh() const
double p() const

◆ iPt()

double P4BaseEEtaPhiM::iPt ( ) const
inline

Definition at line 161 of file P4BaseEEtaPhiM.h.

162{
163 return 1./this->pt();
164}
double pt() const

◆ m()

virtual double P4BaseEEtaPhiM::m ( ) const
pure virtual

◆ m2()

double P4BaseEEtaPhiM::m2 ( ) const
inline

Definition at line 105 of file P4BaseEEtaPhiM.h.

106{
107 const double mass = this->m();
108 return mass*mass;
109}

◆ p()

double P4BaseEEtaPhiM::p ( ) const
inline

Definition at line 111 of file P4BaseEEtaPhiM.h.

112{
113 const double theM=this->m();
114 const double theE=this->e();
115 // if (theM==0.) return theE ;
116 // else return sqrt(theE*theE-theM*theM);
117 //DR from Frank Paige
118 // if negative energy point in the opposite direction
119 // BUT eta and phi still the same !!!
120 if (theM==0.) {
121 return theE;
122 } else {
123 double eSign = (theE >= 0.) ? +1. : -1.;
124 return eSign*std::sqrt(theE*theE-theM*theM);
125 }
126
127}

◆ p2()

double P4BaseEEtaPhiM::p2 ( ) const
inline

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.

Definition at line 129 of file P4BaseEEtaPhiM.h.

130{
138 const double mass = this->m();
139 const double ene = this->e();
140
141 return ene*ene - mass*mass;
142}

◆ phi()

virtual double P4BaseEEtaPhiM::phi ( ) const
pure virtual

◆ pt()

double P4BaseEEtaPhiM::pt ( void ) const
inline

Definition at line 156 of file P4BaseEEtaPhiM.h.

157{
158 return this->p()*this->sinTh();
159}

◆ px()

double P4BaseEEtaPhiM::px ( ) const
inline

{@ a la I4Momentum -like interface

Definition at line 90 of file P4BaseEEtaPhiM.h.

91{
92 return this->pt()*cos(this->phi());
93}

◆ py()

double P4BaseEEtaPhiM::py ( ) const
inline

Definition at line 95 of file P4BaseEEtaPhiM.h.

96{
97 return this->pt()*sin(this->phi());
98}

◆ pz()

double P4BaseEEtaPhiM::pz ( ) const
inline

Definition at line 100 of file P4BaseEEtaPhiM.h.

101{
102 return this->p()*this->cosTh();
103}

◆ rapidity()

double P4BaseEEtaPhiM::rapidity ( ) const
inline

Definition at line 149 of file P4BaseEEtaPhiM.h.

150 {
151 const double theE=this->e();
152 const double thePz=this->pz();
153 return 0.5*std::log((theE+thePz)/(theE-thePz));
154 }
double pz() const

◆ sinPhi()

double P4BaseEEtaPhiM::sinPhi ( ) const
inline

Definition at line 171 of file P4BaseEEtaPhiM.h.

172{
173 return std::sin(this->phi());
174}

◆ sinTh()

double P4BaseEEtaPhiM::sinTh ( ) const
inline

Definition at line 192 of file P4BaseEEtaPhiM.h.

193{
194 // avoid numeric overflow if very large eta
195
196 double aEta=std::abs(this->eta());
197 if ( aEta>710) {
198 aEta=710;
199 }
200
201 return 1./std::cosh(aEta);
202}

◆ tanTh()

double P4BaseEEtaPhiM::tanTh ( ) const
inline

Definition at line 177 of file P4BaseEEtaPhiM.h.

178{
179 double theEta=this->eta();
180 if ( std::abs(theEta)>710) {
181 theEta=theEta>0 ? 710 : -710;
182 return 1./std::sinh(theEta);
183 }
184 return 1./this->cotTh();
185}
double cotTh() const

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