ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigEFMissingET
Root
SignedKinematics.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigEFMissingET/SignedKinematics.h
"
6
#include <TLorentzVector.h>
7
#include "
xAODBase/IParticle.h
"
8
#include <TVector2.h>
9
10
namespace
HLT
{
namespace
MET
{
11
SignedKinematics::SignedKinematics
() {}
12
SignedKinematics::SignedKinematics
(
13
double
px
,
double
py
,
double
pz
,
double
energy
) :
14
m_p4
(
px
,
py
,
pz
,
energy
)
15
{}
16
17
SignedKinematics::SignedKinematics
(
const
TLorentzVector& tlv) :
18
m_p4
(tlv.Px(), tlv.Py(), tlv.Pz(), tlv.E() )
19
{}
20
21
SignedKinematics::SignedKinematics
(
const
xAOD::IParticle
& particle) :
22
SignedKinematics
(
fromEnergyEtaPhiM
(
23
particle.e(), particle.
eta
(), particle.
phi
(), particle.m() ) )
24
{}
25
26
SignedKinematics
SignedKinematics::fromEnergyEtaPhi
(
27
double
energy
,
double
eta
,
double
phi
)
28
{
29
return
fromEnergyEtaPhiM
(
energy
,
eta
,
phi
, 0.);
30
}
31
32
SignedKinematics
SignedKinematics::fromEnergyEtaPhiM
(
33
double
energy
,
double
eta
,
double
phi
,
double
mass)
34
{
35
double
p
=
energy
;
36
if
(mass != 0) {
37
int
sgn = (
p
> 0) - (
p
< 0);
38
p
= sgn * sqrt(
p
*
p
- mass*mass);
39
}
40
double
pt
=
p
/std::cosh(
eta
);
41
double
pz
=
pt
*std::sinh(
eta
);
42
return
SignedKinematics
(
43
pt
*std::cos(
phi
),
pt
*std::sin(
phi
),
pz
,
energy
);
44
}
45
46
SignedKinematics
SignedKinematics::fromEtEtaPhi
(
47
double
et
,
double
eta
,
double
phi
)
48
{
49
return
fromEtEtaPhiM
(
et
,
eta
,
phi
, 0.);
50
}
51
52
SignedKinematics
SignedKinematics::fromEtEtaPhiM
(
53
double
et
,
double
eta
,
double
phi
,
double
mass)
54
{
55
return
fromEnergyEtaPhiM
(
et
*std::cosh(
eta
),
eta
,
phi
, mass);
56
}
57
58
int
SignedKinematics::sign
()
const
{
59
return
(
energy
() > 0) - (
energy
() < 0);
60
}
61
62
double
SignedKinematics::eta
()
const
{
63
return
sign
() *
m_p4
.Eta();
64
}
65
66
double
SignedKinematics::phi
()
const
{
67
double
val =
m_p4
.Phi();
68
if
(
sign
() < 0)
69
val += TMath::Pi();
70
return
TVector2::Phi_0_2pi(val);
71
}
72
73
double
SignedKinematics::sinPhi
()
const
{
74
double
thePt =
pt
();
75
// if pt() is 0 then the value is not determined.
76
// For this phi = 0
77
return
(thePt == 0 ? 0 :
py
() / thePt );
78
}
79
double
SignedKinematics::cosPhi
()
const
{
80
double
thePt =
pt
();
81
// if pt() is 0 then the value is not determined.
82
// Take phi = 0
83
return
(thePt == 0 ? 1 :
px
() / thePt );
84
}
85
86
double
SignedKinematics::sinhEta
()
const
{
87
double
thePt =
pt
();
88
// if pt is 0 then the value is not determined.
89
// Take eta = 0
90
return
(thePt == 0 ? 0 :
pz
() / thePt );
91
}
92
double
SignedKinematics::coshEta
()
const
{
93
double
thePt2 =
pt2
();
94
// if pt is 0 then the value is not determined.
95
// Take eta = 0
96
if
(thePt2 == 0)
97
return
1;
98
// Otherwise, calculate sinh^2 eta, then use
99
// cosh eta = sqrt(1 + sinh^2 eta)
100
return
sqrt(1 +
pz
()*
pz
() / thePt2);
101
}
102
103
double
SignedKinematics::p
()
const
{
104
return
sign
() *
absP
();
105
}
106
double
SignedKinematics::absP
()
const
{
107
return
sqrt(
p2
() );
108
}
109
double
SignedKinematics::p2
()
const
{
110
return
pt2
() +
pz
()*
pz
();
111
}
112
double
SignedKinematics::pt
()
const
{
113
return
sign
() *
absPt
();
114
}
115
double
SignedKinematics::absPt
()
const
{
116
return
sqrt(
pt2
() );
117
}
118
double
SignedKinematics::pt2
()
const
{
119
return
px
()*
px
() +
py
()*
py
();
120
}
121
double
SignedKinematics::px
()
const
{
122
return
m_p4
.Px();
123
}
124
double
SignedKinematics::py
()
const
{
125
return
m_p4
.Py();
126
}
127
double
SignedKinematics::pz
()
const
{
128
return
m_p4
.Pz();
129
}
130
131
double
SignedKinematics::energy
()
const
{
132
return
m_p4
.E();
133
}
134
double
SignedKinematics::absEnergy
()
const
{
135
return
abs(
energy
() );
136
}
137
double
SignedKinematics::energy2
()
const
{
138
return
energy
()*
energy
();
139
}
140
double
SignedKinematics::et
()
const
{
141
return
energy
() /
coshEta
();
142
}
143
double
SignedKinematics::absEt
()
const
{
144
return
abs(
et
() );
145
}
146
double
SignedKinematics::et2
()
const
{
147
return
et
()*
et
();
148
}
149
double
SignedKinematics::ex
()
const
{
150
return
et
() *
cosPhi
();
151
}
152
double
SignedKinematics::ey
()
const
{
153
return
et
() *
sinPhi
();
154
}
155
double
SignedKinematics::ez
()
const
{
156
return
et
() *
sinhEta
();
157
}
158
159
double
SignedKinematics::m2
()
const
{
160
return
energy2
() -
p2
();
161
}
162
163
SignedKinematics::operator ROOT::Math::PxPyPzEVector()
const
{
164
return
m_p4
;
165
}
166
167
SignedKinematics
&
SignedKinematics::operator+=
(
const
SignedKinematics
& other)
168
{
169
m_p4
.SetPx(
px
()+other.px() );
170
m_p4
.SetPy(
py
()+other.py() );
171
m_p4
.SetPz(
pz
()+other.pz() );
172
m_p4
.SetE(
energy
()+other.energy() );
173
return
*
this
;
174
}
175
SignedKinematics
&
SignedKinematics::operator-=
(
const
SignedKinematics
& other)
176
{
177
m_p4
.SetPx(
px
()-other.px() );
178
m_p4
.SetPy(
py
()-other.py() );
179
m_p4
.SetPz(
pz
()-other.pz() );
180
m_p4
.SetE(
energy
()-other.energy() );
181
return
*
this
;
182
}
183
184
SignedKinematics
operator+
(
const
SignedKinematics
& lhs,
const
SignedKinematics
& rhs)
185
{
186
SignedKinematics
val(lhs);
187
val += rhs;
188
return
val;
189
}
190
SignedKinematics
operator-
(
const
SignedKinematics
& lhs,
const
SignedKinematics
& rhs)
191
{
192
SignedKinematics
val(lhs);
193
val -= rhs;
194
return
val;
195
}
196
} }
//> end namespace HLT::MET
IParticle.h
SignedKinematics.h
HLT::MET::SignedKinematics
Class to describe the kinematics of an object that can have negative energies.
Definition
SignedKinematics.h:42
HLT::MET::SignedKinematics::pz
double pz() const
Definition
SignedKinematics.cxx:127
HLT::MET::SignedKinematics::coshEta
double coshEta() const
Definition
SignedKinematics.cxx:92
HLT::MET::SignedKinematics::et
double et() const
(signed) et
Definition
SignedKinematics.cxx:140
HLT::MET::SignedKinematics::ez
double ez() const
Definition
SignedKinematics.cxx:155
HLT::MET::SignedKinematics::p2
double p2() const
Definition
SignedKinematics.cxx:109
HLT::MET::SignedKinematics::et2
double et2() const
Definition
SignedKinematics.cxx:146
HLT::MET::SignedKinematics::fromEtEtaPhi
static SignedKinematics fromEtEtaPhi(double et, double eta, double phi)
Factory function to construct from et, eta, phi (massless).
Definition
SignedKinematics.cxx:46
HLT::MET::SignedKinematics::px
double px() const
Definition
SignedKinematics.cxx:121
HLT::MET::SignedKinematics::energy2
double energy2() const
Definition
SignedKinematics.cxx:137
HLT::MET::SignedKinematics::py
double py() const
Definition
SignedKinematics.cxx:124
HLT::MET::SignedKinematics::sinPhi
double sinPhi() const
Provide accessors for sin and cos phi.
Definition
SignedKinematics.cxx:73
HLT::MET::SignedKinematics::eta
double eta() const
Direction.
Definition
SignedKinematics.cxx:62
HLT::MET::SignedKinematics::sinhEta
double sinhEta() const
Provide accessors for sinh and cosh eta.
Definition
SignedKinematics.cxx:86
HLT::MET::SignedKinematics::operator+=
SignedKinematics & operator+=(const SignedKinematics &other)
Add another SignedKinematics to this.
Definition
SignedKinematics.cxx:167
HLT::MET::SignedKinematics::m2
double m2() const
The squared mass. There is no guarantee that this will be > 0.
Definition
SignedKinematics.cxx:159
HLT::MET::SignedKinematics::absP
double absP() const
unsigned momentum
Definition
SignedKinematics.cxx:106
HLT::MET::SignedKinematics::ex
double ex() const
Definition
SignedKinematics.cxx:149
HLT::MET::SignedKinematics::p
double p() const
Momentum values (signed) momentum.
Definition
SignedKinematics.cxx:103
HLT::MET::SignedKinematics::absPt
double absPt() const
unsigned pt
Definition
SignedKinematics.cxx:115
HLT::MET::SignedKinematics::ey
double ey() const
Definition
SignedKinematics.cxx:152
HLT::MET::SignedKinematics::operator-=
SignedKinematics & operator-=(const SignedKinematics &other)
Subtract a SignedKinematics from this (exact opposite of the above function.
Definition
SignedKinematics.cxx:175
HLT::MET::SignedKinematics::SignedKinematics
SignedKinematics()
Definition
SignedKinematics.cxx:11
HLT::MET::SignedKinematics::absEnergy
double absEnergy() const
unsigned energy
Definition
SignedKinematics.cxx:134
HLT::MET::SignedKinematics::fromEnergyEtaPhi
static SignedKinematics fromEnergyEtaPhi(double energy, double eta, double phi)
Factory function to construct from energy, eta, phi (massless).
Definition
SignedKinematics.cxx:26
HLT::MET::SignedKinematics::fromEtEtaPhiM
static SignedKinematics fromEtEtaPhiM(double et, double eta, double phi, double mass)
Factory function to construct from et eta, phi and m.
Definition
SignedKinematics.cxx:52
HLT::MET::SignedKinematics::cosPhi
double cosPhi() const
Definition
SignedKinematics.cxx:79
HLT::MET::SignedKinematics::energy
double energy() const
Energy values (signed) energy.
Definition
SignedKinematics.cxx:131
HLT::MET::SignedKinematics::absEt
double absEt() const
Unsigned et.
Definition
SignedKinematics.cxx:143
HLT::MET::SignedKinematics::m_p4
ROOT::Math::PxPyPzEVector m_p4
The actual kinematics.
Definition
SignedKinematics.h:119
HLT::MET::SignedKinematics::fromEnergyEtaPhiM
static SignedKinematics fromEnergyEtaPhiM(double energy, double eta, double phi, double mass)
Factory function to construct from energy eta, phi and m.
Definition
SignedKinematics.cxx:32
HLT::MET::SignedKinematics::pt2
double pt2() const
Definition
SignedKinematics.cxx:118
HLT::MET::SignedKinematics::sign
int sign() const
The sign of the kinematics.
Definition
SignedKinematics.cxx:58
HLT::MET::SignedKinematics::pt
double pt() const
(signed) pt
Definition
SignedKinematics.cxx:112
HLT::MET::SignedKinematics::phi
double phi() const
Definition
SignedKinematics.cxx:66
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
HLT::MET
Definition
METComponent.cxx:8
HLT::MET::operator+
METComponent operator+(const METComponent &lhs, const METComponent &rhs)
Definition
METComponent.cxx:48
HLT::MET::operator-
PufitGrid operator-(const PufitGrid &lhs, const PufitGrid &rhs)
Elementwise subtraction.
Definition
PufitGrid.cxx:250
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition
HLTResultReader.h:26
Generated on
for ATLAS Offline Software by
1.17.0