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

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

#include <P4BasePtEtaPhiM.h>

Inheritance diagram for P4BasePtEtaPhiM:
Collaboration diagram for P4BasePtEtaPhiM:

Public Member Functions

virtual ~P4BasePtEtaPhiM ()
 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 p () const
double p2 () const
virtual double eta () const =0
virtual double phi () const =0
double e () const
double et () const
virtual double pt () const =0
double iPt () const
double rapidity () const
double cosPhi () const
double sinPhi () 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

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

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

Author
Olga Igonkina olya@.nosp@m.cern.nosp@m..ch

Definition at line 32 of file P4BasePtEtaPhiM.h.

Constructor & Destructor Documentation

◆ ~P4BasePtEtaPhiM()

P4BasePtEtaPhiM::~P4BasePtEtaPhiM ( )
inlinevirtual

virtual destructor needed for inheritance

Definition at line 92 of file P4BasePtEtaPhiM.h.

93{}

Member Function Documentation

◆ cosPhi()

double P4BasePtEtaPhiM::cosPhi ( ) const
inline

Definition at line 172 of file P4BasePtEtaPhiM.h.

173{
174 return std::cos(this->phi());
175}
virtual double phi() const =0

◆ cosTh()

double P4BasePtEtaPhiM::cosTh ( ) const
inline

Definition at line 184 of file P4BasePtEtaPhiM.h.

185{
186 return std::tanh(this->eta());
187}
virtual double eta() const =0

◆ cotTh()

double P4BasePtEtaPhiM::cotTh ( ) const
inline

Definition at line 201 of file P4BasePtEtaPhiM.h.

202{
203 return std::sinh(this->eta());
204}

◆ dump()

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

Print I4Momentum content.

Definition at line 236 of file P4BasePtEtaPhiM.h.

237{
238 std::stringstream s;
239 s << "[pt,eta,phi,m] ="
240 << std::right << std::scientific << std::setprecision(8)
241 << std::setw(16) << this->pt()
242 << std::setw(16) << this->eta()
243 << std::setw(16) << this->phi()
244 << std::setw(16) << this->m();
245
246 out << s.str();
247 return out;
248}
virtual double m() const =0
virtual double pt() const =0

◆ e()

double P4BasePtEtaPhiM::e ( ) const
inline

Definition at line 141 of file P4BasePtEtaPhiM.h.

142{
143 const double theMass = this->m();
144 const double thePt = this->pt();
145 const double thePz = this->pz();
146
147 //DR from Frank Paige
148 // if negative pt point in the opposite direction
149 // BUT eta and phi still the same !!!
150
151 const double eSign = (thePt >= 0.) ? +1. : -1.;
152 return eSign * std::sqrt( thePt*thePt + thePz*thePz + theMass*theMass);
153}
double pz() const

◆ et()

double P4BasePtEtaPhiM::et ( ) const
inline

Definition at line 155 of file P4BasePtEtaPhiM.h.

156{
157 return this->e()*this->sinTh();
158}
double e() const
double sinTh() const

◆ eta()

virtual double P4BasePtEtaPhiM::eta ( ) const
pure virtual

◆ hlv()

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

Definition at line 217 of file P4BasePtEtaPhiM.h.

218{
219 //minimize the number of calculation and dereference
220 const double theM = this->m();
221 // note that pt can have negative sign : then it points in opposite direction but eta and phi are still on the same side
222 const double thePt = this->pt();
223
224
225 const double thePx = thePt*this->cosPhi();
226 const double thePy = thePt*this->sinPhi();
227
228 const double thePz = thePt*this->cotTh();
229
230 const double theE=std::sqrt(thePt*thePt+thePz*thePz+theM*theM);
231
232
233 return CLHEP::HepLorentzVector( thePx, thePy, thePz, theE );
234}
double cosPhi() const
double sinPhi() const
double cotTh() const

◆ iPt()

double P4BasePtEtaPhiM::iPt ( ) const
inline

Definition at line 160 of file P4BasePtEtaPhiM.h.

161{
162 return 1./this->pt();
163}

◆ m()

virtual double P4BasePtEtaPhiM::m ( ) const
pure virtual

◆ m2()

double P4BasePtEtaPhiM::m2 ( ) const
inline

Definition at line 110 of file P4BasePtEtaPhiM.h.

111{
112 const double mass = this->m();
113 return mass*mass;
114}

◆ p()

double P4BasePtEtaPhiM::p ( ) const
inline

Definition at line 116 of file P4BasePtEtaPhiM.h.

117{
118 const double thePt = this->pt();
119 const double thePz = this->pz();
120
121 //DR from Frank Paige
122 // if negative pt point in the opposite direction
123 // BUT eta and phi still the same !!!
124
125 const double eSign = (thePt >= 0.) ? +1. : -1.;
126 return eSign * std::sqrt( thePt*thePt + thePz*thePz );
127}

◆ p2()

double P4BasePtEtaPhiM::p2 ( ) const
inline

Definition at line 129 of file P4BasePtEtaPhiM.h.

130{
131 // This method has been implemented so as to give the same as would be
132 // obtained from pow((this->p()),2) with this->p() implemented according to
133 // Frank Paige's algorithm above.
134
135 const double pt = this->pt();
136 const double pz = this->pz();
137
138 return pt*pt + pz*pz;
139}

◆ phi()

virtual double P4BasePtEtaPhiM::phi ( ) const
pure virtual

◆ pt()

virtual double P4BasePtEtaPhiM::pt ( ) const
pure virtual

◆ px()

double P4BasePtEtaPhiM::px ( ) const
inline

{@ a la I4Momentum -like interface

Definition at line 95 of file P4BasePtEtaPhiM.h.

96{
97 return this->pt() * std::cos(this->phi());
98}

◆ py()

double P4BasePtEtaPhiM::py ( ) const
inline

Definition at line 100 of file P4BasePtEtaPhiM.h.

101{
102 return this->pt() * std::sin(this->phi());
103}

◆ pz()

double P4BasePtEtaPhiM::pz ( ) const
inline

Definition at line 105 of file P4BasePtEtaPhiM.h.

106{
107 return this->pt()/this->tanTh();
108}
double tanTh() const

◆ rapidity()

double P4BasePtEtaPhiM::rapidity ( ) const
inline

Definition at line 165 of file P4BasePtEtaPhiM.h.

166 {
167 const double theE=this->e();
168 const double thePz=this->pz();
169 return 0.5*std::log((theE+thePz)/(theE-thePz));
170 }

◆ sinPhi()

double P4BasePtEtaPhiM::sinPhi ( ) const
inline

Definition at line 177 of file P4BasePtEtaPhiM.h.

178{
179 return std::sin(this->phi());
180}

◆ sinTh()

double P4BasePtEtaPhiM::sinTh ( ) const
inline

Definition at line 189 of file P4BasePtEtaPhiM.h.

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

◆ tanTh()

double P4BasePtEtaPhiM::tanTh ( ) const
inline

Definition at line 206 of file P4BasePtEtaPhiM.h.

207{
208 return 1./std::sinh(this->eta());
209}

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