cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
Momentum.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2022 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef CepGen_Physics_Momentum_h
20
#define CepGen_Physics_Momentum_h
21
22
#include <array>
23
#include <iosfwd>
24
25
namespace
cepgen
{
26
class
Vector;
33
class
Momentum
:
private
std::array<double, 4> {
34
public
:
36
explicit
Momentum
(
double
x = 0.,
double
y = 0.,
double
z = 0.,
double
t = -1.);
38
explicit
Momentum
(
double
*
p
);
40
explicit
Momentum
(
const
Vector
&);
41
42
bool
operator==
(
const
Momentum
&)
const
;
43
inline
bool
operator!=
(
const
Momentum
& oth)
const
{
return
!
operator==
(oth); }
44
45
//--- static definitions
46
48
static
Momentum
fromPtEtaPhiE
(
double
pt
,
double
eta
,
double
phi
,
double
e = -1.);
50
static
Momentum
fromPtEtaPhiM
(
double
pt
,
double
eta
,
double
phi
,
double
m);
52
static
Momentum
fromPThetaPhiE
(
double
p
,
double
theta
,
double
phi
,
double
e = -1.);
54
static
Momentum
fromPxPyPzE
(
double
px
,
double
py
,
double
pz
,
double
e);
56
static
Momentum
fromPxPyPzM
(
double
px
,
double
py
,
double
pz
,
double
m);
58
static
Momentum
fromPxPyYM
(
double
px
,
double
py
,
double
rap,
double
m);
60
static
Momentum
fromPtYPhiM
(
double
pt
,
double
rap,
double
phi
,
double
m);
61
62
//--- vector and scalar operators
63
65
double
threeProduct
(
const
Momentum
&)
const
;
67
double
fourProduct
(
const
Momentum
&)
const
;
69
double
crossProduct
(
const
Momentum
&)
const
;
71
Momentum
operator+
(
const
Momentum
&)
const
;
73
Momentum
&
operator+=
(
const
Momentum
&);
75
Momentum
operator-
()
const
;
77
Momentum
operator-
(
const
Momentum
&)
const
;
79
Momentum
&
operator-=
(
const
Momentum
&);
81
double
operator*
(
const
Momentum
&)
const
;
83
Momentum
operator%
(
const
Momentum
&)
const
;
85
double
operator*=
(
const
Momentum
&);
87
Momentum
operator*
(
double
c)
const
;
89
Momentum
&
operator*=
(
double
c);
91
friend
Momentum
operator*
(
double
,
const
Momentum
&);
93
friend
std::ostream&
operator<<
(std::ostream&,
const
Momentum
&);
94
96
operator
Vector
()
const
;
97
99
Momentum
&
betaGammaBoost
(
double
gamma
,
double
betagamma);
101
Momentum
&
lorentzBoost
(
const
Momentum
&
p
);
102
103
//--- setters and getters
104
106
Momentum
&
setP
(
double
px
,
double
py
,
double
pz
,
double
e);
108
Momentum
&
setP
(
double
px
,
double
py
,
double
pz
);
110
Momentum
&
setPx
(
double
px
);
112
inline
double
px
()
const
{
return
(*
this
)[X]; }
114
Momentum
&
setPy
(
double
py
);
116
inline
double
py
()
const
{
return
(*
this
)[Y]; }
118
Momentum
&
setPz
(
double
pz
);
120
inline
double
pz
()
const
{
return
(*
this
)[Z]; }
122
double
pt
()
const
;
124
double
pt2
()
const
;
126
Momentum
transverse
()
const
;
128
std::array<double, 5>
pVector
()
const
;
130
inline
double
p
()
const
{
return
p_; }
132
inline
double
p2
()
const
{
return
p_ * p_; }
134
Momentum
&
setEnergy
(
double
);
136
inline
double
energy
()
const
{
return
(*
this
)[E]; }
138
inline
double
energy2
()
const
{
return
(*
this
)[E] * (*this)[E]; }
140
double
energyT
()
const
;
142
double
energyT2
()
const
;
144
Momentum
&
setMass2
(
double
);
146
double
mass2
()
const
;
148
Momentum
&
setMass
(
double
);
151
double
mass
()
const
;
153
double
massT2
()
const
;
155
double
massT
()
const
;
157
double
theta
()
const
;
159
double
phi
()
const
;
161
double
eta
()
const
;
163
double
rapidity
()
const
;
164
166
double
deltaEta
(
const
Momentum
&)
const
;
168
double
deltaPhi
(
const
Momentum
&)
const
;
170
double
deltaPt
(
const
Momentum
&)
const
;
172
double
deltaR
(
const
Momentum
&)
const
;
173
175
double
beta
()
const
;
177
double
gamma2
()
const
;
179
double
gamma
()
const
;
180
183
Momentum
&
computeEnergyFromMass
(
double
on_shell_mass);
186
Momentum
&
computePzFromMass
(
double
on_shell_mass);
187
189
Momentum
&
truncate
(
double
tolerance = 1.e-10);
190
192
Momentum
&
rotatePhi
(
double
phi
,
double
sign);
194
Momentum
&
rotateThetaPhi
(
double
theta
,
double
phi
);
196
inline
Momentum
&
mirrorX
() {
197
(*this)[X] *= -1.;
198
return
*
this
;
199
}
201
inline
Momentum
&
mirrorY
() {
202
(*this)[Y] *= -1.;
203
return
*
this
;
204
}
206
inline
Momentum
&
mirrorZ
() {
207
(*this)[Z] *= -1.;
208
return
*
this
;
209
}
210
211
private
:
212
enum
coord_t { X = 0, Y = 1, Z = 2, E = 3 };
214
Momentum& computeP();
216
double
p_{0.};
217
};
218
}
// namespace cepgen
219
220
#endif
cepgen::Momentum
Container for a particle's 4-momentum, along with useful methods to ease the development of any matri...
Definition
Momentum.h:33
cepgen::Momentum::pt2
double pt2() const
Squared transverse momentum (in GeV )
Definition
Momentum.cpp:234
cepgen::Momentum::pz
double pz() const
Longitudinal momentum (in GeV)
Definition
Momentum.h:120
cepgen::Momentum::operator*=
double operator*=(const Momentum &)
Scalar product of the 3-momentum with another 3-momentum.
cepgen::Momentum::threeProduct
double threeProduct(const Momentum &) const
Scalar product of the 3-momentum with another 3-momentum.
Definition
Momentum.cpp:138
cepgen::Momentum::setMass2
Momentum & setMass2(double)
Compute the energy from the mass.
Definition
Momentum.cpp:178
cepgen::Momentum::deltaR
double deltaR(const Momentum &) const
Angular distance between two momenta.
Definition
Momentum.cpp:259
cepgen::Momentum::deltaEta
double deltaEta(const Momentum &) const
Pseudorapidity distance between two momenta.
Definition
Momentum.cpp:251
cepgen::Momentum::energyT2
double energyT2() const
Squared tranverse energy component (in GeV )
Definition
Momentum.cpp:213
cepgen::Momentum::rapidity
double rapidity() const
Rapidity.
Definition
Momentum.cpp:246
cepgen::Momentum::setPy
Momentum & setPy(double py)
Set the momentum along the -axis (in GeV)
Definition
Momentum.cpp:161
cepgen::Momentum::betaGammaBoost
Momentum & betaGammaBoost(double gamma, double betagamma)
Forward boost.
Definition
Momentum.cpp:297
cepgen::Momentum::deltaPt
double deltaPt(const Momentum &) const
Transverse momentum distance between two momenta.
Definition
Momentum.cpp:257
cepgen::Momentum::operator+=
Momentum & operator+=(const Momentum &)
Add a 4-momentum through a 4-vector sum.
Definition
Momentum.cpp:104
cepgen::Momentum::gamma2
double gamma2() const
Squared gamma scalar value.
Definition
Momentum.cpp:280
cepgen::Momentum::rotateThetaPhi
Momentum & rotateThetaPhi(double theta, double phi)
Rotate the particle's momentum by a polar/azimuthal angle.
Definition
Momentum.cpp:330
cepgen::Momentum::deltaPhi
double deltaPhi(const Momentum &) const
Azimutal angle opening between two momenta.
Definition
Momentum.cpp:253
cepgen::Momentum::eta
double eta() const
Pseudo-rapidity.
Definition
Momentum.cpp:240
cepgen::Momentum::lorentzBoost
Momentum & lorentzBoost(const Momentum &p)
Forward Lorentz boost.
Definition
Momentum.cpp:304
cepgen::Momentum::computeEnergyFromMass
Momentum & computeEnergyFromMass(double on_shell_mass)
Compute the mass from 4-momentum.
Definition
Momentum.cpp:186
cepgen::Momentum::operator*
friend Momentum operator*(double, const Momentum &)
Left-multiply all 4-momentum coordinates by a scalar.
Definition
Momentum.cpp:134
cepgen::Momentum::px
double px() const
Momentum along the -axis (in GeV)
Definition
Momentum.h:112
cepgen::Momentum::fromPxPyYM
static Momentum fromPxPyYM(double px, double py, double rap, double m)
Build a 4-momentum from its transverse momentum, rapidity and mass.
Definition
Momentum.cpp:88
cepgen::Momentum::gamma
double gamma() const
Gamma scalar value.
Definition
Momentum.cpp:295
cepgen::Momentum::p2
double p2() const
Squared 3-momentum norm (in GeV )
Definition
Momentum.h:132
cepgen::Momentum::mirrorX
Momentum & mirrorX()
Apply a transformation.
Definition
Momentum.h:196
cepgen::Momentum::py
double py() const
Momentum along the -axis (in GeV)
Definition
Momentum.h:116
cepgen::Momentum::fromPxPyPzM
static Momentum fromPxPyPzM(double px, double py, double pz, double m)
Build a 4-momentum from its three momentum coordinates and mass.
Definition
Momentum.cpp:84
cepgen::Momentum::beta
double beta() const
Beta scalar value.
Definition
Momentum.cpp:265
cepgen::Momentum::fromPxPyPzE
static Momentum fromPxPyPzE(double px, double py, double pz, double e)
Build a 4-momentum from its four momentum and energy coordinates.
Definition
Momentum.cpp:82
cepgen::Momentum::setP
Momentum & setP(double px, double py, double pz, double e)
Set all the components of the 4-momentum (in GeV)
Definition
Momentum.cpp:180
cepgen::Momentum::setEnergy
Momentum & setEnergy(double)
Set the energy (in GeV)
Definition
Momentum.cpp:171
cepgen::Momentum::crossProduct
double crossProduct(const Momentum &) const
Vector product of the 3-momentum with another 3-momentum.
Definition
Momentum.cpp:152
cepgen::Momentum::massT2
double massT2() const
Squared transverse mass (in GeV )
Definition
Momentum.cpp:224
cepgen::Momentum::energy2
double energy2() const
Squared energy (in GeV )
Definition
Momentum.h:138
cepgen::Momentum::mirrorY
Momentum & mirrorY()
Apply a transformation.
Definition
Momentum.h:201
cepgen::Momentum::massT
double massT() const
Transverse mass (in GeV)
Definition
Momentum.cpp:226
cepgen::Momentum::pt
double pt() const
Transverse momentum (in GeV)
Definition
Momentum.cpp:232
cepgen::Momentum::setPz
Momentum & setPz(double pz)
Set the longitudinal momentum (in GeV)
Definition
Momentum.cpp:166
cepgen::Momentum::setMass
Momentum & setMass(double)
Compute the energy from the mass.
Definition
Momentum.cpp:176
cepgen::Momentum::transverse
Momentum transverse() const
Transverse coordinates of a momentum.
Definition
Momentum.cpp:236
cepgen::Momentum::fourProduct
double fourProduct(const Momentum &) const
Scalar product of the 4-momentum with another 4-momentum.
Definition
Momentum.cpp:145
cepgen::Momentum::setPx
Momentum & setPx(double px)
Set the momentum along the -axis (in GeV)
Definition
Momentum.cpp:156
cepgen::Momentum::fromPtEtaPhiM
static Momentum fromPtEtaPhiM(double pt, double eta, double phi, double m)
Build a 3-momentum from its three pseudo-cylindrical coordinates.
Definition
Momentum.cpp:73
cepgen::Momentum::phi
double phi() const
Azimuthal angle (angle in the transverse plane)
Definition
Momentum.cpp:230
cepgen::Momentum::p
double p() const
3-momentum norm (in GeV)
Definition
Momentum.h:130
cepgen::Momentum::operator+
Momentum operator+(const Momentum &) const
Compute the 4-vector sum of two 4-momenta.
Definition
Momentum.cpp:100
cepgen::Momentum::operator%
Momentum operator%(const Momentum &) const
Vector product of two 3-momenta.
Definition
Momentum.cpp:122
cepgen::Momentum::mass
double mass() const
Mass (in GeV) as computed from its energy and momentum.
Definition
Momentum.cpp:222
cepgen::Momentum::truncate
Momentum & truncate(double tolerance=1.e-10)
Apply a threshold to all values with a given tolerance.
Definition
Momentum.cpp:197
cepgen::Momentum::energyT
double energyT() const
Tranverse energy component (in GeV)
Definition
Momentum.cpp:218
cepgen::Momentum::operator-=
Momentum & operator-=(const Momentum &)
Subtract a 4-momentum through a 4-vector sum.
Definition
Momentum.cpp:115
cepgen::Momentum::operator<<
friend std::ostream & operator<<(std::ostream &, const Momentum &)
Human-readable format for a particle's momentum.
Definition
Momentum.cpp:353
cepgen::Momentum::pVector
std::array< double, 5 > pVector() const
5-vector of double precision floats (in GeV)
Definition
Momentum.cpp:204
cepgen::Momentum::mirrorZ
Momentum & mirrorZ()
Apply a transformation.
Definition
Momentum.h:206
cepgen::Momentum::fromPtYPhiM
static Momentum fromPtYPhiM(double pt, double rap, double phi, double m)
Build a 4-momentum from its transverse momentum, azimuthal angle, rapidity and mass.
Definition
Momentum.cpp:93
cepgen::Momentum::computePzFromMass
Momentum & computePzFromMass(double on_shell_mass)
Compute the longitudinal coordinate from energy-mass-transverse momentum constraints.
Definition
Momentum.cpp:188
cepgen::Momentum::fromPtEtaPhiE
static Momentum fromPtEtaPhiE(double pt, double eta, double phi, double e=-1.)
Build a 3-momentum from its three pseudo-cylindrical coordinates.
Definition
Momentum.cpp:69
cepgen::Momentum::rotatePhi
Momentum & rotatePhi(double phi, double sign)
Rotate the transverse components by an angle phi (and reflect the y coordinate)
Definition
Momentum.cpp:324
cepgen::Momentum::operator!=
bool operator!=(const Momentum &oth) const
Inequality operator.
Definition
Momentum.h:43
cepgen::Momentum::energy
double energy() const
Energy (in GeV)
Definition
Momentum.h:136
cepgen::Momentum::theta
double theta() const
Polar angle (angle with respect to the longitudinal direction)
Definition
Momentum.cpp:228
cepgen::Momentum::operator==
bool operator==(const Momentum &) const
Equality operator.
Definition
Momentum.cpp:63
cepgen::Momentum::fromPThetaPhiE
static Momentum fromPThetaPhiE(double p, double theta, double phi, double e=-1.)
Build a 4-momentum from its scalar momentum, and its polar and azimuthal angles.
Definition
Momentum.cpp:77
cepgen::Momentum::operator-
Momentum operator-() const
Unary inverse operator.
Definition
Momentum.cpp:109
cepgen::Momentum::mass2
double mass2() const
Squared mass (in GeV ) as computed from its energy and momentum.
Definition
Momentum.cpp:220
cepgen::Vector
Specialisation of a matrix.
Definition
Algebra.h:139
cepgen
Common namespace for this Monte Carlo generator.
Definition
CommandLineHandler.cpp:36
CepGen
Physics
Momentum.h
Generated on Mon Jul 29 2024 for CepGen by
1.9.7