ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
FourMom
src
P4PtEtaPhiMBase.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FourMom/P4PtEtaPhiMBase.h
"
6
#include <cmath>
7
#include <iomanip>
8
#include <cstdlib>
9
10
P4PtEtaPhiMBase::~P4PtEtaPhiMBase
()
11
{}
12
13
double
P4PtEtaPhiMBase::e
()
const
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
}
26
27
double
P4PtEtaPhiMBase::p
()
const
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
}
39
40
double
P4PtEtaPhiMBase::p2
()
const
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
}
49
50
double
P4PtEtaPhiMBase::m2
()
const
51
{
const
double
theM=this->
m
();
52
return
theM*theM;
53
}
54
55
double
P4PtEtaPhiMBase::cosPhi
()
const
56
{
57
return
std::cos(this->
phi
());
58
}
59
60
double
P4PtEtaPhiMBase::sinPhi
()
const
61
{
62
return
std::sin(this->
phi
());
63
}
64
65
double
P4PtEtaPhiMBase::cotTh
()
const
66
{
67
return
std::sinh(this->
eta
());
68
}
69
70
double
P4PtEtaPhiMBase::cosTh
()
const
71
{
72
return
std::tanh(this->
eta
());
73
}
74
75
double
P4PtEtaPhiMBase::sinTh
()
const
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
}
86
87
double
P4PtEtaPhiMBase::tanTh
()
const
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
}
99
100
101
double
P4PtEtaPhiMBase::et
()
const
102
{
103
return
this->
e
()*this->
sinTh
();
104
}
105
106
double
P4PtEtaPhiMBase::iPt
()
const
107
{
return
1./this->
pt
();
108
}
109
110
double
P4PtEtaPhiMBase::rapidity
()
const
111
{
112
const
double
theE=this->
e
();
113
const
double
thePz=this->
pz
();
114
return
0.5*std::log((theE+thePz)/(theE-thePz));
115
}
116
117
double
P4PtEtaPhiMBase::px
()
const
118
{
return
this->
pt
()*this->
cosPhi
();
119
}
120
121
double
P4PtEtaPhiMBase::py
()
const
122
{
return
this->
pt
()*this->
sinPhi
();
123
}
124
125
double
P4PtEtaPhiMBase::pz
()
const
126
{
return
this->
pt
()*this->
cotTh
(); }
127
128
CLHEP::HepLorentzVector
P4PtEtaPhiMBase::hlv
()
const
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
}
146
147
std::ostream&
P4PtEtaPhiMBase::dump
( std::ostream& out )
const
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
}
161
162
const
I4MomentumError
*
P4PtEtaPhiMBase::errors
()
const
163
{
164
return
0;
165
}
166
167
void
P4PtEtaPhiMBase::set4Mom
(
const
I4Momentum
& )
168
{
169
std::cout <<
"FATAL ERROR dummy P4PtEtaPhiMBase::set4Mom called "
<< std::endl ;
170
std::abort();
171
}
172
173
void
P4PtEtaPhiMBase::set4Mom
(
const
I4Momentum
*
const
)
174
{
175
std::cout <<
"FATAL ERROR dummy P4PtEtaPhiMBase::set4Mom called "
<< std::endl; ;
176
std::abort();
177
178
}
179
180
void
P4PtEtaPhiMBase::set4Mom
(
const
CLHEP::HepLorentzVector & )
181
{
182
std::cout <<
"FATAL ERROR dummy P4PtEtaPhiMBase::set4Mom called "
<< std::endl ;
183
std::abort();
184
}
P4PtEtaPhiMBase.h
I4MomentumError
Definition
I4MomentumError.h:28
I4Momentum
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition
I4Momentum.h:31
I4Momentum::m
virtual double m() const =0
mass
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
I4Momentum::pt
virtual double pt() const =0
transverse momentum
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
P4PtEtaPhiMBase::rapidity
virtual double rapidity() const
rapidity
Definition
P4PtEtaPhiMBase.cxx:110
P4PtEtaPhiMBase::m2
virtual double m2() const
mass squared
Definition
P4PtEtaPhiMBase.cxx:50
P4PtEtaPhiMBase::pz
virtual double pz() const
z component of momentum
Definition
P4PtEtaPhiMBase.cxx:125
P4PtEtaPhiMBase::hlv
virtual CLHEP::HepLorentzVector hlv() const
HepLorentzVector Special implementation from Frank Paige : if negative energy, points in opposite dir...
Definition
P4PtEtaPhiMBase.cxx:128
P4PtEtaPhiMBase::tanTh
virtual double tanTh() const
tan theta
Definition
P4PtEtaPhiMBase.cxx:87
P4PtEtaPhiMBase::et
virtual double et() const
transverse energy defined to be e*sin(theta)
Definition
P4PtEtaPhiMBase.cxx:101
P4PtEtaPhiMBase::iPt
virtual double iPt() const
inverse of transverse momentum
Definition
P4PtEtaPhiMBase.cxx:106
P4PtEtaPhiMBase::cosTh
virtual double cosTh() const
cosinus theta
Definition
P4PtEtaPhiMBase.cxx:70
P4PtEtaPhiMBase::dump
virtual std::ostream & dump(std::ostream &out) const
Print I4Momentum content.
Definition
P4PtEtaPhiMBase.cxx:147
P4PtEtaPhiMBase::p
virtual double p() const
magnitude of 3-momentum.
Definition
P4PtEtaPhiMBase.cxx:27
P4PtEtaPhiMBase::sinPhi
virtual double sinPhi() const
sinus phi
Definition
P4PtEtaPhiMBase.cxx:60
P4PtEtaPhiMBase::~P4PtEtaPhiMBase
virtual ~P4PtEtaPhiMBase()
virtual destructor needed by pool
Definition
P4PtEtaPhiMBase.cxx:10
P4PtEtaPhiMBase::sinTh
virtual double sinTh() const
sinus theta
Definition
P4PtEtaPhiMBase.cxx:75
P4PtEtaPhiMBase::py
virtual double py() const
y component of momentum
Definition
P4PtEtaPhiMBase.cxx:121
P4PtEtaPhiMBase::cotTh
virtual double cotTh() const
cottan theta
Definition
P4PtEtaPhiMBase.cxx:65
P4PtEtaPhiMBase::p2
virtual double p2() const
square of momentum magnitude
Definition
P4PtEtaPhiMBase.cxx:40
P4PtEtaPhiMBase::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference DUMMY IMPLEMENTATION
Definition
P4PtEtaPhiMBase.cxx:167
P4PtEtaPhiMBase::cosPhi
virtual double cosPhi() const
cosinus phi
Definition
P4PtEtaPhiMBase.cxx:55
P4PtEtaPhiMBase::errors
virtual const I4MomentumError * errors() const
Access to errors, if available; returns 0 if no errors.
Definition
P4PtEtaPhiMBase.cxx:162
P4PtEtaPhiMBase::px
virtual double px() const
x component of momentum
Definition
P4PtEtaPhiMBase.cxx:117
P4PtEtaPhiMBase::e
virtual double e() const
energy
Definition
P4PtEtaPhiMBase.cxx:13
Generated on
for ATLAS Offline Software by
1.17.0