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

P4PxPyPzE is a class with 4-momentum behavior, for which Px, Py, Pz and M are data members. More...

#include <P4PxPyPzE.h>

Inheritance diagram for P4PxPyPzE:
Collaboration diagram for P4PxPyPzE:

Public Types

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

Public Member Functions

 P4PxPyPzE (const double px, const double py, const double pz, const double e)
 constructor with all data members
 P4PxPyPzE (const CLHEP::HepLorentzVector &theHlv)
 constructor from hlv to allow conversion from hlv
 P4PxPyPzE (const I4Momentum &theI4M)
 constructor from any I4Momentum reference
 P4PxPyPzE (const I4Momentum *const theI4M)
 constructor from any I4Momentum pointer
 P4PxPyPzE ()
 default constructor
virtual double px () const
 get px data member
virtual double py () const
 get py data member
virtual double pz () const
 get pz data member
virtual double e () const
 get energy data member
virtual void setPx (double thePx)
 set Px data member
virtual void setPy (double thePy)
 set Py data member
virtual void setPz (double thePz)
 set Pz data member
virtual void setE (double theE)
 set energy data member
virtual void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference
virtual void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer
virtual void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set all 4-mom from CLHEP HepLorentzVector
virtual const I4MomentumErrorerrors () const
 Access to errors, if available; returns 0 if no errors.
double pxi () const
 Experimental : inlined function to get px without going through virtual inheritance.
double pyi () const
 Experimental : inlined function to get py without going through virtual inheritance.
double pzi () const
 Experimental : inlined function to get pz without going through virtual inheritance.
double ei () const
 Experimental : inlined function to get e without going through virtual inheritance.
double pti () const
 Experimental : inlined function to get pt without going through virtual inheritance.
virtual double m () const
 mass
virtual double m2 () const
 mass squared
virtual double eta () const
 pseudo rapidity
virtual double phi () const
 phi in [-pi,pi[
virtual double p () const
 momentum magnitude
virtual double p2 () const
 square of momentum magnitude
virtual double pt () const
 transverse momentum
virtual double et () const
 transverse energy defined to be e*sin(theta)
virtual double iPt () const
 inverse of transverse momentum
virtual double rapidity () const
 rapidity
virtual double cosPhi () const
 cosinus phi
virtual double sinPhi () const
 sinus phi
virtual double tanTh () const
 tan theta
virtual double cotTh () const
 cottan theta
virtual double cosTh () const
 cosinus theta
virtual double sinTh () const
 sinus theta
virtual CLHEP::HepLorentzVector hlv () const
 CLHEP HepLorentzVector.
virtual I4Momentum::Kind kind () const
 tells what kind of P4XYZT this is
virtual std::ostream & dump (std::ostream &out) const
 Print I4Momentum content.

Protected Attributes

double m_px
double m_py
double m_pz
double m_e

Detailed Description

P4PxPyPzE is a class with 4-momentum behavior, for which Px, Py, Pz and M are data members.

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

Definition at line 28 of file P4PxPyPzE.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

◆ P4PxPyPzE() [1/5]

P4PxPyPzE::P4PxPyPzE ( const double px,
const double py,
const double pz,
const double e )
inline

constructor with all data members

Definition at line 104 of file P4PxPyPzE.h.

104 :
105 m_px(px),m_py(py),m_pz(pz),m_e(e)
106{
107}
virtual double e() const
get energy data member
Definition P4PxPyPzE.h:132
double m_e
Definition P4PxPyPzE.h:92
double m_pz
Definition P4PxPyPzE.h:91
double m_px
Definition P4PxPyPzE.h:89
double m_py
Definition P4PxPyPzE.h:90
virtual double px() const
get px data member
Definition P4PxPyPzE.h:122
virtual double py() const
get py data member
Definition P4PxPyPzE.h:126
virtual double pz() const
get pz data member
Definition P4PxPyPzE.h:129

◆ P4PxPyPzE() [2/5]

P4PxPyPzE::P4PxPyPzE ( const CLHEP::HepLorentzVector & theHlv)
inline

constructor from hlv to allow conversion from hlv

Definition at line 109 of file P4PxPyPzE.h.

110{
111 this->set4Mom(theHlv);
112}
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition P4PxPyPzE.h:147

◆ P4PxPyPzE() [3/5]

P4PxPyPzE::P4PxPyPzE ( const I4Momentum & theI4M)
inline

constructor from any I4Momentum reference

Definition at line 114 of file P4PxPyPzE.h.

115{this->set4Mom(theI4Mom); }

◆ P4PxPyPzE() [4/5]

P4PxPyPzE::P4PxPyPzE ( const I4Momentum *const theI4M)
inline

constructor from any I4Momentum pointer

Definition at line 117 of file P4PxPyPzE.h.

118{this->set4Mom(*theI4Mom); }

◆ P4PxPyPzE() [5/5]

P4PxPyPzE::P4PxPyPzE ( )
inline

default constructor

Definition at line 96 of file P4PxPyPzE.h.

96 :
97 P4PxPyPzEBase( ),
98 m_px ( 0.*CLHEP::GeV ),
99 m_py ( 0.*CLHEP::GeV ),
100 m_pz ( 0.*CLHEP::GeV ),
101 m_e ( 0.*CLHEP::GeV )
102{}

Member Function Documentation

◆ cosPhi()

double P4PxPyPzEBase::cosPhi ( ) const
virtualinherited

cosinus phi

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 77 of file P4PxPyPzEBase.cxx.

78{
79 return this->px()/this->pt();
80}
virtual double px() const =0
x component of momentum
virtual double pt() const
transverse momentum

◆ cosTh()

double P4PxPyPzEBase::cosTh ( ) const
virtualinherited

cosinus theta

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 98 of file P4PxPyPzEBase.cxx.

99{
100
101 return this->pz()/this->p();
102
103}
virtual double pz() const =0
z component of momentum
virtual double p() const
momentum magnitude

◆ cotTh()

double P4PxPyPzEBase::cotTh ( ) const
virtualinherited

cottan theta

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 92 of file P4PxPyPzEBase.cxx.

93{
94 return this->pz()/this->pt();
95}

◆ dump()

std::ostream & P4PxPyPzEBase::dump ( std::ostream & out) const
virtualinherited

Print I4Momentum content.

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >, and Rec::TrackParticle.

Definition at line 152 of file P4PxPyPzEBase.cxx.

153{
154
155 std::stringstream outx;
156 outx << "[px,py,pz,e] ="
157 << std::right << std::scientific << std::setprecision(8)
158 << std::setw(16) << this->px()
159 << std::setw(16) << this->py()
160 << std::setw(16) << this->pz()
161 << std::setw(16) << this->e();
162
163 out<<outx.str();
164
165 return out;
166
167}
virtual double e() const =0
energy
virtual double py() const =0
y component of momentum

◆ e()

double P4PxPyPzE::e ( ) const
inlinevirtual

get energy data member

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 132 of file P4PxPyPzE.h.

133{ return m_e;}

◆ ei()

double P4PxPyPzE::ei ( ) const
inline

Experimental : inlined function to get e without going through virtual inheritance.

Definition at line 179 of file P4PxPyPzE.h.

180{ return m_e;}

◆ errors()

const I4MomentumError * P4PxPyPzE::errors ( ) const
virtual

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

Reimplemented from P4PxPyPzEBase.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 7 of file P4PxPyPzE.cxx.

8{
9 return 0;
10}

◆ et()

double P4PxPyPzEBase::et ( ) const
virtualinherited

transverse energy defined to be e*sin(theta)

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 125 of file P4PxPyPzEBase.cxx.

126 {
127 //to be improved
128 return this->e()*this->sinTh();
129 }
virtual double sinTh() const
sinus theta

◆ eta()

double P4PxPyPzEBase::eta ( ) const
virtualinherited

pseudo rapidity

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 32 of file P4PxPyPzEBase.cxx.

33{
34 const double e=this->e();
35
36 const double px=this->px();
37 const double py=this->py();
38 const double pz=this->pz();
39 // FIXME: should we use a more underflow-friendly formula:
40 // sqrt(a**2 + b**2)
41 // => y.sqrt(1+(x/y)**2) where y=max(|a|,|b|) and x=min(|a|,|b|)
42 const double p =std::sqrt (px*px + py*py + pz*pz);
43 if (p==0.0) return 0.0;
44 if (p==+pz) return +std::numeric_limits<double>::infinity();
45 if (p==-pz) return -std::numeric_limits<double>::infinity();
46 //PO flip if negative e
47 return (e>0 ? 1. : -1.)* 0.5*log((p+pz)/(p-pz));
48}

◆ hlv()

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

CLHEP HepLorentzVector.

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 147 of file P4PxPyPzEBase.cxx.

148{ return CLHEP::HepLorentzVector(this->px(),this->py(),this->pz(),this->e());
149
150}

◆ iPt()

double P4PxPyPzEBase::iPt ( ) const
virtualinherited

inverse of transverse momentum

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 131 of file P4PxPyPzEBase.cxx.

132 { return 1./this->pt();
133 }

◆ kind()

virtual I4Momentum::Kind P4PxPyPzEBase::kind ( ) const
inlinevirtualinherited

tells what kind of P4XYZT this is

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 59 of file P4PxPyPzEBase.h.

59{ return I4Momentum::P4PXPYPZE; };

◆ m()

double P4PxPyPzEBase::m ( ) const
virtualinherited

mass

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 25 of file P4PxPyPzEBase.cxx.

26{
27 const double m2 = this->m2();
28
29 return m2 < 0.0 ? -std::sqrt(-m2) : std::sqrt (m2);
30}
virtual double m2() const
mass squared

◆ m2()

double P4PxPyPzEBase::m2 ( ) const
virtualinherited

mass squared

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 14 of file P4PxPyPzEBase.cxx.

15{
16 const double px=this->px();
17 const double py=this->py();
18 const double pz=this->pz();
19 const double e =this->e();
20
21 const double m2 = e*e - (px*px + py*py + pz*pz);
22 return m2;
23}

◆ p()

double P4PxPyPzEBase::p ( ) const
virtualinherited

momentum magnitude

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 68 of file P4PxPyPzEBase.cxx.

69{
70 //PO return the correc
71 const double e=this->e();
72
73 return (e>0 ? 1. : -1.)*std::sqrt(this->p2());
74}
virtual double p2() const
square of momentum magnitude

◆ p2()

double P4PxPyPzEBase::p2 ( ) const
virtualinherited

square of momentum magnitude

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 59 of file P4PxPyPzEBase.cxx.

60{
61 const double px=this->px();
62 const double py=this->py();
63 const double pz=this->pz();
64
65 return px*px+py*py+pz*pz;
66}

◆ phi()

double P4PxPyPzEBase::phi ( ) const
virtualinherited

phi in [-pi,pi[

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 50 of file P4PxPyPzEBase.cxx.

51{
52 const double e=this->e();
53 const double px= (e>0 ? 1. : -1.)*this->px();
54 const double py= (e>0 ? 1. : -1.)*this->py();
55 return px == 0.0 && py == 0.0 ? 0.0 : atan2(py,px);
56}

◆ pt()

double P4PxPyPzEBase::pt ( ) const
virtualinherited

transverse momentum

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 114 of file P4PxPyPzEBase.cxx.

115{
116 const double e=this->e();
117 const double px=this->px();
118 const double py=this->py();
119 //PO flip sign if negative energy
120 return (e>0 ? 1. : -1.)*std::sqrt(px*px+py*py);
121
122 }

◆ pti()

double P4PxPyPzE::pti ( ) const
inline

Experimental : inlined function to get pt without going through virtual inheritance.

Definition at line 182 of file P4PxPyPzE.h.

183{ const double thePx=pxi();
184 const double thePy=pyi();
185 return sqrt(thePx*thePx+thePy*thePy);}
double pyi() const
Experimental : inlined function to get py without going through virtual inheritance.
Definition P4PxPyPzE.h:173
double pxi() const
Experimental : inlined function to get px without going through virtual inheritance.
Definition P4PxPyPzE.h:170

◆ px()

double P4PxPyPzE::px ( ) const
inlinevirtual

get px data member

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 122 of file P4PxPyPzE.h.

123{ return m_px;}

◆ pxi()

double P4PxPyPzE::pxi ( ) const
inline

Experimental : inlined function to get px without going through virtual inheritance.

Definition at line 170 of file P4PxPyPzE.h.

171{ return m_px;}

◆ py()

double P4PxPyPzE::py ( ) const
inlinevirtual

get py data member

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 126 of file P4PxPyPzE.h.

127{ return m_py;}

◆ pyi()

double P4PxPyPzE::pyi ( ) const
inline

Experimental : inlined function to get py without going through virtual inheritance.

Definition at line 173 of file P4PxPyPzE.h.

174{ return m_py;}

◆ pz()

double P4PxPyPzE::pz ( ) const
inlinevirtual

get pz data member

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 129 of file P4PxPyPzE.h.

130{ return m_pz;}

◆ pzi()

double P4PxPyPzE::pzi ( ) const
inline

Experimental : inlined function to get pz without going through virtual inheritance.

Definition at line 176 of file P4PxPyPzE.h.

177{ return m_pz;}

◆ rapidity()

double P4PxPyPzEBase::rapidity ( ) const
virtualinherited

rapidity

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 136 of file P4PxPyPzEBase.cxx.

137{
138 const double e =this->e();
139 const double pz=this->pz();
140 if (e==0.0) return 0.0;
141 if (e==+pz) return +std::numeric_limits<double>::infinity();
142 if (e==-pz) return -std::numeric_limits<double>::infinity();
143 //PO invariant under flipping of 4-mom with neg E
144 return 0.5*std::log((e+pz)/(e-pz));
145}

◆ set4Mom() [1/3]

void P4PxPyPzE::set4Mom ( const CLHEP::HepLorentzVector & theHlv)
inlinevirtual

set all 4-mom from CLHEP HepLorentzVector

Reimplemented from P4PxPyPzEBase.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >, and Rec::TrackParticle.

Definition at line 161 of file P4PxPyPzE.h.

162{
163 m_px=theHlv.px();
164 m_py=theHlv.py();
165 m_pz=theHlv.pz();
166 m_e=theHlv.e();
167}

◆ set4Mom() [2/3]

void P4PxPyPzE::set4Mom ( const I4Momentum & theI4Mom)
inlinevirtual

set all 4-mom from another I4Momentum reference

Reimplemented from P4PxPyPzEBase.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >, and Rec::TrackParticle.

Definition at line 147 of file P4PxPyPzE.h.

148{
149 m_px=theI4Mom.px();
150 m_py=theI4Mom.py();
151 m_pz=theI4Mom.pz();
152 m_e=theI4Mom.e();
153}

◆ set4Mom() [3/3]

void P4PxPyPzE::set4Mom ( const I4Momentum *const theI4Mom)
inlinevirtual

set all 4-mom from another I4Momentum pointer

Reimplemented from P4PxPyPzEBase.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >, and Rec::TrackParticle.

Definition at line 155 of file P4PxPyPzE.h.

156{
157 this->set4Mom(*theI4Mom);
158}

◆ setE()

void P4PxPyPzE::setE ( double theE)
inlinevirtual

set energy data member

Definition at line 144 of file P4PxPyPzE.h.

145{ m_e=theE;}

◆ setPx()

void P4PxPyPzE::setPx ( double thePx)
inlinevirtual

set Px data member

Definition at line 135 of file P4PxPyPzE.h.

136{ m_px=thePx;}

◆ setPy()

void P4PxPyPzE::setPy ( double thePy)
inlinevirtual

set Py data member

Definition at line 138 of file P4PxPyPzE.h.

139{ m_py=thePy;}

◆ setPz()

void P4PxPyPzE::setPz ( double thePz)
inlinevirtual

set Pz data member

Definition at line 141 of file P4PxPyPzE.h.

142{ m_pz=thePz;}

◆ sinPhi()

double P4PxPyPzEBase::sinPhi ( ) const
virtualinherited

sinus phi

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 82 of file P4PxPyPzEBase.cxx.

83{
84 return this->py()/this->pt();
85}

◆ sinTh()

double P4PxPyPzEBase::sinTh ( ) const
virtualinherited

sinus theta

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 106 of file P4PxPyPzEBase.cxx.

107{
108
109 return this->pt()/this->p();
110
111}

◆ tanTh()

double P4PxPyPzEBase::tanTh ( ) const
virtualinherited

tan theta

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >.

Definition at line 87 of file P4PxPyPzEBase.cxx.

88{
89 return this->pt()/this->pz();
90}

Member Data Documentation

◆ m_e

double P4PxPyPzE::m_e
protected

Definition at line 92 of file P4PxPyPzE.h.

◆ m_px

double P4PxPyPzE::m_px
protected

Definition at line 89 of file P4PxPyPzE.h.

◆ m_py

double P4PxPyPzE::m_py
protected

Definition at line 90 of file P4PxPyPzE.h.

◆ m_pz

double P4PxPyPzE::m_pz
protected

Definition at line 91 of file P4PxPyPzE.h.


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