ATLAS Offline Software
Loading...
Searching...
No Matches
P4IPtCotThPhiMBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <cmath>
7#include <iomanip>
8
11
13 {
14 return 1./this->iPt();
15 }
16
17
18double P4IPtCotThPhiMBase::p() const
19{
20 const double theCotTh=this->cotTh();
21 return std::sqrt(1+theCotTh*theCotTh)/this->iPt() ;
22}
23
25{
26 const double theCotTh=this->cotTh();
27 const double theI_Pt=this->iPt();
28 return (1+theCotTh*theCotTh)/(theI_Pt*theI_Pt) ;
29}
30
31double P4IPtCotThPhiMBase::m2() const {
32 const double theM = this->m();
33 return theM*theM;
34}
35
37{
38 return 1./this->cotTh() ;
39}
40
42{
43 const double theCotTh=this->cotTh();
44 return 1./std::sqrt(1+theCotTh*theCotTh) ;
45}
46
48{
49 const double theCotTh=this->cotTh();
50 const double theCotTh2=theCotTh*theCotTh;
51 const double theCosTh=std::sqrt(theCotTh2/(1.+theCotTh2));
52 if (theCotTh>=0) {
53 return theCosTh;
54 }
55 else{
56 return -theCosTh;
57 }
58}
59
60
61double P4IPtCotThPhiMBase::e() const
62{
63 const double theM=this->m();
64 const double theP=this->p();
65 if (theM==0.) return theP ;
66 else return std::sqrt(theP*theP+theM*theM);
67}
68
70{
71 const double theCotTh=this->cotTh();
72 return this->e()/std::sqrt(1+theCotTh*theCotTh);
73}
74
75
77{
78 const double theCotTh=this->cotTh();
79 const double aux=std::sqrt(1+theCotTh*theCotTh);
80 return -0.5*log((aux-theCotTh)/(aux+theCotTh));
81 }
82
83
85 {
86 const double theE=this->e();
87 const double thePz=this->pz();
88 return 0.5*std::log((theE+thePz)/(theE-thePz));
89 }
90
92 { return this->cosPhi()/this->iPt();
93 }
94
96 { return this->sinPhi()/this->iPt();
97 }
98
100 { return this->cotTh()/this->iPt();
101 }
102
104{
105 return std::cos(this->phi());
106}
107
109{
110 return std::sin(this->phi());
111}
112
113 CLHEP::HepLorentzVector P4IPtCotThPhiMBase::hlv() const
114{
115 //minimize the number of calculation and dereference
116 const double thePt=this->pt();
117 const double theM=this->m();
118 const double thePx=thePt*this->cosPhi();
119 const double thePy=thePt*this->sinPhi();
120 const double thePz=thePt*this->cotTh();
121 const double theE=std::sqrt(thePt*thePt+thePz*thePz+theM*theM);
122
123 return CLHEP::HepLorentzVector(thePx,thePy,thePz,theE);
124}
125
126std::ostream& P4IPtCotThPhiMBase::dump( std::ostream& out ) const
127{
128
129 std::stringstream outx;
130 outx << "[ipt,cotTh,phi,m] ="
131 << std::right << std::scientific << std::setprecision(8)
132 << std::setw(16) << this->iPt()
133 << std::setw(16) << this->cotTh()
134 << std::setw(16) << this->phi()
135 << std::setw(16) << this->m();
136
137 out<<outx.str();
138
139 return out;
140}
141
143{
144 return 0;
145}
146
147
149{
150 std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
151 std::abort();
152}
153
155{
156 std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
157 std::abort();
158
159}
160
161void P4IPtCotThPhiMBase::set4Mom(const CLHEP::HepLorentzVector & )
162{
163 std::cout << "FATAL ERROR dummy P4IPtCotThPhiMBase::set4Mom called " << std::endl ;
164 std::abort();
165}
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
virtual double cotTh() const =0
cottan theta
virtual double m() const =0
mass
virtual double phi() const =0
phi in [-pi,pi[
virtual double iPt() const =0
inverse of transverse momentum
virtual double eta() const
pseudo rapidity
virtual CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
virtual double p() const
momentum magnitude
virtual double py() const
y component of momentum
virtual double pt() const
transverse momentum
virtual double m2() const
mass squared
virtual std::ostream & dump(std::ostream &out) const
Print I4Momentum content.
virtual double sinPhi() const
sinus phi
virtual double et() const
transverse energy defined to be e*sin(theta)
virtual double pz() const
z component of momentum
virtual double p2() const
square of momentum magnitude
virtual double cosPhi() const
cosinus phi
virtual double cosTh() const
cosinus theta
virtual double px() const
x component of momentum
virtual double rapidity() const
rapidity
virtual ~P4IPtCotThPhiMBase()
virtual destructor needed by Pool
virtual const I4MomentumError * errors() const
Access to errors, if available; returns 0 if no errors.
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION
virtual double e() const
energy
virtual double tanTh() const
tan theta
virtual double sinTh() const
sinus theta