 ROOT   Reference Guide Boost.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 Boost, a 4x4 symmetric matrix representation of
12 // an axial Lorentz transformation
13 //
14 // Created by: Mark Fischler Mon Nov 1 2005
15 //
16 #include "Math/GenVector/Boost.h"
22
23 #include <cmath>
24 #include <algorithm>
25
26 //#ifdef TEX
27 /**
28
29  A variable names bgamma appears in several places in this file. A few
30  words of elaboration are needed to make its meaning clear. On page 69
31  of Misner, Thorne and Wheeler, (Exercise 2.7) the elements of the matrix
32  for a general Lorentz boost are given as
33
34  \f[ \Lambda^{j'}_k = \Lambda^{k'}_j
35  = (\gamma - 1) n^j n^k + \delta^{jk} \f]
36
37  where the n^i are unit vectors in the direction of the three spatial
38  axes. Using the definitions, \f$n^i = \beta_i/\beta \f$ , then, for example,
39
40  \f[ \Lambda_{xy} = (\gamma - 1) n_x n_y
41  = (\gamma - 1) \beta_x \beta_y/\beta^2 \f]
42
43  By definition, \f[ \gamma^2 = 1/(1 - \beta^2) \f]
44
45  so that \f[ \gamma^2 \beta^2 = \gamma^2 - 1 \f]
46
47  or \f[ \beta^2 = (\gamma^2 - 1)/\gamma^2 \f]
48
49  If we insert this into the expression for \f$\Lambda_{xy} \f$, we get
50
51  \f[ \Lambda_{xy} = (\gamma - 1) \gamma^2/(\gamma^2 - 1) \beta_x \beta_y \f]
52
53  or, finally
54
55  \f[ \Lambda_{xy} = \gamma^2/(\gamma+1) \beta_x \beta_y \f]
56
57  The expression \f$\gamma^2/(\gamma+1) \f$ is what we call <em>bgamma</em> in the code below.
58
59  \class ROOT::Math::Boost
60 */
61 //#endif
62
63 namespace ROOT {
64
65 namespace Math {
66
68  // set identity boost
69  fM[kXX] = 1.0; fM[kXY] = 0.0; fM[kXZ] = 0.0; fM[kXT] = 0.0;
70  fM[kYY] = 1.0; fM[kYZ] = 0.0; fM[kYT] = 0.0;
71  fM[kZZ] = 1.0; fM[kZT] = 0.0;
72  fM[kTT] = 1.0;
73 }
74
75
77  // set the boost beta as 3 components
78  Scalar bp2 = bx*bx + by*by + bz*bz;
79  if (bp2 >= 1) {
81  "Beta Vector supplied to set Boost represents speed >= c");
82  // SetIdentity();
83  return;
84  }
85  Scalar gamma = 1.0 / std::sqrt(1.0 - bp2);
86  Scalar bgamma = gamma * gamma / (1.0 + gamma);
87  fM[kXX] = 1.0 + bgamma * bx * bx;
88  fM[kYY] = 1.0 + bgamma * by * by;
89  fM[kZZ] = 1.0 + bgamma * bz * bz;
90  fM[kXY] = bgamma * bx * by;
91  fM[kXZ] = bgamma * bx * bz;
92  fM[kYZ] = bgamma * by * bz;
93  fM[kXT] = gamma * bx;
94  fM[kYT] = gamma * by;
95  fM[kZT] = gamma * bz;
96  fM[kTT] = gamma;
97 }
98
99 void Boost::GetComponents (Scalar& bx, Scalar& by, Scalar& bz) const {
100  // get beta of the boots as 3 components
101  Scalar gaminv = 1.0/fM[kTT];
102  bx = fM[kXT]*gaminv;
103  by = fM[kYT]*gaminv;
104  bz = fM[kZT]*gaminv;
105 }
106
109  // get boost beta vector
110  Scalar gaminv = 1.0/fM[kTT];
112  ( fM[kXT]*gaminv, fM[kYT]*gaminv, fM[kZT]*gaminv );
113 }
114
116  // get Lorentz rotation corresponding to this boost as an array of 16 values
117  r[kLXX] = fM[kXX]; r[kLXY] = fM[kXY]; r[kLXZ] = fM[kXZ]; r[kLXT] = fM[kXT];
118  r[kLYX] = fM[kXY]; r[kLYY] = fM[kYY]; r[kLYZ] = fM[kYZ]; r[kLYT] = fM[kYT];
119  r[kLZX] = fM[kXZ]; r[kLZY] = fM[kYZ]; r[kLZZ] = fM[kZZ]; r[kLZT] = fM[kZT];
120  r[kLTX] = fM[kXT]; r[kLTY] = fM[kYT]; r[kLTZ] = fM[kZT]; r[kLTT] = fM[kTT];
121 }
122
124  // Assuming the representation of this is close to a true Lorentz Rotation,
125  // but may have drifted due to round-off error from many operations,
126  // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation
127  // again.
128
129  if (fM[kTT] <= 0) {
131  "Attempt to rectify a boost with non-positive gamma");
132  return;
133  }
135  beta /= fM[kTT];
136  if ( beta.mag2() >= 1 ) {
137  beta /= ( beta.R() * ( 1.0 + 1.0e-16 ) );
138  }
139  SetComponents ( beta );
140 }
141
144  // apply bosost to a PxPyPzE LorentzVector
145  Scalar x = v.Px();
146  Scalar y = v.Py();
147  Scalar z = v.Pz();
148  Scalar t = v.E();
150  ( fM[kXX]*x + fM[kXY]*y + fM[kXZ]*z + fM[kXT]*t
151  , fM[kXY]*x + fM[kYY]*y + fM[kYZ]*z + fM[kYT]*t
152  , fM[kXZ]*x + fM[kYZ]*y + fM[kZZ]*z + fM[kZT]*t
153  , fM[kXT]*x + fM[kYT]*y + fM[kZT]*z + fM[kTT]*t );
154 }
155
157  // invert in place boost (modifying the object)
158  fM[kXT] = -fM[kXT];
159  fM[kYT] = -fM[kYT];
160  fM[kZT] = -fM[kZT];
161 }
162
164  // return inverse of boost
165  Boost tmp(*this);
166  tmp.Invert();
167  return tmp;
168 }
169
170
171 // ========== I/O =====================
172
173 std::ostream & operator<< (std::ostream & os, const Boost & b) {
174  // TODO - this will need changing for machine-readable issues
175  // and even the human readable form needs formatiing improvements
176  double m;
177  b.GetLorentzRotation(m);
178  os << "\n" << m << " " << m << " " << m << " " << m;
179  os << "\n" << "\t" << " " << m << " " << m << " " << m;
180  os << "\n" << "\t" << " " << "\t" << " " << m << " " << m;
181  os << "\n" << "\t" << " " << "\t" << " " << "\t" << " " << m << "\n";
182  return os;
183 }
184
185 } //namespace Math
186 } //namespace ROOT
ROOT::Math::Cephes::gamma
double gamma(double x)
Definition: SpecFuncCephes.cxx:339
m
auto * m
Definition: textangle.C:8
ROOT::Math::Boost::kLYT
@ kLYT
Definition: Boost.h:54
ROOT::Math::Boost::Invert
void Invert()
Invert a Boost in place.
Definition: Boost.cxx:156
ROOT::Math::Boost::kLTT
@ kLTT
Definition: Boost.h:56
ROOT::Math::Boost::Inverse
Boost Inverse() const
Return inverse of a boost.
Definition: Boost.cxx:163
ROOT::Math::Boost::kLZT
@ kLZT
Definition: Boost.h:55
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::Math::Boost::kXX
@ kXX
Definition: Boost.h:60
ROOT::Math::Boost::kLXT
@ kLXT
Definition: Boost.h:53
ROOT::Math::Boost::kLXY
@ kLXY
Definition: Boost.h:53
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Math::operator<<
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Definition: AxisAngle.cxx:91
ROOT::Math::Boost::kXT
@ kXT
Definition: Boost.h:60
ROOT::Math::Boost::kLXZ
@ kLXZ
Definition: Boost.h:53
ROOT::Math::Boost::kLTY
@ kLTY
Definition: Boost.h:56
ROOT::Math::Boost::SetComponents
void SetComponents(Scalar beta_x, Scalar beta_y, Scalar beta_z)
Set components from beta_x, beta_y, and beta_z.
Definition: Boost.cxx:76
ROOT::Math::Boost
Lorentz boost class with the (4D) transformation represented internally by a 4x4 orthosymplectic matr...
Definition: Boost.h:46
ROOT::Math::beta
double beta(double x, double y)
Calculates the beta function.
Definition: SpecFuncMathCore.cxx:111
v
@ v
Definition: rootcling_impl.cxx:3664
b
#define b(i)
Definition: RSha256.hxx:100
ROOT::Math::Boost::kLYY
@ kLYY
Definition: Boost.h:54
Cartesian3D.h
ROOT::Math::GenVector::Throw
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
Definition: GenVector_exception.h:80
Boost.h
ROOT::Math::Boost::kLYZ
@ kLYZ
Definition: Boost.h:54
ROOT::Math::Boost::kYT
@ kYT
Definition: Boost.h:61
ROOT::Math::Boost::kXY
@ kXY
Definition: Boost.h:60
ROOT::Math::Boost::kTT
@ kTT
Definition: Boost.h:63
ROOT::Math::Boost::kLZZ
@ kLZZ
Definition: Boost.h:55
ROOT::Math::Boost::kYY
@ kYY
Definition: Boost.h:61
y
Double_t y[n]
Definition: legend1.C:17
sqrt
double sqrt(double)
ROOT::Math::Boost::Scalar
double Scalar
Definition: Boost.h:50
ROOT::Math::Boost::kLTX
@ kLTX
Definition: Boost.h:56
PxPyPzE4D.h
ROOT::Math::Boost::kYZ
@ kYZ
Definition: Boost.h:61
DisplacementVector3D.h
ROOT::Math::Boost::GetComponents
void GetComponents(Scalar &beta_x, Scalar &beta_y, Scalar &beta_z) const
Get components into beta_x, beta_y, and beta_z.
Definition: Boost.cxx:99
GenVector_exception.h
ROOT::Math::Boost::operator()
LorentzVector< ROOT::Math::PxPyPzE4D< double > > operator()(const LorentzVector< ROOT::Math::PxPyPzE4D< double > > &v) const
Lorentz transformation operation on a Minkowski ('Cartesian') LorentzVector.
Definition: Boost.cxx:143
ROOT::Math::DisplacementVector3D
Class describing a generic displacement vector in 3 dimensions.
Definition: DisplacementVector3D.h:56
LorentzVector.h
ROOT::Math::Boost::kLZX
@ kLZX
Definition: Boost.h:55
ROOT::Math::Boost::kXZ
@ kXZ
Definition: Boost.h:60
ROOT::Math::Boost::kLXX
@ kLXX
Definition: Boost.h:53
ROOT::Math::Boost::SetIdentity
void SetIdentity()
Definition: Boost.cxx:67
ROOT::Math::Boost::Rectify
void Rectify()
Re-adjust components to eliminate small deviations from a perfect orthosyplectic matrix.
Definition: Boost.cxx:123
ROOT::Math::Boost::GetLorentzRotation
void GetLorentzRotation(Scalar r[]) const
Get elements of internal 4x4 symmetric representation, into a data array suitable for direct use as t...
Definition: Boost.cxx:115
ROOT::Math::Boost::kLZY
@ kLZY
Definition: Boost.h:55
ROOT::Math::Boost::kZZ
@ kZZ
Definition: Boost.h:62
ROOT::Math::Boost::kLYX
@ kLYX
Definition: Boost.h:54
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Math::Boost::kLTZ
@ kLTZ
Definition: Boost.h:56
ROOT::Math::Boost::BetaVector
XYZVector BetaVector() const
Definition: Boost.cxx:108
Math
Namespace for new Math classes and functions.
ROOT::Math::PxPyPzE4D
Class describing a 4D cartesian coordinate system (x, y, z, t coordinates) or momentum-energy vectors...
Definition: PxPyPzE4D.h:42
ROOT::Math::Boost::kZT
@ kZT
Definition: Boost.h:62
ROOT::Math::LorentzVector
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Definition: LorentzVector.h:59
ROOT::Math::Boost::fM
Scalar fM
Definition: Boost.h:284