1 #ifndef RIVET_MATH_LORENTZTRANS 2 #define RIVET_MATH_LORENTZTRANS 4 #include "Rivet/Math/MathConstants.hh" 5 #include "Rivet/Math/MathUtils.hh" 6 #include "Rivet/Math/MatrixN.hh" 7 #include "Rivet/Math/Matrix3.hh" 8 #include "Rivet/Math/Vector4.hh" 29 return 1.0 / sqrt(1 -
sqr(beta));
34 return sqrt(1 -
sqr(1/gamma));
50 _boostMatrix = boostMatrix;
99 if (
isZero(beta))
return *
this;
102 const bool alongxyz = (int(vec.x() == 0) +
int(vec.y() == 0) +
int(vec.z() == 0) == 2);
103 const int i = (!alongxyz || vec.x() != 0) ? 1 : (vec.y() != 0) ? 2 : 3;
104 const int isign = !alongxyz ? 1 :
sign(vec[i-1]);
106 _boostMatrix.set(0, 0, gamma);
107 _boostMatrix.set(i, i, gamma);
108 _boostMatrix.set(0, i, +isign*beta*gamma);
109 _boostMatrix.set(i, 0, +isign*beta*gamma);
111 if (!alongxyz) _boostMatrix =
rotate(Vector3::mkX(), vec)._boostMatrix;
120 const double beta = vbeta.
mod();
129 if (boost.isZero())
return Vector3();
130 assert(boost.E() > 0);
131 const double beta = boost.p3().
mod() / boost.E();
132 return boost.p3().unit() *
beta;
146 const double gamma = vgamma.
mod();
154 if (boost.isZero())
return Vector3();
155 assert(boost.E() > 0);
156 const double beta = boost.p3().
mod() / boost.E();
157 return boost.p3().unit() *
beta;
170 return multiply(_boostMatrix, v4);
175 return multiply(_boostMatrix, v4);
205 const Matrix4 rot4 = _mkMatrix4(rot);
207 lt._boostMatrix = newlt;
214 rtn._boostMatrix = _boostMatrix.
inverse();
221 rtn._boostMatrix = _boostMatrix * lt._boostMatrix;
232 _boostMatrix = multiply(_mkMatrix4(m3),_boostMatrix);
238 _boostMatrix *= _mkMatrix4(m3);
254 Matrix4 m4 = Matrix4::mkIdentity();
255 for (
size_t i = 0; i < 3; ++i) {
256 for (
size_t j = 0; j < 3; ++j) {
257 m4.set(i+1, j+1, m3.get(i, j));
Definition: MC_Cent_pPb.hh:10
Vector3 betaVec() const
Definition: Vector4.hh:671
bool isZero(double tolerance=1E-5) const
Check for nullness, allowing for numerical precision.
Definition: VectorN.hh:75
double mod2() const
Calculate the modulus-squared of a vector. .
Definition: VectorN.hh:84
Matrix< N > inverse() const
Calculate inverse.
Definition: MatrixN.hh:130
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:294
General -dimensional mathematical matrix object.
Definition: MatrixN.hh:14
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition: Vector4.hh:22
Vector3 unit() const
Synonym for unitVec.
Definition: Vector3.hh:105
std::string toString(const AnalysisInfo &ai)
String representation.
std::enable_if< std::is_floating_point< NUM >::value, bool >::type isZero(NUM val, double tolerance=1e-8)
Compare a number to zero.
Definition: MathUtils.hh:21
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:348
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:301
std::enable_if< std::is_arithmetic< NUM >::value, NUM >::type sqr(NUM a)
Named number-type squaring operation.
Definition: MathUtils.hh:198
double mod() const
Calculate the modulus of a vector. .
Definition: VectorN.hh:95
std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition: MathUtils.hh:245