18#ifndef ROOT_Math_GenVector_LorentzVector
19#define ROOT_Math_GenVector_LorentzVector 1
58 template<
class CoordSystem >
65 typedef typename CoordSystem::Scalar
Scalar;
92 template<
class Coords >
100 template<
class ForeignLorentzVector,
101 typename =
decltype(std::declval<ForeignLorentzVector>().x()
102 + std::declval<ForeignLorentzVector>().y()
103 + std::declval<ForeignLorentzVector>().z()
104 + std::declval<ForeignLorentzVector>().t())>
117 template<
class LAVector >
118 explicit constexpr LorentzVector(
const LAVector &
v,
size_t index0 ) {
119 fCoordinates = CoordSystem (
v[index0],
v[index0+1],
v[index0+2],
v[index0+3] );
129 template<
class OtherCoords >
139 template<
class ForeignLorentzVector,
140 typename =
decltype(std::declval<ForeignLorentzVector>().x()
141 + std::declval<ForeignLorentzVector>().y()
142 + std::declval<ForeignLorentzVector>().z()
143 + std::declval<ForeignLorentzVector>().t())>
158 template<
class LAVector >
159 LorentzVector & AssignFrom(
const LAVector &
v,
size_t index0=0 ) {
195 IT
a = begin; IT
b = ++begin; IT
c = ++begin; IT
d = ++begin;
197 assert (++begin==end);
219 { IT
a = begin; IT
b = ++begin; IT
c = ++begin; IT
d = ++begin;
221 assert (++begin==end);
372 return ::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> >(
X(),
Y(),
Z() );
386 template<
class OtherLorentzVector >
388 return t()*
q.t() -
x()*
q.x() -
y()*
q.y() -
z()*
q.z();
397 template<
class OtherLorentzVector >
410 template<
class OtherLorentzVector >
423 template<
class OtherLorentzVector>
438 template<
class OtherLorentzVector>
510 return Scalar(0.5) * log((ee + ppz) / (ee - ppz));
522 return Scalar(0.5) * log((ee + pp) / (ee - pp));
536 = 100*std::numeric_limits<Scalar>::epsilon() )
const {
538 if ( ee==0 )
return pp==0;
539 return delta*delta < tolerance * ee*ee;
576 template <
class Other4Vector>
581 if (vecSum.
Mag2() == 0) {
605 GenVector::Throw (
"LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
610 GenVector::Throw (
"LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless" );
624 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
629 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
632 else if ( t2 ==
v2 ) {
633 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
686 static constexpr unsigned int fDimension = CoordinateType::Dimension;
700 template<
class CoordSystem >
711 template<
class char_t,
class traits_t,
class Coords >
713 std::basic_ostream<char_t,traits_t> &
714 operator << ( std::basic_ostream<char_t,traits_t> & os
715 , LorentzVector<Coords>
const &
v
720 typename Coords::Scalar
a,
b,
c,
d;
721 v.GetCoordinates(
a,
b,
c,
d);
740 template<
class char_t,
class traits_t,
class Coords >
742 std::basic_istream<char_t,traits_t> &
749 typename Coords::Scalar
a,
b,
c,
d;
764 v.SetCoordinates(
a,
b,
c,
d);
778template<
typename CoordSystem>
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 displacement vector in 3 dimensions.
Scalar Mag2() const
Magnitute squared ( r^2 in spherical coordinate)
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
Scalar Et() const
return the transverse energy
LorentzVector< CoordSystem > & SetPz(Scalar a)
void GetCoordinates(Scalar dest[]) const
get internal data into an array of 4 Scalar numbers
BetaVector BoostToCM() const
The beta vector for the boost that would bring this vector into its center of mass frame (zero moment...
bool operator==(const LorentzVector &rhs) const
Exact equality.
Scalar M() const
return magnitude (mass) using the (-,-,-,+) metric.
LorentzVector< CoordSystem > & SetPy(Scalar a)
Scalar Pt() const
return the transverse spatial component sqrt ( X**2 + Y**2 )
Scalar Mt2() const
return the transverse mass squared
Scalar Rapidity() const
Rapidity relative to the Z axis: .5 log [(E+Pz)/(E-Pz)].
Scalar Beta() const
Return beta scalar value.
LorentzVector< CoordSystem > & SetPx(Scalar a)
Scalar Perp2() const
return the square of the transverse spatial component ( X**2 + Y**2 )
void GetCoordinates(IT begin) const
get internal data into 4 Scalars at *begin
LorentzVector< CoordSystem > operator/(const Scalar &a) const
Divide a LorentzVector by a scalar quantity.
LorentzVector< CoordSystem > & SetPxPyPzE(Scalar xx, Scalar yy, Scalar zz, Scalar ee)
LorentzVector & operator+=(const OtherLorentzVector &q)
Self addition with another Vector ( v+= q ) Enable the addition with any other LorentzVector.
Scalar Eta() const
pseudorapidity
constexpr LorentzVector(const LorentzVector< Coords > &v)
constructor from a LorentzVector expressed in different coordinates, or using a different Scalar type
Scalar Py() const
spatial Y component
constexpr LorentzVector(const ForeignLorentzVector &v)
Construct from a foreign 4D vector type, for example, HepLorentzVector Precondition: v must implement...
LorentzVector(const Scalar &a, const Scalar &b, const Scalar &c, const Scalar &d)
generic constructors from four scalar values.
bool isLightlike(Scalar tolerance=100 *std::numeric_limits< Scalar >::epsilon()) const
Determine if momentum-energy can represent a massless particle.
::ROOT::Math::DisplacementVector3D< Cartesian3D< Scalar > > Vect() const
get the spatial components of the Vector in a DisplacementVector based on Cartesian Coordinates
Scalar ColinearRapidity() const
Rapidity in the direction of travel: atanh (|P|/E)=.5 log[(E+P)/(E-P)].
Scalar Pz() const
spatial Z component
LorentzVector operator-() const
Negative of a LorentzVector (q = - v )
static constexpr unsigned int fDimension
LorentzVector< CoordSystem > & SetPt(Scalar a)
LorentzVector operator+() const
const CoordSystem & Coordinates() const
Retrieve a const reference to the coordinates object.
LorentzVector< CoordSystem > & SetEta(Scalar a)
LorentzVector operator*(const Scalar &a) const
product of a LorentzVector by a scalar quantity
Scalar Phi() const
azimuthal Angle
LorentzVector< CoordSystem > & SetCoordinates(const Scalar src[])
Set internal data based on an array of 4 Scalar numbers.
LorentzVector & operator/=(Scalar a)
division by a scalar quantity v /= a
LorentzVector & operator*=(Scalar a)
multiplication by a scalar quantity v *= a
Scalar M2() const
return magnitude (mass) squared M2 = T**2 - X**2 - Y**2 - Z**2 (we use -,-,-,+ metric)
CoordSystem CoordinateType
Scalar Dot(const OtherLorentzVector &q) const
scalar (Dot) product of two LorentzVector vectors (metric is -,-,-,+) Enable the product using any ot...
void GetCoordinates(Scalar &a, Scalar &b, Scalar &c, Scalar &d) const
get internal data into 4 Scalar numbers
Scalar Gamma() const
Return Gamma scalar value.
bool isSpacelike() const
Determine if momentum-energy is spacelike, and represents a tachyon.
Scalar R() const
return the spatial (3D) magnitude ( sqrt(X**2 + Y**2 + Z**2) )
CoordSystem::Scalar Scalar
Scalar P2() const
return the square of the spatial (3D) magnitude ( X**2 + Y**2 + Z**2 )
Scalar Et2() const
return the transverse energy squared
LorentzVector()
default constructor of an empty vector (Px = Py = Pz = E = 0 )
bool isTimelike() const
Determine if momentum-energy can represent a physical massive particle.
LorentzVector & operator-=(const OtherLorentzVector &q)
Self subtraction of another Vector from this ( v-= q ) Enable the addition with any other LorentzVect...
Scalar Px() const
spatial X component
Scalar Mt() const
return the transverse mass
unsigned int Dimension() const
dimension
LorentzVector< CoordSystem > & SetM(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...
LorentzVector< CoordSystem > & SetCoordinates(IT begin, IT end)
Set internal data based on 4 Scalars at *begin to *end.
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...
DisplacementVector3D< Cartesian3D< Scalar > > BetaVector
bool operator!=(const LorentzVector &rhs) const
void GetCoordinates(IT begin, IT end) const
get internal data into 4 Scalars at *begin to *end
Scalar Theta() const
polar Angle
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< OtherCoords > &v)
Assignment operator from a lorentz vector of arbitrary type.
LorentzVector< CoordSystem > & SetCoordinates(Scalar a, Scalar b, Scalar c, Scalar d)
Set internal data based on 4 Scalar numbers.
LorentzVector< CoordSystem > & SetPhi(Scalar a)
Class describing a 4D cartesian coordinate system (x, y, z, t coordinates) or momentum-energy vectors...
Namespace for new Math classes and functions.
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
char_t get_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m)
std::basic_istream< char_t, traits_t > & require_delim(std::basic_istream< char_t, traits_t > &is, manip_t m)
void set_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m, char_t ch)
std::basic_istream< char_t, traits_t > & operator>>(std::basic_istream< char_t, traits_t > &is, DisplacementVector2D< T, U > &v)
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...