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));
50 _boostMatrix = boostMatrix;
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();
130 assert(boost.
E() > 0);
131 const double beta = boost.
p3().
mod() / boost.
E();
155 assert(boost.
E() > 0);
156 const double beta = boost.
p3().
mod() / boost.
E();
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));
263 Matrix4 _boostMatrix;
269 inline LorentzTransform inverse(
const LorentzTransform& lt) {
273 inline LorentzTransform combine(
const LorentzTransform& a,
const LorentzTransform& b) {
277 inline FourVector transform(
const LorentzTransform& lt,
const FourVector& v4) {
278 return lt.transform(v4);
285 inline string toString(
const LorentzTransform& lt) {
289 inline std::ostream&
operator<<(std::ostream& out,
const LorentzTransform& lt) {
Specialized version of the FourVector with momentum/energy functionality.
Definition: Vector4.hh:306
Specialisation of VectorN to a general (non-momentum) Lorentz 4-vector.
Definition: Vector4.hh:27
Specialisation of MatrixN to aid 3 dimensional rotations.
Definition: Matrix3.hh:13
General -dimensional mathematical matrix object.
Definition: MatrixN.hh:30
Matrix< N > inverse() const
Calculate inverse.
Definition: MatrixN.hh:130
Three-dimensional specialisation of Vector.
Definition: Vector3.hh:40
Vector3 unit() const
Synonym for unitVec.
Definition: Vector3.hh:124
double mod() const
Calculate the modulus of a vector. .
Definition: VectorN.hh:95
double mod2() const
Calculate the modulus-squared of a vector. .
Definition: VectorN.hh:84
bool isZero(double tolerance=1E-5) const
Check for nullness, allowing for numerical precision.
Definition: VectorN.hh:75
Vector3 p3() const
Get 3-momentum part, .
Definition: Vector4.hh:583
Vector3 betaVec() const
Definition: Vector4.hh:676
double E() const
Get energy (time component of momentum).
Definition: Vector4.hh:543
FourMomentum p4(const ParticleBase &p)
Unbound function access to momentum.
Definition: ParticleBaseUtils.hh:644
Definition: MC_Cent_pPb.hh:10
std::ostream & operator<<(std::ostream &os, const AnalysisInfo &ai)
Stream an AnalysisInfo as a text description.
Definition: AnalysisInfo.hh:362
std::enable_if< std::is_arithmetic< NUM >::value, int >::type sign(NUM val)
Find the sign of a number.
Definition: MathUtils.hh:266
std::string toString(const AnalysisInfo &ai)
String representation.
std::enable_if< std::is_arithmetic< NUM >::value, NUM >::type sqr(NUM a)
Named number-type squaring operation.
Definition: MathUtils.hh:219
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:24
double angle(const Vector2 &a, const Vector2 &b)
Angle (in radians) between two 2-vectors.
Definition: Vector2.hh:177