 ROOT   Reference Guide BoostZ.cxx
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: M. Fischler 2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2005 , LCG ROOT FNAL MathLib Team *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class BoostZ, a 4x4 symmetric matrix representation of
12// an axial Lorentz transformation
13//
14// Created by: Mark Fischler Mon Nov 1 2005
15//
22
23#include <cmath>
24#include <algorithm>
25
26namespace ROOT {
27
28namespace Math {
29
30BoostZ::BoostZ() : fBeta(0.0), fGamma(1.0) {}
31
33 // set component
34 Scalar bp2 = bz*bz;
35 if (bp2 >= 1) {
37 "Beta Vector supplied to set BoostZ represents speed >= c");
38 return;
39 }
40 fBeta = bz;
41 fGamma = 1.0 / std::sqrt(1.0 - bp2);
42}
43
44void BoostZ::GetComponents (Scalar& bz) const {
45 // get component
46 bz = fBeta;
47}
48
51 // return beta vector
53 ( 0.0, 0.0, fBeta );
54}
55
57 // get corresponding LorentzRotation
58 r[kLXX] = 1.0; r[kLXY] = 0.0; r[kLXZ] = 0.0; r[kLXT] = 0.0 ;
59 r[kLYX] = 0.0; r[kLYY] = 1.0; r[kLYZ] = 0.0; r[kLYT] = 0.0 ;
60 r[kLZX] = 0.0; r[kLZY] = 0.0; r[kLZZ] = fGamma; r[kLZT] = fGamma*fBeta;
61 r[kLTX] = 0.0; r[kLTY] = 0.0; r[kLTZ] = fGamma*fBeta; r[kLTT] = fGamma;
62}
63
65 // Assuming the representation of this is close to a true Lorentz Rotation,
66 // but may have drifted due to round-off error from many operations,
67 // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation
68 // again.
69
70 if (fGamma <= 0) {
72 "Attempt to rectify a boost with non-positive gamma");
73 return;
74 }
76 if ( beta >= 1 ) {
77 beta /= ( beta * ( 1.0 + 1.0e-16 ) );
78 }
80}
81
84 // apply boost to a LV
85 Scalar z = v.Pz();
86 Scalar t = v.E();
88 ( v.Px()
89 , v.Py()
90 , fGamma*z + fGamma*fBeta*t
91 , fGamma*fBeta*z + fGamma*t );
92}
93
95 // invert
96 fBeta = -fBeta;
97}
98
100 // return an inverse boostZ
101 BoostZ tmp(*this);
102 tmp.Invert();
103 return tmp;
104}
105
106// ========== I/O =====================
107
108std::ostream & operator<< (std::ostream & os, const BoostZ & b) {
109 os << " BoostZ( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) ";
110 return os;
111}
112
113} //namespace Math
114} //namespace ROOT
ROOT::R::TRInterface & r
Definition: Object.C:4
#define b(i)
Definition: RSha256.hxx:100
Class representing a Lorentz Boost along the Z axis, by beta.
Definition: BoostZ.h:39
void GetLorentzRotation(Scalar r[]) const
Get elements of internal 4x4 symmetric representation, into a data array suitable for direct use as t...
Definition: BoostZ.cxx:56
void Invert()
Invert a BoostZ in place.
Definition: BoostZ.cxx:94
XYZVector BetaVector() const
Definition: BoostZ.cxx:50
double Scalar
Definition: BoostZ.h:43
void SetComponents(Scalar beta_z)
Set components from a Scalar beta_z.
Definition: BoostZ.cxx:32
void Rectify()
Re-adjust components to eliminate small deviations from a perfect orthosyplectic matrix.
Definition: BoostZ.cxx:64
void GetComponents(Scalar &beta_z) const
Get components into a Scalar beta_z.
Definition: BoostZ.cxx:44
LorentzVector< ROOT::Math::PxPyPzE4D< double > > operator()(const LorentzVector< ROOT::Math::PxPyPzE4D< double > > &v) const
Lorentz transformation operation on a Minkowski ('Cartesian') LorentzVector.
Definition: BoostZ.cxx:83
BoostZ Inverse() const
Return inverse of a BoostZ.
Definition: BoostZ.cxx:99
BoostZ()
Default constructor (identity transformation)
Definition: BoostZ.cxx:30
Class describing a generic displacement vector in 3 dimensions.
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Definition: LorentzVector.h:59
Class describing a 4D cartesian coordinate system (x, y, z, t coordinates) or momentum-energy vectors...
Definition: PxPyPzE4D.h:44
double beta(double x, double y)
Calculates the beta function.
Namespace for new Math classes and functions.
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Definition: AxisAngle.cxx:91
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.