#include "Math/GenVector/BoostZ.h"
#include "Math/GenVector/LorentzVector.h"
#include "Math/GenVector/PxPyPzE4D.h"
#include "Math/GenVector/DisplacementVector3D.h"
#include "Math/GenVector/Cartesian3D.h"
#include "Math/GenVector/GenVector_exception.h"
#include <cmath>
#include <algorithm>
namespace ROOT {
namespace Math {
BoostZ::BoostZ() : fBeta(0.0), fGamma(1.0) {}
void BoostZ::SetComponents (Scalar bz) {
Scalar bp2 = bz*bz;
if (bp2 >= 1) {
GenVector_exception e (
"Beta Vector supplied to set BoostZ represents speed >= c");
Throw(e);
return;
}
fBeta = bz;
fGamma = 1.0 / std::sqrt(1.0 - bp2);
}
void BoostZ::GetComponents (Scalar& bz) const {
bz = fBeta;
}
DisplacementVector3D< Cartesian3D<BoostZ::Scalar> >
BoostZ::BetaVector() const {
return DisplacementVector3D< Cartesian3D<Scalar> >
( 0.0, 0.0, fBeta );
}
void BoostZ::GetLorentzRotation (Scalar r[]) const {
r[kLXX] = 1.0; r[kLXY] = 0.0; r[kLXZ] = 0.0; r[kLXT] = 0.0 ;
r[kLYX] = 0.0; r[kLYY] = 1.0; r[kLYZ] = 0.0; r[kLYT] = 0.0 ;
r[kLZX] = 0.0; r[kLZY] = 0.0; r[kLZZ] = fGamma; r[kLZT] = fGamma*fBeta;
r[kLTX] = 0.0; r[kLTY] = 0.0; r[kLTZ] = fGamma*fBeta; r[kLTT] = fGamma;
}
void BoostZ::Rectify() {
if (fGamma <= 0) {
GenVector_exception e (
"Attempt to rectify a boost with non-positive gamma");
Throw(e);
return;
}
Scalar beta = fBeta;
if ( beta >= 1 ) {
beta /= ( beta * ( 1.0 + 1.0e-16 ) );
}
SetComponents ( beta );
}
LorentzVector< PxPyPzE4D<double> >
BoostZ::operator() (const LorentzVector< PxPyPzE4D<double> > & v) const {
Scalar z = v.Pz();
Scalar t = v.E();
return LorentzVector< PxPyPzE4D<double> >
( v.Px()
, v.Py()
, fGamma*z + fGamma*fBeta*t
, fGamma*fBeta*z + fGamma*t );
}
void BoostZ::Invert() {
fBeta = -fBeta;
}
BoostZ BoostZ::Inverse() const {
BoostZ tmp(*this);
tmp.Invert();
return tmp;
}
std::ostream & operator<< (std::ostream & os, const BoostZ & b) {
os << " BoostZ( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) ";
return os;
}
}
}
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.