HepMC3 event record library
|
Generic 4-vector.
Interpretation of its content depends on accessors used: it's much simpler to do this than to distinguish between space and momentum vectors via the type system (especially given the need for backward compatibility with HepMC2). Be sensible and don't call energy functions on spatial vectors! To avoid duplication, most definitions are only implemented on the spatial function names, with the energy-momentum functions as aliases.
This is not intended to be a fully featured 4-vector, but does contain the majority of common non-boosting functionality, as well as a few support operations on 4-vectors.
The implementations in this class are fully inlined.
Definition at line 36 of file FourVector.h.
#include <FourVector.h>
Public Member Functions | |
FourVector () | |
Default constructor. | |
FourVector (double xx, double yy, double zz, double ee) | |
Sets all FourVector fields. | |
FourVector (const FourVector &)=default | |
Copy constructor. | |
FourVector (FourVector &&)=default | |
Move constructor. | |
FourVector & | operator= (const FourVector &)=default |
= | |
FourVector & | operator= (FourVector &&)=default |
= | |
Component accessors | |
void | set (double x1, double x2, double x3, double x4) |
Set all FourVector fields, in order x,y,z,t. | |
void | set_component (const int i, const double x) |
set component of position/displacement | |
double | get_component (const int i) const |
get component of position/displacement | |
double | x () const |
x-component of position/displacement | |
void | set_x (double xx) |
Set x-component of position/displacement. | |
void | setX (double xx) |
double | y () const |
y-component of position/displacement | |
void | set_y (double yy) |
Set y-component of position/displacement. | |
void | setY (double yy) |
double | z () const |
z-component of position/displacement | |
void | set_z (double zz) |
Set z-component of position/displacement. | |
void | setZ (double zz) |
double | t () const |
Time component of position/displacement. | |
void | set_t (double tt) |
Set time component of position/displacement. | |
void | setT (double tt) |
double | px () const |
x-component of momentum | |
void | set_px (double pxx) |
Set x-component of momentum. | |
void | setPx (double pxx) |
double | py () const |
y-component of momentum | |
void | set_py (double pyy) |
Set y-component of momentum. | |
void | setPy (double pyy) |
double | pz () const |
z-component of momentum | |
void | set_pz (double pzz) |
Set z-component of momentum. | |
void | setPz (double pzz) |
double | e () const |
Energy component of momentum. | |
void | set_e (double ee) |
Set energy component of momentum. | |
void | setE (double ee) |
Computed properties | |
double | length2 () const |
Squared magnitude of (x, y, z) 3-vector. | |
double | length () const |
Magnitude of spatial (x, y, z) 3-vector. | |
double | rho () const |
Magnitude of spatial (x, y, z) 3-vector, for HepMC2 compatibility. | |
double | perp2 () const |
Squared magnitude of (x, y) vector. | |
double | perp () const |
Magnitude of (x, y) vector. | |
double | interval () const |
Spacetime invariant interval s^2 = t^2 - x^2 - y^2 - z^2. | |
double | p3mod2 () const |
Squared magnitude of p3 = (px, py, pz) vector. | |
double | p3mod () const |
Magnitude of p3 = (px, py, pz) vector. | |
double | pt2 () const |
Squared transverse momentum px^2 + py^2. | |
double | pt () const |
Transverse momentum. | |
double | m2 () const |
Squared invariant mass m^2 = E^2 - px^2 - py^2 - pz^2. | |
double | m () const |
Invariant mass. Returns -sqrt(-m) if e^2 - P^2 is negative. | |
double | phi () const |
Azimuthal angle. | |
double | theta () const |
Polar angle w.r.t. z direction. | |
double | eta () const |
Pseudorapidity. | |
double | rap () const |
Rapidity. | |
double | abs_eta () const |
Absolute pseudorapidity. | |
double | abs_rap () const |
Absolute rapidity. | |
double | pseudoRapidity () const |
Comparisons to another FourVector | |
bool | is_zero () const |
Check if the length of this vertex is zero. | |
double | delta_phi (const FourVector &v) const |
Signed azimuthal angle separation in [-pi, pi]. | |
double | delta_eta (const FourVector &v) const |
Pseudorapidity separation. | |
double | delta_rap (const FourVector &v) const |
Rapidity separation. | |
double | delta_r2_eta (const FourVector &v) const |
R_eta^2-distance separation dR^2 = dphi^2 + deta^2. | |
double | delta_r_eta (const FourVector &v) const |
R_eta-distance separation dR = sqrt(dphi^2 + deta^2) | |
double | delta_r2_rap (const FourVector &v) const |
R_rap^2-distance separation dR^2 = dphi^2 + drap^2. | |
double | delta_r_rap (const FourVector &v) const |
R-rap-distance separation dR = sqrt(dphi^2 + drap^2) | |
Operators | |
bool | operator== (const FourVector &rhs) const |
Equality. | |
bool | operator!= (const FourVector &rhs) const |
Inequality. | |
FourVector | operator+ (const FourVector &rhs) const |
Arithmetic operator +. | |
FourVector | operator- (const FourVector &rhs) const |
Arithmetic operator -. | |
FourVector | operator* (const double rhs) const |
Arithmetic operator * by scalar. | |
FourVector | operator/ (const double rhs) const |
Arithmetic operator / by scalar. | |
void | operator+= (const FourVector &rhs) |
Arithmetic operator +=. | |
void | operator-= (const FourVector &rhs) |
Arithmetic operator -=. | |
void | operator*= (const double rhs) |
Arithmetic operator *= by scalar. | |
void | operator/= (const double rhs) |
Arithmetic operator /= by scalar. | |
Static Public Member Functions | |
static const FourVector & | ZERO_VECTOR () |
Static null FourVector = (0,0,0,0) | |
Private Attributes | |
double | m_v1 |
px or x. Interpretation depends on accessors used | |
double | m_v2 |
py or y. Interpretation depends on accessors used | |
double | m_v3 |
pz or z. Interpretation depends on accessors used | |
double | m_v4 |
e or t. Interpretation depends on accessors used | |
|
inline |
Default constructor.
Definition at line 40 of file FourVector.h.
|
inline |
Sets all FourVector fields.
Definition at line 43 of file FourVector.h.
|
default |
Copy constructor.
|
default |
Move constructor.
|
inline |
|
inline |
|
inline |
Pseudorapidity separation.
Definition at line 209 of file FourVector.h.
References FourVector::eta().
|
inline |
Signed azimuthal angle separation in [-pi, pi].
Definition at line 200 of file FourVector.h.
References M_PI, and FourVector::phi().
|
inline |
R_eta^2-distance separation dR^2 = dphi^2 + deta^2.
Definition at line 215 of file FourVector.h.
References FourVector::delta_eta(), and FourVector::delta_phi().
|
inline |
R_rap^2-distance separation dR^2 = dphi^2 + drap^2.
Definition at line 225 of file FourVector.h.
References FourVector::delta_phi(), and FourVector::delta_rap().
|
inline |
R_eta-distance separation dR = sqrt(dphi^2 + deta^2)
Definition at line 220 of file FourVector.h.
References FourVector::delta_r2_eta().
|
inline |
R-rap-distance separation dR = sqrt(dphi^2 + drap^2)
Definition at line 230 of file FourVector.h.
References FourVector::delta_r2_rap().
|
inline |
|
inline |
Energy component of momentum.
Definition at line 135 of file FourVector.h.
References FourVector::t().
|
inline |
Pseudorapidity.
Definition at line 178 of file FourVector.h.
References FourVector::p3mod(), and FourVector::pz().
|
inline |
get component of position/displacement
Definition at line 74 of file FourVector.h.
References FourVector::m_v1, FourVector::m_v2, FourVector::m_v3, and FourVector::m_v4.
|
inline |
Spacetime invariant interval s^2 = t^2 - x^2 - y^2 - z^2.
Definition at line 158 of file FourVector.h.
References FourVector::length2(), and FourVector::t().
|
inline |
Check if the length of this vertex is zero.
Definition at line 197 of file FourVector.h.
References FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Magnitude of spatial (x, y, z) 3-vector.
Definition at line 150 of file FourVector.h.
References FourVector::length2().
|
inline |
Squared magnitude of (x, y, z) 3-vector.
Definition at line 148 of file FourVector.h.
References FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Invariant mass. Returns -sqrt(-m) if e^2 - P^2 is negative.
Definition at line 171 of file FourVector.h.
References FourVector::m2().
|
inline |
Squared invariant mass m^2 = E^2 - px^2 - py^2 - pz^2.
Definition at line 169 of file FourVector.h.
References FourVector::interval().
|
inline |
Inequality.
Definition at line 245 of file FourVector.h.
|
inline |
Arithmetic operator * by scalar.
Definition at line 256 of file FourVector.h.
References FourVector::FourVector(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator *= by scalar.
Definition at line 279 of file FourVector.h.
References FourVector::setT(), FourVector::setX(), FourVector::setY(), FourVector::setZ(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator +.
Definition at line 248 of file FourVector.h.
References FourVector::FourVector(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator +=.
Definition at line 265 of file FourVector.h.
References FourVector::setT(), FourVector::setX(), FourVector::setY(), FourVector::setZ(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator -.
Definition at line 252 of file FourVector.h.
References FourVector::FourVector(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator -=.
Definition at line 272 of file FourVector.h.
References FourVector::setT(), FourVector::setX(), FourVector::setY(), FourVector::setZ(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator / by scalar.
Definition at line 260 of file FourVector.h.
References FourVector::FourVector(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Arithmetic operator /= by scalar.
Definition at line 286 of file FourVector.h.
References FourVector::setT(), FourVector::setX(), FourVector::setY(), FourVector::setZ(), FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
default |
=
|
default |
=
|
inline |
Equality.
Definition at line 241 of file FourVector.h.
References FourVector::t(), FourVector::x(), FourVector::y(), and FourVector::z().
|
inline |
Magnitude of p3 = (px, py, pz) vector.
Definition at line 163 of file FourVector.h.
References FourVector::length().
|
inline |
Squared magnitude of p3 = (px, py, pz) vector.
Definition at line 161 of file FourVector.h.
References FourVector::length2().
|
inline |
Magnitude of (x, y) vector.
Definition at line 156 of file FourVector.h.
References FourVector::perp2().
|
inline |
Squared magnitude of (x, y) vector.
Definition at line 154 of file FourVector.h.
References FourVector::x(), and FourVector::y().
|
inline |
Azimuthal angle.
Definition at line 174 of file FourVector.h.
References FourVector::x(), and FourVector::y().
|
inline |
Same as eta()
Definition at line 188 of file FourVector.h.
References FourVector::eta().
|
inline |
|
inline |
Squared transverse momentum px^2 + py^2.
Definition at line 165 of file FourVector.h.
References FourVector::perp2().
|
inline |
|
inline |
|
inline |
|
inline |
Rapidity.
Definition at line 180 of file FourVector.h.
References FourVector::e(), and FourVector::pz().
|
inline |
Magnitude of spatial (x, y, z) 3-vector, for HepMC2 compatibility.
Definition at line 152 of file FourVector.h.
References FourVector::length().
|
inline |
Set all FourVector fields, in order x,y,z,t.
Definition at line 58 of file FourVector.h.
References FourVector::m_v1, FourVector::m_v2, FourVector::m_v3, and FourVector::m_v4.
|
inline |
set component of position/displacement
Definition at line 66 of file FourVector.h.
References FourVector::m_v1, FourVector::m_v2, FourVector::m_v3, FourVector::m_v4, and FourVector::x().
|
inline |
Set energy component of momentum.
Definition at line 137 of file FourVector.h.
References FourVector::set_t().
|
inline |
Set x-component of momentum.
Definition at line 116 of file FourVector.h.
References FourVector::set_x().
|
inline |
Set y-component of momentum.
Definition at line 123 of file FourVector.h.
References FourVector::set_y().
|
inline |
Set z-component of momentum.
Definition at line 130 of file FourVector.h.
References FourVector::set_z().
|
inline |
Set time component of position/displacement.
Definition at line 108 of file FourVector.h.
References FourVector::m_v4.
|
inline |
Set x-component of position/displacement.
Definition at line 87 of file FourVector.h.
References FourVector::m_v1.
|
inline |
Set y-component of position/displacement.
Definition at line 94 of file FourVector.h.
References FourVector::m_v2.
|
inline |
Set z-component of position/displacement.
Definition at line 101 of file FourVector.h.
References FourVector::m_v3.
|
inline |
Definition at line 139 of file FourVector.h.
References FourVector::set_e().
|
inline |
Definition at line 118 of file FourVector.h.
References FourVector::set_px().
|
inline |
Definition at line 125 of file FourVector.h.
References FourVector::set_py().
|
inline |
Definition at line 132 of file FourVector.h.
References FourVector::set_pz().
|
inline |
Definition at line 110 of file FourVector.h.
References FourVector::set_t().
|
inline |
Definition at line 89 of file FourVector.h.
References FourVector::set_x().
|
inline |
Definition at line 96 of file FourVector.h.
References FourVector::set_y().
|
inline |
Definition at line 103 of file FourVector.h.
References FourVector::set_z().
|
inline |
Time component of position/displacement.
Definition at line 106 of file FourVector.h.
References FourVector::m_v4.
|
inline |
Polar angle w.r.t. z direction.
Definition at line 176 of file FourVector.h.
References FourVector::perp(), and FourVector::z().
|
inline |
x-component of position/displacement
Definition at line 85 of file FourVector.h.
References FourVector::m_v1.
|
inline |
y-component of position/displacement
Definition at line 92 of file FourVector.h.
References FourVector::m_v2.
|
inline |
z-component of position/displacement
Definition at line 99 of file FourVector.h.
References FourVector::m_v3.
|
inlinestatic |
Static null FourVector = (0,0,0,0)
Definition at line 297 of file FourVector.h.
|
private |
px or x. Interpretation depends on accessors used
Definition at line 305 of file FourVector.h.
|
private |
py or y. Interpretation depends on accessors used
Definition at line 306 of file FourVector.h.
|
private |
pz or z. Interpretation depends on accessors used
Definition at line 307 of file FourVector.h.
|
private |
e or t. Interpretation depends on accessors used
Definition at line 308 of file FourVector.h.