18 #ifndef ROOT_Math_GenVector_LorentzVector 19 #define ROOT_Math_GenVector_LorentzVector 1 47 template<
class CoordSystem >
81 template<
class Coords >
89 template<
class ForeignLorentzVector>
102 template<
class LAVector >
104 fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2], v[index0+3] );
114 template<
class OtherCoords >
124 template<
class ForeignLorentzVector>
126 SetXYZT( v.x(), v.y(), v.z(), v.t() );
139 template<
class LAVector >
140 LorentzVector & AssignFrom(
const LAVector & v,
size_t index0=0 ) {
141 fCoordinates.SetCoordinates( v[index0], v[index0+1], v[index0+2], v[index0+3] );
185 IT
a = begin; IT
b = ++begin; IT c = ++begin; IT d = ++begin;
186 assert (++begin==end);
212 { IT
a = begin; IT
b = ++begin; IT c = ++begin; IT d = ++begin;
213 assert (++begin==end);
299 Scalar
P2()
const {
return P() *
P(); }
356 return ::ROOT::Math::DisplacementVector3D<Cartesian3D<Scalar> >(
X(),
Y(),
Z() );
370 template<
class OtherLorentzVector >
371 Scalar
Dot(
const OtherLorentzVector &
q)
const {
372 return t()*q.t() -
x()*q.x() -
y()*q.y() -
z()*q.z();
381 template<
class OtherLorentzVector >
384 SetXYZT(
x() + q.x(),
y() + q.y(),
z() + q.z(),
t() + q.t() );
394 template<
class OtherLorentzVector >
396 SetXYZT(
x() - q.x(),
y() - q.y(),
z() - q.z(),
t() - q.t() );
407 template<
class OtherLorentzVector>
422 template<
class OtherLorentzVector>
491 const Scalar ee =
E();
492 const Scalar ppz =
Pz();
493 return Scalar(0.5) *
log((ee + ppz) / (ee - ppz));
502 const Scalar ee =
E();
503 const Scalar pp =
P();
504 return Scalar(0.5) *
log((ee + pp) / (ee - pp));
511 Scalar ee =
E(); Scalar pp =
P();
return ee*ee > pp*pp;
519 Scalar ee =
E(); Scalar pp =
P(); Scalar delta = ee-pp;
520 if ( ee==0 )
return pp==0;
521 return delta*delta < tolerance * ee*ee;
528 Scalar ee =
E(); Scalar pp =
P();
return ee*ee < pp*pp;
558 template <
class Other4Vector>
560 Scalar eSum =
E() + v.E();
563 if (vecSum.
Mag2() == 0) {
587 GenVector::Throw (
"LorentzVector::Beta() - beta computed for LorentzVector with t = 0. Return an Infinite result");
592 GenVector::Throw (
"LorentzVector::Beta() - beta computed for non-timelike LorentzVector . Result is physically meaningless" );
600 const Scalar v2 =
P2();
601 const Scalar t2 =
pow(
E(), 2);
606 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for LorentzVector with t = 0. Return a zero result");
611 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for a spacelike LorentzVector. Imaginary result");
614 else if ( t2 == v2 ) {
615 GenVector::Throw (
"LorentzVector::Gamma() - gamma computed for a lightlike LorentzVector. Infinite result");
681 template<
class CoordSystem >
692 template<
class char_t,
class traits_t,
class Coords >
694 std::basic_ostream<char_t,traits_t> &
695 operator << ( std::basic_ostream<char_t,traits_t> & os
702 v.GetCoordinates(a, b, c, d);
721 template<
class char_t,
class traits_t,
class Coords >
723 std::basic_istream<char_t,traits_t> &
Scalar Mt2() const
return the transverse mass squared
BetaVector BoostToCM() const
The beta vector for the boost that would bring this vector into its center of mass frame (zero moment...
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Scalar Et2() const
return the transverse energy squared
LorentzVector< CoordSystem > & SetPz(Scalar a)
Scalar Px() const
spatial X component
Namespace for new ROOT classes and functions.
const CoordSystem & Coordinates() const
Retrieve a const reference to the coordinates object.
CoordSystem CoordinateType
LorentzVector< CoordSystem > & SetPxPyPzE(Scalar xx, Scalar yy, Scalar zz, Scalar ee)
void GetCoordinates(Scalar dest[]) const
get internal data into an array of 4 Scalar numbers
LorentzVector operator-() const
Negative of a LorentzVector (q = - v )
Scalar Eta() const
pseudorapidity
LorentzVector(const LorentzVector< Coords > &v)
constructor from a LorentzVector expressed in different coordinates, or using a different Scalar type...
void GetCoordinates(IT begin, IT end) const
get internal data into 4 Scalars at *begin to *end
LorentzVector & operator-=(const OtherLorentzVector &q)
Self subtraction of another Vector from this ( v-= q ) Enable the addition with any other LorentzVect...
Scalar Dot(const OtherLorentzVector &q) const
scalar (Dot) product of two LorentzVector vectors (metric is -,-,-,+) Enable the product using any ot...
std::basic_istream< char_t, traits_t > & operator>>(std::basic_istream< char_t, traits_t > &is, DisplacementVector2D< T, U > &v)
LorentzVector< CoordSystem > & SetCoordinates(const Scalar src[])
Set internal data based on an array of 4 Scalar numbers.
LorentzVector< CoordSystem > & SetCoordinates(Scalar a, Scalar b, Scalar c, Scalar d)
Set internal data based on 4 Scalar numbers.
LorentzVector< CoordSystem > & SetM(Scalar a)
LorentzVector< CoordSystem > & SetPy(Scalar a)
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...
Scalar Theta() const
polar Angle
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
DisplacementVector3D< Cartesian3D< Scalar > > BetaVector
CoordSystem::Scalar Scalar
LorentzVector(const Scalar &a, const Scalar &b, const Scalar &c, const Scalar &d)
generic constructors from four scalar values.
Class describing a 4D cartesian coordinate system (x, y, z, t coordinates) or momentum-energy vectors...
LorentzVector & operator+=(const OtherLorentzVector &q)
Self addition with another Vector ( v+= q ) Enable the addition with any other LorentzVector.
double pow(double, double)
LorentzVector()
default constructor of an empty vector (Px = Py = Pz = E = 0 )
LorentzVector< CoordSystem > & SetPhi(Scalar a)
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
LorentzVector< CoordSystem > & SetCoordinates(IT begin, IT end)
Set internal data based on 4 Scalars at *begin to *end.
char_t get_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m)
bool operator!=(const LorentzVector &rhs) const
bool isTimelike() const
Determine if momentum-energy can represent a physical massive particle.
Class describing a generic displacement vector in 3 dimensions.
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed ...
LorentzVector< CoordSystem > & SetPt(Scalar a)
void GetCoordinates(IT begin) const
get internal data into 4 Scalars at *begin
LorentzVector & operator=(const LorentzVector< OtherCoords > &v)
Assignment operator from a lorentz vector of arbitrary type.
LorentzVector< CoordSystem > & SetE(Scalar a)
Methods setting a Single-component Work only if the component is one of which the vector is represent...
Scalar Et() const
return the transverse energy
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...
Scalar Py() const
spatial Y component
LorentzVector< CoordSystem > & SetEta(Scalar a)
bool operator==(const LorentzVector &rhs) const
Exact equality.
void GetCoordinates(Scalar &a, Scalar &b, Scalar &c, Scalar &d) const
get internal data into 4 Scalar numbers
Scalar Phi() const
azimuthal Angle
Scalar Gamma() const
Return Gamma scalar value.
LorentzVector< CoordSystem > operator/(const Scalar &a) const
Divide a LorentzVector by a scalar quantity.
Scalar M() const
return magnitude (mass) using the (-,-,-,+) metric.
LorentzVector & operator*=(Scalar a)
multiplication by a scalar quantity v *= a
bool isLightlike(Scalar tolerance=100 *std::numeric_limits< Scalar >::epsilon()) const
Determine if momentum-energy can represent a massless particle.
Scalar Beta() const
Return beta scalar value.
void set_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m, char_t ch)
Scalar Rapidity() const
Rapidity relative to the Z axis: .5 log [(E+Pz)/(E-Pz)].
Namespace for new Math classes and functions.
Scalar Perp2() const
return the square of the transverse spatial component ( X**2 + Y**2 )
Scalar R() const
return the spatial (3D) magnitude ( sqrt(X**2 + Y**2 + Z**2) )
Scalar P2() const
return the square of the spatial (3D) magnitude ( X**2 + Y**2 + Z**2 )
std::basic_istream< char_t, traits_t > & require_delim(std::basic_istream< char_t, traits_t > &is, manip_t m)
#define dest(otri, vertexptr)
LorentzVector operator*(const Scalar &a) const
product of a LorentzVector by a scalar quantity
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Scalar M2() const
return magnitude (mass) squared M2 = T**2 - X**2 - Y**2 - Z**2 (we use -,-,-,+ metric) ...
Scalar ColinearRapidity() const
Rapidity in the direction of travel: atanh (|P|/E)=.5 log[(E+P)/(E-P)].
Scalar Mag2() const
Magnitute squared ( r^2 in spherical coordinate)
Scalar Pz() const
spatial Z component
LorentzVector(const ForeignLorentzVector &v)
Construct from a foreign 4D vector type, for example, HepLorentzVector Precondition: v must implement...
Scalar Mt() const
return the transverse mass
LorentzVector< CoordSystem > & SetPx(Scalar a)
bool isSpacelike() const
Determine if momentum-energy is spacelike, and represents a tachyon.
LorentzVector & operator/=(Scalar a)
division by a scalar quantity v /= a
Rotation3D::Scalar Scalar
Scalar Pt() const
return the transverse spatial component sqrt ( X**2 + Y**2 )
::ROOT::Math::DisplacementVector3D< Cartesian3D< Scalar > > Vect() const
get the spatial components of the Vector in a DisplacementVector based on Cartesian Coordinates ...
LorentzVector operator+() const