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

#include <P4PtEtaPhiMBase.h>

Inheritance diagram for P4PtEtaPhiMBase:
Collaboration diagram for P4PtEtaPhiMBase:

Public Types

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

Public Member Functions

virtual ~P4PtEtaPhiMBase ()
 virtual destructor needed by pool More...
 
virtual double px () const
 x component of momentum More...
 
virtual double py () const
 y component of momentum More...
 
virtual double pz () const
 z component of momentum More...
 
virtual double e () const
 energy More...
 
virtual double p () const
 magnitude of 3-momentum. More...
 
virtual double p2 () const
 square of momentum magnitude More...
 
virtual double m2 () const
 mass squared 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 cotTh () const
 cottan theta More...
 
virtual double cosTh () const
 cosinus theta More...
 
virtual double sinTh () const
 sinus theta More...
 
virtual double tanTh () const
 tan theta More...
 
virtual CLHEP::HepLorentzVector hlv () const
 HepLorentzVector Special implementation from Frank Paige : if negative energy, points in opposite direction but eta and phi still the same
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...
 
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 m () const =0
 mass More...
 
virtual double eta () const =0
 pseudo rapidity More...
 
virtual double phi () const =0
 phi in [-pi,pi[ More...
 
virtual double pt () const =0
 transverse momentum More...
 

Detailed Description

P4PtEtaPhiMBase 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 25 of file P4PtEtaPhiMBase.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

◆ ~P4PtEtaPhiMBase()

P4PtEtaPhiMBase::~P4PtEtaPhiMBase ( )
virtual

virtual destructor needed by pool

Definition at line 10 of file P4PtEtaPhiMBase.cxx.

11 {}

Member Function Documentation

◆ cosPhi()

double P4PtEtaPhiMBase::cosPhi ( ) const
virtual

cosinus phi

Implements I4Momentum.

Definition at line 55 of file P4PtEtaPhiMBase.cxx.

56 {
57  return std::cos(this->phi());
58 }

◆ cosTh()

double P4PtEtaPhiMBase::cosTh ( ) const
virtual

cosinus theta

Implements I4Momentum.

Definition at line 70 of file P4PtEtaPhiMBase.cxx.

71 {
72  return std::tanh(this->eta());
73 }

◆ cotTh()

double P4PtEtaPhiMBase::cotTh ( ) const
virtual

cottan theta

Implements I4Momentum.

Definition at line 65 of file P4PtEtaPhiMBase.cxx.

66 {
67  return std::sinh(this->eta());
68 }

◆ dump()

std::ostream & P4PtEtaPhiMBase::dump ( std::ostream &  out) const
virtual

Print I4Momentum content.

Implements I4Momentum.

Definition at line 147 of file P4PtEtaPhiMBase.cxx.

148 {
149  std::stringstream outx;
150  outx << "[pt,eta,phi,m] ="
151  << std::right << std::scientific << std::setprecision(8)
152  << std::setw(16) << this->pt()
153  << std::setw(16) << this->eta()
154  << std::setw(16) << this->phi()
155  << std::setw(16) << this->m();
156  out<<outx.str();
157 
158  return out;
159 
160 }

◆ e()

double P4PtEtaPhiMBase::e ( ) const
virtual

energy

Implements I4Momentum.

Definition at line 13 of file P4PtEtaPhiMBase.cxx.

14 {
15  const double theMass = this->m();
16  const double thePt = this->pt();
17  const double thePz = this->pz();
18 
19  //DR from Frank Paige
20  // if negative pt point in the opposite direction
21  // BUT eta and phi still the same !!!
22 
23  double eSign = (thePt >= 0.) ? +1. : -1.;
24  return eSign*std::sqrt(thePt*thePt + thePz*thePz + theMass*theMass);
25 }

◆ errors()

const I4MomentumError * P4PtEtaPhiMBase::errors ( ) const
virtual

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

Implements I4Momentum.

Reimplemented in P4PtEtaPhiM.

Definition at line 162 of file P4PtEtaPhiMBase.cxx.

163 {
164  return 0;
165 }

◆ et()

double P4PtEtaPhiMBase::et ( ) const
virtual

transverse energy defined to be e*sin(theta)

Implements I4Momentum.

Definition at line 101 of file P4PtEtaPhiMBase.cxx.

102  {
103  return this->e()*this->sinTh();
104  }

◆ eta()

virtual double I4Momentum::eta ( ) const
pure virtualinherited

◆ hlv()

CLHEP::HepLorentzVector P4PtEtaPhiMBase::hlv ( ) const
virtual

HepLorentzVector Special implementation from Frank Paige : if negative energy, points in opposite direction but eta and phi still the same

Implements I4Momentum.

Definition at line 128 of file P4PtEtaPhiMBase.cxx.

129 {
130  //minimize the number of calculation and dereference
131  const double theM = this->m();
132  // note that pt can have negative sign : then it points in opposite direction but eta and phi are still on the same side
133  const double thePt = this->pt();
134 
135 
136  const double thePx = thePt*this->cosPhi();
137  const double thePy = thePt*this->sinPhi();
138 
139  const double thePz = thePt*this->cotTh();
140 
141  const double theE=std::sqrt(thePt*thePt+thePz*thePz+theM*theM);
142 
143 
144  return CLHEP::HepLorentzVector( thePx, thePy, thePz, theE );
145 }

◆ iPt()

double P4PtEtaPhiMBase::iPt ( ) const
virtual

inverse of transverse momentum

Implements I4Momentum.

Definition at line 106 of file P4PtEtaPhiMBase.cxx.

107  { return 1./this->pt();
108  }

◆ kind()

I4Momentum::Kind P4PtEtaPhiMBase::kind ( ) const
inlinevirtual

tells what kind of P4XYZT this is

Implements I4Momentum.

Definition at line 64 of file P4PtEtaPhiMBase.h.

64 { return I4Momentum::P4PTETAPHIM; };

◆ m()

virtual double I4Momentum::m ( ) const
pure virtualinherited

◆ m2()

double P4PtEtaPhiMBase::m2 ( ) const
virtual

mass squared

Implements I4Momentum.

Definition at line 50 of file P4PtEtaPhiMBase.cxx.

51 { const double theM=this->m();
52  return theM*theM;
53 }

◆ p()

double P4PtEtaPhiMBase::p ( ) const
virtual

magnitude of 3-momentum.

Special implementation from Frank Paige : if negative energy p is negative but eta and phi still the same.

Implements I4Momentum.

Definition at line 27 of file P4PtEtaPhiMBase.cxx.

28 {
29  const double thePt = this->pt();
30  const double thePz = this->pz();
31 
32  //DR from Frank Paige
33  // if negative pt point in the opposite direction
34  // BUT eta and phi still the same !!!
35 
36  double eSign = (thePt >= 0.) ? +1. : -1.;
37  return eSign*std::sqrt(thePt*thePt + thePz*thePz);
38 }

◆ p2()

double P4PtEtaPhiMBase::p2 ( ) const
virtual

square of momentum magnitude

Implements I4Momentum.

Definition at line 40 of file P4PtEtaPhiMBase.cxx.

41 {
42  /* This method has been implemented so as to give the same as would be obtained from pow((this->p()),2) with this->p() implemented according to Frank Paige's algorithm above. */
43 
44  const double thePt = this->pt();
45  const double thePz = this->pz();
46 
47  return thePt*thePt + thePz*thePz;
48 }

◆ phi()

virtual double I4Momentum::phi ( ) const
pure virtualinherited

◆ pt()

virtual double I4Momentum::pt ( ) const
pure virtualinherited

◆ px()

double P4PtEtaPhiMBase::px ( ) const
virtual

x component of momentum

Implements I4Momentum.

Definition at line 117 of file P4PtEtaPhiMBase.cxx.

118  { return this->pt()*this->cosPhi();
119  }

◆ py()

double P4PtEtaPhiMBase::py ( ) const
virtual

y component of momentum

Implements I4Momentum.

Definition at line 121 of file P4PtEtaPhiMBase.cxx.

122  { return this->pt()*this->sinPhi();
123  }

◆ pz()

double P4PtEtaPhiMBase::pz ( ) const
virtual

z component of momentum

Implements I4Momentum.

Definition at line 125 of file P4PtEtaPhiMBase.cxx.

126 { return this->pt()*this->cotTh(); }

◆ rapidity()

double P4PtEtaPhiMBase::rapidity ( ) const
virtual

rapidity

Implements I4Momentum.

Definition at line 110 of file P4PtEtaPhiMBase.cxx.

111  {
112  const double theE=this->e();
113  const double thePz=this->pz();
114  return 0.5*std::log((theE+thePz)/(theE-thePz));
115  }

◆ set4Mom() [1/3]

void P4PtEtaPhiMBase::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
virtual

set all 4-mom from a CLHEP HepLorentzVector DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in P4PtEtaPhiM.

Definition at line 180 of file P4PtEtaPhiMBase.cxx.

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

◆ set4Mom() [2/3]

void P4PtEtaPhiMBase::set4Mom ( const I4Momentum theI4Mom)
virtual

set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in P4PtEtaPhiM.

Definition at line 167 of file P4PtEtaPhiMBase.cxx.

168 {
169  std::cout << "FATAL ERROR dummy P4PtEtaPhiMBase::set4Mom called " << std::endl ;
170  std::abort();
171 }

◆ set4Mom() [3/3]

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

set all 4-mom from another I4Momentum pointer DUMMY IMPLEMENTATION

Implements I4Momentum.

Reimplemented in P4PtEtaPhiM.

Definition at line 173 of file P4PtEtaPhiMBase.cxx.

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

◆ sinPhi()

double P4PtEtaPhiMBase::sinPhi ( ) const
virtual

sinus phi

Implements I4Momentum.

Definition at line 60 of file P4PtEtaPhiMBase.cxx.

61 {
62  return std::sin(this->phi());
63 }

◆ sinTh()

double P4PtEtaPhiMBase::sinTh ( ) const
virtual

sinus theta

Implements I4Momentum.

Definition at line 75 of file P4PtEtaPhiMBase.cxx.

76 {
77  // avoid numeric overflow if very large eta
78 
79  double aEta=std::abs(this->eta());
80  if ( aEta>710) {
81  aEta=710;
82  }
83 
84  return 1./std::cosh(aEta);
85 }

◆ tanTh()

double P4PtEtaPhiMBase::tanTh ( ) const
virtual

tan theta

Implements I4Momentum.

Definition at line 87 of file P4PtEtaPhiMBase.cxx.

88 {
89  // avoid numeric overflow if very large eta
90 
91  double theEta=this->eta();
92  if ( std::abs(theEta)>710) {
93  theEta=theEta>0 ? 710 : -710;
94  return 1./std::sinh(theEta);
95  }
96 
97  return 1./std::sinh(this->eta());
98 }

The documentation for this class was generated from the following files:
I4Momentum::P4IPTCOTTHPHIM
@ P4IPTCOTTHPHIM
Definition: I4Momentum.h:33
P4PtEtaPhiMBase::e
virtual double e() const
energy
Definition: P4PtEtaPhiMBase.cxx:13
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4PtEtaPhiMBase::cotTh
virtual double cotTh() const
cottan theta
Definition: P4PtEtaPhiMBase.cxx:65
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
I4Momentum::pt
virtual double pt() const =0
transverse momentum
P4PtEtaPhiMBase::cosPhi
virtual double cosPhi() const
cosinus phi
Definition: P4PtEtaPhiMBase.cxx:55
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
I4Momentum::P4PTETAPHIM
@ P4PTETAPHIM
Definition: I4Momentum.h:33
P4PtEtaPhiMBase::sinPhi
virtual double sinPhi() const
sinus phi
Definition: P4PtEtaPhiMBase.cxx:60
I4Momentum::UNKNOWN
@ UNKNOWN
Definition: I4Momentum.h:33
P4PtEtaPhiMBase::pz
virtual double pz() const
z component of momentum
Definition: P4PtEtaPhiMBase.cxx:125
I4Momentum::m
virtual double m() const =0
mass
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
I4Momentum::P4EETAPHIM
@ P4EETAPHIM
Definition: I4Momentum.h:33
P4PtEtaPhiMBase::sinTh
virtual double sinTh() const
sinus theta
Definition: P4PtEtaPhiMBase.cxx:75
I4Momentum::P4PXPYPZE
@ P4PXPYPZE
Definition: I4Momentum.h:33