thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Vectors
Lorentz5Vector.h
1
// -*- C++ -*-
2
//
3
// Lorentz5Vector.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_Lorentz5Vector_H
10
#define ThePEG_Lorentz5Vector_H
11
12
// This is the declaration of the Lorentz5vector class.
13
14
#include "
LorentzVector.h
"
15
#include "Lorentz5Vector.fh"
16
#include "ThePEG/Utilities/Maths.h"
17
#include "ThePEG/Utilities/Direction.h"
18
#include "ThePEG/Utilities/UnitIO.h"
19
#include "LorentzRotation.h"
20
21
namespace
ThePEG
{
22
23
template
<
typename
Value>
42
class
Lorentz5Vector
:
public
LorentzVector
<Value> {
43
44
public
:
45
47
using
Value2
=
decltype
(
sqr
(std::declval<Value>()));
48
49
public
:
51
52
Value
x
()
const
{
return
LorentzVector<Value>::x
(); }
53
Value y()
const
{
return
LorentzVector<Value>::y
(); }
54
Value z()
const
{
return
LorentzVector<Value>::z(); }
55
Value t()
const
{
return
LorentzVector<Value>::t(); }
57
58
public
:
59
65
Lorentz5Vector
() :
mm
() {}
66
70
Lorentz5Vector
(Value
m
)
71
:
LorentzVector
<Value>(Value(), Value(), Value(),
m
),
mm
(
m
) {}
72
77
Lorentz5Vector
(Value
x
, Value y, Value z, Value t = Value())
78
:
LorentzVector
<Value>(
x
, y, z, t) {
rescaleMass
(); }
79
84
Lorentz5Vector
(Value
x
, Value y, Value z, Value t, Value
tau
)
85
:
LorentzVector
<Value>(
x
, y, z, t),
mm
(
tau
) {}
86
91
Lorentz5Vector
(
const
ThreeVector<Value>
& p, Value e)
92
:
LorentzVector
<Value>(p, e) {
rescaleMass
(); }
93
98
Lorentz5Vector
(Value
m
,
const
ThreeVector<Value>
& p)
99
:
LorentzVector
<Value>(p, sqrt(p.mag2() +
m
*
m
)),
mm
(
m
) {}
100
105
Lorentz5Vector
(
const
ThreeVector<Value>
& p, Value t, Value
tau
)
106
:
LorentzVector
<Value>(p, t),
mm
(
tau
) {}
107
112
Lorentz5Vector
(
const
LorentzVector<Value>
& p, Value
m
)
113
:
LorentzVector
<Value>(p),
mm
(
m
) {}
114
119
Lorentz5Vector
(
const
LorentzVector<Value>
& p)
120
:
LorentzVector
<Value>(p) {
rescaleMass
(); }
121
125
template
<
class
U>
126
Lorentz5Vector
(
const
Lorentz5Vector<U>
& p)
127
:
LorentzVector
<Value>(p),
mm
(p.
m
) {}
129
135
void
setTau
(Value a) {
mm
= a; }
136
140
void
setMass
(Value a) {
mm
= a; }
141
146
Lorentz5Vector
&
operator=
(
const
LorentzVector<Value>
& q) {
147
LorentzVector<Value>::operator=
(q);
148
return
*
this
;
149
}
151
158
void
rescaleEnergy
() {
159
LorentzVector<Value>::setT
(sqrt(
LorentzVector<Value>::vect
().mag2() +
mass2
()));
160
}
161
166
void
rescaleRho
() {
167
LorentzVector<Value>::setRho
(sqrt(t()*t() -
mass2
()));
168
}
169
174
void
rescaleMass
() {
175
mm
=
LorentzVector<Value>::m
();
176
}
178
184
double
massError
()
const
{
185
return
sqrt(abs(
Math::relativeError
(
mass2
(),
186
LorentzVector<Value>::m2
())));
187
}
188
192
double
energyError
()
const
{
193
return
sqrt(abs(
Math::relativeError
(t()*t(),
mass2
()
194
+
LorentzVector<Value>::vect
().mag2())));
195
}
196
200
double
rhoError
()
const
{
201
return
sqrt(abs(
Math::relativeError
(
LorentzVector<Value>::vect
().mag2(),
202
t()*t() -
mass2
())));
203
}
205
212
Value2
mass2
()
const
{
return
mm
> Value() ?
mm
*
mm
: -
mm
*
mm
; }
213
218
Value2
tau2
()
const
{
return
mass2
(); }
219
224
Value
mass
()
const
{
return
mm
; }
225
226
231
Value
tau
()
const
{
return
mass
(); }
232
237
Value
dirPlus
()
const
{
238
return
Direction<0>::pos
() ?
239
LorentzVector<Value>::plus
()
240
:
241
LorentzVector<Value>::minus
();
242
}
243
248
Value
dirMinus
()
const
{
249
return
Direction<0>::neg
() ?
250
LorentzVector<Value>::plus
()
251
:
252
LorentzVector<Value>::minus
();
253
}
255
259
Lorentz5Vector
&
transform
(
const
LorentzRotation
& r)
260
{
261
LorentzVector<Value>::transform
(r.
one
());
262
return
*
this
;
263
}
264
265
private
:
266
268
Value
mm
;
269
270
};
271
273
template
<
typename
OStream,
typename
T,
typename
UT>
274
void
ounitstream
(OStream & os,
const
Lorentz5Vector<T>
& p, UT & u) {
275
os <<
ounit
(p.
x
(), u) <<
ounit
(p.y(), u) <<
ounit
(p.z(), u)
276
<<
ounit
(p.e(), u) <<
ounit
(p.
mass
(), u);
277
}
278
280
template
<
typename
IStream,
typename
T,
typename
UT>
281
void
iunitstream
(IStream & is,
Lorentz5Vector<T>
& p, UT & u) {
282
T x, y, z, e, mass;
283
is >>
iunit
(x, u) >>
iunit
(y, u) >>
iunit
(z, u) >>
iunit
(e, u)
284
>>
iunit
(mass, u);
285
p =
Lorentz5Vector<T>
(x, y, z, e, mass);
286
}
287
288
290
291
template
<
typename
ValueA,
typename
ValueB>
292
inline
auto
293
operator*(
const
Lorentz5Vector<ValueA> & a,
const
Lorentz5Vector<ValueB> & b)
294
->
decltype
(a.dot(b))
295
{
296
return
a.dot(b);
297
}
298
299
template
<
typename
ValueA,
typename
ValueB>
300
inline
auto
301
operator*(
const
LorentzVector<ValueA> & a,
const
Lorentz5Vector<ValueB> & b)
302
->
decltype
(a.dot(b))
303
{
304
return
a.dot(b);
305
}
306
307
template
<
typename
ValueA,
typename
ValueB>
308
inline
auto
309
operator*(
const
Lorentz5Vector<ValueA> & a,
const
LorentzVector<ValueB> & b)
310
->
decltype
(a.dot(b))
311
{
312
return
a.dot(b);
313
}
314
315
template
<
typename
Value>
316
inline
auto
317
operator*(
const
Lorentz5Vector<Value> & a,
const
Lorentz5Vector<Value> & b)
318
->
decltype
(a.dot(b))
319
{
320
return
a.dot(b);
321
}
323
}
324
325
#endif
/* ThePEG_Particle_H */
LorentzVector.h
contains the LorentzVector class.
ThePEG::Direction::neg
static bool neg()
Return true if the direction is negative (reversed).
Definition:
Direction.h:120
ThePEG::Direction::pos
static bool pos()
Return true if the direction is positive.
Definition:
Direction.h:113
ThePEG::Lorentz5Vector
The Lorentz5Vector inherits from the LorentzVector class.
Definition:
Lorentz5Vector.h:42
ThePEG::Lorentz5Vector::mass2
Value2 mass2() const
Mass/invariant length component squared.
Definition:
Lorentz5Vector.h:212
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(Value x, Value y, Value z, Value t=Value())
Constructor giving the components x, y, z, t.
Definition:
Lorentz5Vector.h:77
ThePEG::Lorentz5Vector::rhoError
double rhoError() const
Return the relative inconsistency in the spatial components.
Definition:
Lorentz5Vector.h:200
ThePEG::Lorentz5Vector::setMass
void setMass(Value a)
Set invariant length/mass.
Definition:
Lorentz5Vector.h:140
ThePEG::Lorentz5Vector::rescaleRho
void rescaleRho()
Rescale spatial component, so that the invariant length/mass of the LorentzVector agrees with the cur...
Definition:
Lorentz5Vector.h:166
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(Value m)
Constructor giving the invariant length.
Definition:
Lorentz5Vector.h:70
ThePEG::Lorentz5Vector::x
Value x() const
Component access.
Definition:
Lorentz5Vector.h:52
ThePEG::Lorentz5Vector::energyError
double energyError() const
Return the relative inconsistency in the energy component.
Definition:
Lorentz5Vector.h:192
ThePEG::Lorentz5Vector::tau2
Value2 tau2() const
Mass/invariant length component squared.
Definition:
Lorentz5Vector.h:218
ThePEG::Lorentz5Vector::mm
Value mm
The invariant mass/length member.
Definition:
Lorentz5Vector.h:268
ThePEG::Lorentz5Vector::transform
Lorentz5Vector & transform(const LorentzRotation &r)
Perform a Lorentz transformation.
Definition:
Lorentz5Vector.h:259
ThePEG::Lorentz5Vector::dirMinus
Value dirMinus() const
Return the positive negative light-cone components (depending on the value of Direction<0>.
Definition:
Lorentz5Vector.h:248
ThePEG::Lorentz5Vector::mass
Value mass() const
Mass/invariant length component.
Definition:
Lorentz5Vector.h:224
ThePEG::Lorentz5Vector::operator=
Lorentz5Vector & operator=(const LorentzVector< Value > &q)
Assignment.
Definition:
Lorentz5Vector.h:146
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(const LorentzVector< Value > &p, Value m)
Constructor giving a LorentzVector and an invariant length.
Definition:
Lorentz5Vector.h:112
ThePEG::Lorentz5Vector::tau
Value tau() const
Mass/invariant length component.
Definition:
Lorentz5Vector.h:231
ThePEG::Lorentz5Vector::rescaleEnergy
void rescaleEnergy()
Rescale energy, so that the invariant length/mass of the LorentzVector agrees with the current one.
Definition:
Lorentz5Vector.h:158
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(const Lorentz5Vector< U > &p)
Construct from value type U convertible to Value.
Definition:
Lorentz5Vector.h:126
ThePEG::Lorentz5Vector::rescaleMass
void rescaleMass()
Set the invariant length/mass member, so that it agrees with the invariant length/mass of the Lorentz...
Definition:
Lorentz5Vector.h:174
ThePEG::Lorentz5Vector::Value2
decltype(sqr(std::declval< Value >())) Value2
Template argument typedef.
Definition:
Lorentz5Vector.h:47
ThePEG::Lorentz5Vector::dirPlus
Value dirPlus() const
Return the positive negative light-cone components (depending on the value of Direction<0>.
Definition:
Lorentz5Vector.h:237
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(const LorentzVector< Value > &p)
Copy from HepLorentzVector constructor.
Definition:
Lorentz5Vector.h:119
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(const ThreeVector< Value > &p, Value t, Value tau)
Constructor giving a 3-Vector, a time component and an invariant length.
Definition:
Lorentz5Vector.h:105
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector()
Constructor giving the null vector.
Definition:
Lorentz5Vector.h:65
ThePEG::Lorentz5Vector::massError
double massError() const
Return the relative inconsistency in the mass component.
Definition:
Lorentz5Vector.h:184
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(Value m, const ThreeVector< Value > &p)
Constructor giving an invariant length and a 3-Vector component.
Definition:
Lorentz5Vector.h:98
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(const ThreeVector< Value > &p, Value e)
Constructor giving a 3-Vector and a time component.
Definition:
Lorentz5Vector.h:91
ThePEG::Lorentz5Vector::Lorentz5Vector
Lorentz5Vector(Value x, Value y, Value z, Value t, Value tau)
Constructor giving the components x, y, z, t and invariant length.
Definition:
Lorentz5Vector.h:84
ThePEG::Lorentz5Vector::setTau
void setTau(Value a)
Set invariant length/mass.
Definition:
Lorentz5Vector.h:135
ThePEG::LorentzRotation
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
Definition:
LorentzRotation.h:27
ThePEG::LorentzRotation::one
const SpinOneLorentzRotation & one() const
The spin-1 transformation.
Definition:
LorentzRotation.h:202
ThePEG::LorentzVector
A 4-component Lorentz vector.
Definition:
LorentzVector.h:44
ThePEG::LorentzVector::m
Value m() const
Magnitude (signed) .
Definition:
LorentzVector.h:131
ThePEG::LorentzVector::operator=
LorentzVector< Value > & operator=(const LorentzVector< ValueB > &b)
Assignment operator.
Definition:
LorentzVector.h:68
ThePEG::LorentzVector::plus
Value plus() const
Returns the positive light-cone component .
Definition:
LorentzVector.h:305
ThePEG::LorentzVector::minus
Value minus() const
Returns the negative light-cone component .
Definition:
LorentzVector.h:307
ThePEG::LorentzVector::transform
LorentzVector< Value > & transform(const SpinOneLorentzRotation &m)
Rotate the vector. Resets .
Definition:
LorentzVector.h:321
ThePEG::LorentzVector::setRho
void setRho(Value newRho)
Set new radius.
Definition:
LorentzVector.h:211
ThePEG::ThreeVector
A 3-component vector.
Definition:
ThreeVector.h:35
ThePEG::Math::relativeError
double relativeError(FloatType x, FloatType y)
Returns (x - y)/(|x| + |y|).
Definition:
Maths.h:80
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::iunit
IUnit< T, UT > iunit(T &t, const UT &ut)
Helper function creating a IUnit object given an object and a unit.
Definition:
UnitIO.h:91
ThePEG::iunitstream
void iunitstream(IStream &is, vector< T, Alloc > &v, UT &u)
Input a vector of objects with the specified unit.
Definition:
Containers.h:289
ThePEG::ounitstream
void ounitstream(OStream &os, const vector< T, Alloc > &v, UT &u)
Ouput a vector of objects with the specified unit.
Definition:
Containers.h:275
ThePEG::sqr
constexpr auto sqr(const T &x) -> decltype(x *x)
The square function should really have been included in the standard C++ library.
Definition:
ThePEG.h:117
ThePEG::ounit
OUnit< T, UT > ounit(const T &t, const UT &ut)
Helper function creating a OUnit object given an object and a unit.
Definition:
UnitIO.h:84
Generated on Thu Jun 20 2024 14:47:02 for ThePEG by
1.9.6