18#ifndef ROOT_MathX_GenVectorX_LorentzVector
19#define ROOT_MathX_GenVectorX_LorentzVector 1
65template <
class CoordSystem>
71 typedef typename CoordSystem::Scalar
Scalar;
94 template <
class Coords>
104 typename =
decltype(std::declval<ForeignLorentzVector>().x() + std::declval<ForeignLorentzVector>().y() +
105 std::declval<ForeignLorentzVector>().z() + std::declval<ForeignLorentzVector>().t())>
119 template <
class LAVector>
131 template <
class OtherCoords>
143 typename =
decltype(std::declval<ForeignLorentzVector>().x() + std::declval<ForeignLorentzVector>().y() +
144 std::declval<ForeignLorentzVector>().z() + std::declval<ForeignLorentzVector>().t())>
160 template <
class LAVector>
372 template <
class OtherLorentzVector>
380 int n =
static_cast<int>(
dphi / (2 *
M_PI) + 0.5);
383 int n =
static_cast<int>(0.5 -
dphi / (2 *
M_PI));
410 template <
class OtherLorentzVector>
413 return t() *
q.t() -
x() *
q.x() -
y() *
q.y() -
z() *
q.z();
422 template <
class OtherLorentzVector>
435 template <
class OtherLorentzVector>
449 template <
class OtherLorentzVector>
464 template <
class OtherLorentzVector>
562 return ee *
ee > pp * pp;
585 return ee *
ee < pp * pp;
602 return -
Vect() /
E();
609 return -
Vect() /
E();
616 template <
class Other4Vector>
647#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
649 "LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
655#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
657 "LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless");
673#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
675 "LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
680#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
681 GenVector_Throw(
"LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
684 }
else if (
t2 ==
v2) {
685#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
686 GenVector_Throw(
"LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
778template <
class CoordSystem>
795template <
class CoordSystem>
799 auto dphi = pp.Phi() -
pm.Phi();
803 int n =
static_cast<int>(
dphi / (2 *
M_PI) + 0.5);
806 int n =
static_cast<int>(0.5 -
dphi / (2 *
M_PI));
823template <
class CoordSystem>
845template <
class CoordSystem>
856#if !defined(ROOT_MATH_SYCL) && !defined(ROOT_MATH_CUDA)
859template <
class char_t,
class traits_t,
class Coords>
860inline std::basic_ostream<char_t, traits_t> &
866 typename Coords::Scalar
a,
b,
c,
d;
867 v.GetCoordinates(
a,
b,
c,
d);
882template <
class char_t,
class traits_t,
class Coords>
883inline std::basic_istream<char_t, traits_t> &
889 typename Coords::Scalar
a,
b,
c,
d;
907 v.SetCoordinates(
a,
b,
c,
d);
919template <
typename CoordSystem>
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
DisplacementVector3D< Cartesian3D< Scalar > > BetaVector
Scalar Pz() const
spatial Z component
void GetCoordinates(Scalar dest[]) const
get internal data into an array of 4 Scalar numbers
void GetCoordinates(IT begin) const
get internal data into 4 Scalars at *begin
Scalar Px() const
spatial X component
Scalar M2() const
return magnitude (mass) squared M2 = T**2 - X**2 - Y**2 - Z**2 (we use -,-,-,+ metric)
bool operator!=(const LorentzVector &rhs) const
Scalar R() const
return the spatial (3D) magnitude ( sqrt(X**2 + Y**2 + Z**2) )
Scalar Pt() const
return the transverse spatial component sqrt ( X**2 + Y**2 )
Scalar DeltaR(const OtherLorentzVector &v, const bool useRapidity=false) const
deltaRapidity between this and vector v
LorentzVector & operator/=(Scalar a)
division by a scalar quantity v /= a
Scalar Et() const
return the transverse energy
LorentzVector & operator+=(const OtherLorentzVector &q)
Self addition with another Vector ( v+= q ) Enable the addition with any other LorentzVector.
LorentzVector< CoordSystem > & SetPt(Scalar a)
Scalar Mt2() const
return the transverse mass squared
LorentzVector< CoordSystem > & SetM(Scalar a)
Scalar Phi() const
azimuthal Angle
LorentzVector< CoordSystem > & SetPy(Scalar a)
Scalar Eta() const
pseudorapidity
bool isLightlike(Scalar tolerance=100 *std::numeric_limits< Scalar >::epsilon()) const
Determine if momentum-energy can represent a massless particle.
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
LorentzVector()
default constructor of an empty vector (Px = Py = Pz = E = 0 )
LorentzVector operator+(const OtherLorentzVector &v2) const
addition of two LorentzVectors (v3 = v1 + v2) Enable the addition with any other LorentzVector
LorentzVector & operator-=(const OtherLorentzVector &q)
Self subtraction of another Vector from this ( v-= q ) Enable the addition with any other LorentzVect...
LorentzVector operator-() const
Negative of a LorentzVector (q = - v )
LorentzVector< CoordSystem > & SetXYZT(Scalar xx, Scalar yy, Scalar zz, Scalar tt)
set the values of the vector from the cartesian components (x,y,z,t) (if the vector is held in anothe...
LorentzVector< CoordSystem > & SetEta(Scalar a)
BetaVector BoostToCM(const Other4Vector &v) const
The beta vector for the boost that would bring this vector into its center of mass frame (zero moment...
LorentzVector operator+() const
LorentzVector(const ForeignLorentzVector &v)
Construct from a foreign 4D vector type, for example, HepLorentzVector Precondition: v must implement...
LorentzVector< CoordSystem > & SetPxPyPzE(Scalar xx, Scalar yy, Scalar zz, Scalar ee)
LorentzVector< CoordSystem > & SetPhi(Scalar a)
bool isSpacelike() const
Determine if momentum-energy is spacelike, and represents a tachyon.
Scalar Beta() const
Return beta scalar value.
LorentzVector< CoordSystem > operator/(const Scalar &a) const
Divide a LorentzVector by a scalar quantity.
LorentzVector< CoordSystem > & SetPx(Scalar a)
const CoordSystem & Coordinates() const
Retrieve a const reference to the coordinates object.
void GetCoordinates(Scalar &a, Scalar &b, Scalar &c, Scalar &d) const
get internal data into 4 Scalar numbers
bool isTimelike() const
Determine if momentum-energy can represent a physical massive particle.
LorentzVector< CoordSystem > & SetPz(Scalar a)
LorentzVector< CoordSystem > & SetE(Scalar a)
Methods setting a Single-component Work only if the component is one of which the vector is represent...
Scalar Gamma() const
Return Gamma scalar value.
Scalar Perp2() const
return the square of the transverse spatial component ( X**2 + Y**2 )
LorentzVector< CoordSystem > & SetCoordinates(IT begin, IT end)
Set internal data based on 4 Scalars at *begin to *end.
LorentzVector(const LorentzVector< Coords > &v)
constructor from a LorentzVector expressed in different coordinates, or using a different Scalar type
LorentzVector operator*(const Scalar &a) const
product of a LorentzVector by a scalar quantity
Scalar M() const
return magnitude (mass) using the (-,-,-,+) metric.
LorentzVector< CoordSystem > & SetCoordinates(Scalar a, Scalar b, Scalar c, Scalar d)
Set internal data based on 4 Scalar numbers.
CoordSystem::Scalar Scalar
bool operator==(const LorentzVector &rhs) const
Exact equality.
Scalar Dot(const OtherLorentzVector &q) const
scalar (Dot) product of two LorentzVector vectors (metric is -,-,-,+) Enable the product using any ot...
Scalar Py() const
spatial Y component
LorentzVector & operator=(const LorentzVector< OtherCoords > &v)
Assignment operator from a lorentz vector of arbitrary type.
LorentzVector operator-(const OtherLorentzVector &v2) const
subtraction of two LorentzVectors (v3 = v1 - v2) Enable the subtraction of any other LorentzVector
BetaVector BoostToCM() const
The beta vector for the boost that would bring this vector into its center of mass frame (zero moment...
LorentzVector(const Scalar &a, const Scalar &b, const Scalar &c, const Scalar &d)
generic constructors from four scalar values.
Scalar P2() const
return the square of the spatial (3D) magnitude ( X**2 + Y**2 + Z**2 )
LorentzVector & operator*=(Scalar a)
multiplication by a scalar quantity v *= a
CoordSystem CoordinateType
Scalar Theta() const
polar Angle
Scalar ColinearRapidity() const
Rapidity in the direction of travel: atanh (|P|/E)=.5 log[(E+P)/(E-P)].
Scalar Mt() const
return the transverse mass
Scalar Et2() const
return the transverse energy squared
LorentzVector< CoordSystem > & SetCoordinates(const Scalar src[])
Set internal data based on an array of 4 Scalar numbers.
void GetCoordinates(IT begin, IT end) const
get internal data into 4 Scalars at *begin to *end
Scalar Rapidity() const
Rapidity relative to the Z axis: .5 log [(E+Pz)/(E-Pz)].
DisplacementVector3D< Cartesian3D< Scalar > > Vect() const
get the spatial components of the Vector in a DisplacementVector based on Cartesian Coordinates
LorentzVector< CoordSystem >::Scalar Acoplanarity(LorentzVector< CoordSystem > const &pp, LorentzVector< CoordSystem > const &pm)
pair (p+ p-) acoplanarity alpha = 1 - |phi+ - phi-|/pi.
LorentzVector< CoordSystem >::Scalar AsymmetryVectorial(LorentzVector< CoordSystem > const &pp, LorentzVector< CoordSystem > const &pm)
pair (p+ p-) vectorial asymmetry Av = |Pt+ - Pt-|/|Pt+ + Pt-|.
LorentzVector< CoordSystem >::Scalar AsymmetryScalar(LorentzVector< CoordSystem > const &pp, LorentzVector< CoordSystem > const &pm)
pair (p+ p-) scalar asymmetry As = ||Pt+| - |Pt-|/||Pt+| + |Pt-||.
std::basic_istream< char_t, traits_t > & require_delim(std::basic_istream< char_t, traits_t > &is, manip_t m)
char_t get_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m)
void set_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m, char_t ch)
Scalar math_log(Scalar x)
void GenVector_Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
Scalar math_sqrt(Scalar x)
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
std::basic_istream< char_t, traits_t > & operator>>(std::basic_istream< char_t, traits_t > &is, DisplacementVector2D< T, U > &v)
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.
Scalar math_fabs(Scalar x)