1 #ifndef RIVET_MATH_LORENTZTRANS 2 #define RIVET_MATH_LORENTZTRANS 6 #include "Rivet/Math/MathHeader.hh" 7 #include "Rivet/Math/MathUtils.hh" 8 #include "Rivet/Math/MatrixN.hh" 9 #include "Rivet/Math/Matrix3.hh" 10 #include "Rivet/Math/Vector4.hh" 15 inline double lorentzGamma(
const double beta) {
16 return 1.0 / sqrt(1 - beta*beta);
33 LorentzTransform(
const double betaX,
const double betaY,
const double betaZ) {
34 setBoost(betaX, betaY, betaZ);
38 assert(boost.
mod2() < 1);
39 const double beta = boost.
mod();
40 const double gamma = lorentzGamma(beta);
42 _boostMatrix.set(0, 0, gamma);
43 _boostMatrix.set(1, 1, gamma);
45 _boostMatrix.set(0, 1, +beta*gamma);
46 _boostMatrix.set(1, 0, +beta*gamma);
47 _boostMatrix = rotate(Vector3::mkX(), boost)._boostMatrix;
56 LorentzTransform& setBoost(
const double betaX,
const double betaY,
const double betaZ) {
57 return setBoost(
Vector3(betaX, betaY, betaZ));
63 if (boost.
isZero())
return boost;
64 assert(boost.E() > 0);
65 const double beta = boost.p().
mod() / boost.E();
66 return boost.p().
unit() * beta;
73 double gamma()
const {
74 return lorentzGamma(beta());
78 return rotate(
Matrix3(from, to));
82 return rotate(
Matrix3(axis, angle));
87 const Matrix4 rot4 = mkMatrix4(rot);
89 lt._boostMatrix = newlt;
94 return multiply(_boostMatrix, v4);
99 rtn._boostMatrix = _boostMatrix.inverse();
107 rtn._boostMatrix = _boostMatrix * lt._boostMatrix;
121 _boostMatrix = multiply(mkMatrix4(m3),_boostMatrix);
126 _boostMatrix *= mkMatrix4(m3);
132 Matrix4 m4 = Matrix4::mkIdentity();
133 for (
size_t i = 0; i < 3; ++i) {
134 for (
size_t j = 0; j < 3; ++j) {
135 m4.set(i+1, j+1, m3.get(i, j));
158 return lt.transform(v4);
166 return toString(lt._boostMatrix);
Definition: MC_JetAnalysis.hh:9
bool isZero(double tolerance=1E-5) const
Check for nullness, allowing for numerical precision.
Definition: VectorN.hh:67
double mod2() const
Calculate the modulus-squared of a vector. .
Definition: VectorN.hh:76
Matrix< N > inverse() const
Calculate inverse.
Definition: MatrixN.hh:134
Specialisation of MatrixN to aid 3 dimensional rotations.
Definition: Matrix3.hh:13
double angle(const Vector3 &a, const Vector3 &b)
Angle (in radians) between two 3-vectors.
Definition: Vector3.hh:244
General -dimensional mathematical matrix object.
Definition: MatrixN.hh:14
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition: Vector4.hh:20
Vector3 unit() const
Definition: Vector3.hh:88
Three-dimensional specialisation of Vector.
Definition: Vector3.hh:26
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition: AnalysisInfo.hh:239
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:324
double mod() const
Calculate the modulus of a vector. .
Definition: VectorN.hh:87