ATLAS Offline Software
Public Types | Public Member Functions | List of all members
P4PxPyPzEBase Class Referenceabstract

#include <P4PxPyPzEBase.h>

Inheritance diagram for P4PxPyPzEBase:
Collaboration diagram for P4PxPyPzEBase:

Public Types

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

Public Member Functions

virtual ~P4PxPyPzEBase ()
 virtual destructor needed by pool 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 const I4MomentumErrorerrors () const
 Access to errors, if available; returns 0 if no errors. More...
 
virtual void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION
More...
 
virtual void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer DUMMY IMPLEMENTATION More...
 
virtual void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set all 4-mom from a CLHEP HepLorentzVector DUMMY IMPLEMENTATION 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...
 
virtual double px () const =0
 x component of momentum More...
 
virtual double py () const =0
 y component of momentum More...
 
virtual double pz () const =0
 z component of momentum More...
 
virtual double e () const =0
 energy More...
 

Detailed Description

P4PxPyPzEBase is a base class for classes with 4-momentum behavior, for which Px, Py, Pz and M are natural parameters. Any class deriving from it should implement px(), py(), pz(), e().

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

Definition at line 24 of file P4PxPyPzEBase.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

◆ ~P4PxPyPzEBase()

P4PxPyPzEBase::~P4PxPyPzEBase ( )
virtual

virtual destructor needed by pool

Definition at line 11 of file P4PxPyPzEBase.cxx.

12 {}

Member Function Documentation

◆ cosPhi()

double P4PxPyPzEBase::cosPhi ( ) const
virtual

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
virtual

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
virtual

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
virtual

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()

virtual double I4Momentum::e ( ) const
pure virtualinherited

◆ errors()

const I4MomentumError * P4PxPyPzEBase::errors ( ) const
virtual

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

Implements I4Momentum.

Reimplemented in Nav4MomWrapper< Navigable_t, P4Momentum_t >, and P4PxPyPzE.

Definition at line 169 of file P4PxPyPzEBase.cxx.

170 {
171  return 0;
172 }

◆ et()

double P4PxPyPzEBase::et ( ) const
virtual

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
virtual

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
virtual

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
virtual

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
inlinevirtual

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
virtual

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
virtual

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
virtual

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
virtual

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
virtual

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
virtual

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  }

◆ px()

virtual double I4Momentum::px ( ) const
pure virtualinherited

◆ py()

virtual double I4Momentum::py ( ) const
pure virtualinherited

◆ pz()

virtual double I4Momentum::pz ( ) const
pure virtualinherited

◆ rapidity()

double P4PxPyPzEBase::rapidity ( ) const
virtual

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 P4PxPyPzEBase::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
virtual

set all 4-mom from a CLHEP HepLorentzVector DUMMY IMPLEMENTATION

Implements I4Momentum.

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

Definition at line 188 of file P4PxPyPzEBase.cxx.

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

◆ set4Mom() [2/3]

void P4PxPyPzEBase::set4Mom ( const I4Momentum theI4Mom)
virtual

set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION

Implements I4Momentum.

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

Definition at line 175 of file P4PxPyPzEBase.cxx.

176 {
177  std::cout << "FATAL ERROR dummy P4PxPyPzEBase::set4Mom called " << std::endl ;
178  std::abort();
179 }

◆ set4Mom() [3/3]

void P4PxPyPzEBase::set4Mom ( const I4Momentum *const  theI4Mom)
virtual

set all 4-mom from another I4Momentum pointer DUMMY IMPLEMENTATION

Implements I4Momentum.

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

Definition at line 181 of file P4PxPyPzEBase.cxx.

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

◆ sinPhi()

double P4PxPyPzEBase::sinPhi ( ) const
virtual

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
virtual

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
virtual

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 }

The documentation for this class was generated from the following files:
I4Momentum::py
virtual double py() const =0
y component of momentum
P4PxPyPzEBase::p
virtual double p() const
momentum magnitude
Definition: P4PxPyPzEBase.cxx:68
I4Momentum::P4IPTCOTTHPHIM
@ P4IPTCOTTHPHIM
Definition: I4Momentum.h:33
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4PxPyPzEBase::sinTh
virtual double sinTh() const
sinus theta
Definition: P4PxPyPzEBase.cxx:106
P4PxPyPzEBase::p2
virtual double p2() const
square of momentum magnitude
Definition: P4PxPyPzEBase.cxx:59
I4Momentum::pz
virtual double pz() const =0
z component of momentum
I4Momentum::e
virtual double e() const =0
energy
P4PxPyPzEBase::pt
virtual double pt() const
transverse momentum
Definition: P4PxPyPzEBase.cxx:114
I4Momentum::P4PTETAPHIM
@ P4PTETAPHIM
Definition: I4Momentum.h:33
I4Momentum::UNKNOWN
@ UNKNOWN
Definition: I4Momentum.h:33
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
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