ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | List of all members
P4PxPyPzE Class Reference

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

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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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  }

◆ 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 }

◆ 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 }

◆ 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);}

◆ 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:
I4Momentum::py
virtual double py() const =0
y component of momentum
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
P4PxPyPzEBase::p
virtual double p() const
momentum magnitude
Definition: P4PxPyPzEBase.cxx:68
P4PxPyPzE::e
virtual double e() const
get energy data member
Definition: P4PxPyPzE.h:132
P4PxPyPzE::py
virtual double py() const
get py data member
Definition: P4PxPyPzE.h:126
I4Momentum::P4IPTCOTTHPHIM
@ P4IPTCOTTHPHIM
Definition: I4Momentum.h:33
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4PxPyPzE::pz
virtual double pz() const
get pz data member
Definition: P4PxPyPzE.h:129
P4PxPyPzEBase::sinTh
virtual double sinTh() const
sinus theta
Definition: P4PxPyPzEBase.cxx:106
P4PxPyPzE::m_py
double m_py
Definition: P4PxPyPzE.h:90
P4PxPyPzE::m_pz
double m_pz
Definition: P4PxPyPzE.h:91
P4PxPyPzEBase::p2
virtual double p2() const
square of momentum magnitude
Definition: P4PxPyPzEBase.cxx:59
P4PxPyPzE::pxi
double pxi() const
Experimental : inlined function to get px without going through virtual inheritance.
Definition: P4PxPyPzE.h:170
I4Momentum::pz
virtual double pz() const =0
z component of momentum
P4PxPyPzE::m_px
double m_px
Definition: P4PxPyPzE.h:89
I4Momentum::e
virtual double e() const =0
energy
P4PxPyPzEBase::pt
virtual double pt() const
transverse momentum
Definition: P4PxPyPzEBase.cxx:114
P4PxPyPzEBase
Definition: P4PxPyPzEBase.h:26
I4Momentum::P4PTETAPHIM
@ P4PTETAPHIM
Definition: I4Momentum.h:33
I4Momentum::UNKNOWN
@ UNKNOWN
Definition: I4Momentum.h:33
P4PxPyPzE::m_e
double m_e
Definition: P4PxPyPzE.h:92
P4PxPyPzE::px
virtual double px() const
get px data member
Definition: P4PxPyPzE.h:122
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
P4PxPyPzE::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4PxPyPzE.h:147
P4PxPyPzE::pyi
double pyi() const
Experimental : inlined function to get py without going through virtual inheritance.
Definition: P4PxPyPzE.h:173
P4PxPyPzEBase::m2
virtual double m2() const
mass squared
Definition: P4PxPyPzEBase.cxx:14
I4Momentum::P4EETAPHIM
@ P4EETAPHIM
Definition: I4Momentum.h:33
I4Momentum::px
virtual double px() const =0
x component of momentum
I4Momentum::P4PXPYPZE
@ P4PXPYPZE
Definition: I4Momentum.h:33