Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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//
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
63namespace ROOT {
64
65namespace 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) {
80 GenVector_Throw("Beta Vector supplied to set Boost represents speed >= c");
81 // SetIdentity();
82 return;
83 }
84 Scalar gamma = 1.0 / std::sqrt(1.0 - bp2);
85 Scalar bgamma = gamma * gamma / (1.0 + gamma);
86 fM[kXX] = 1.0 + bgamma * bx * bx;
87 fM[kYY] = 1.0 + bgamma * by * by;
88 fM[kZZ] = 1.0 + bgamma * bz * bz;
89 fM[kXY] = bgamma * bx * by;
90 fM[kXZ] = bgamma * bx * bz;
91 fM[kYZ] = bgamma * by * bz;
92 fM[kXT] = gamma * bx;
93 fM[kYT] = gamma * by;
94 fM[kZT] = gamma * bz;
95 fM[kTT] = gamma;
96}
97
99 // get beta of the boots as 3 components
100 Scalar gaminv = 1.0/fM[kTT];
101 bx = fM[kXT]*gaminv;
102 by = fM[kYT]*gaminv;
103 bz = fM[kZT]*gaminv;
104}
105
108 // get boost beta vector
109 Scalar gaminv = 1.0/fM[kTT];
111 ( fM[kXT]*gaminv, fM[kYT]*gaminv, fM[kZT]*gaminv );
112}
113
115 // get Lorentz rotation corresponding to this boost as an array of 16 values
116 r[kLXX] = fM[kXX]; r[kLXY] = fM[kXY]; r[kLXZ] = fM[kXZ]; r[kLXT] = fM[kXT];
117 r[kLYX] = fM[kXY]; r[kLYY] = fM[kYY]; r[kLYZ] = fM[kYZ]; r[kLYT] = fM[kYT];
118 r[kLZX] = fM[kXZ]; r[kLZY] = fM[kYZ]; r[kLZZ] = fM[kZZ]; r[kLZT] = fM[kZT];
119 r[kLTX] = fM[kXT]; r[kLTY] = fM[kYT]; r[kLTZ] = fM[kZT]; r[kLTT] = fM[kTT];
120}
121
123 // Assuming the representation of this is close to a true Lorentz Rotation,
124 // but may have drifted due to round-off error from many operations,
125 // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation
126 // again.
127
128 if (fM[kTT] <= 0) {
129 GenVector_Throw("Attempt to rectify a boost with non-positive gamma");
130 return;
131 }
133 beta /= fM[kTT];
134 if ( beta.mag2() >= 1 ) {
135 beta /= ( beta.R() * ( 1.0 + 1.0e-16 ) );
136 }
138}
139
142 // apply bosost to a PxPyPzE LorentzVector
143 Scalar x = v.Px();
144 Scalar y = v.Py();
145 Scalar z = v.Pz();
146 Scalar t = v.E();
148 ( fM[kXX]*x + fM[kXY]*y + fM[kXZ]*z + fM[kXT]*t
149 , fM[kXY]*x + fM[kYY]*y + fM[kYZ]*z + fM[kYT]*t
150 , fM[kXZ]*x + fM[kYZ]*y + fM[kZZ]*z + fM[kZT]*t
151 , fM[kXT]*x + fM[kYT]*y + fM[kZT]*z + fM[kTT]*t );
152}
153
155 // invert in place boost (modifying the object)
156 fM[kXT] = -fM[kXT];
157 fM[kYT] = -fM[kYT];
158 fM[kZT] = -fM[kZT];
159}
160
162 // return inverse of boost
163 Boost tmp(*this);
164 tmp.Invert();
165 return tmp;
166}
167
168
169// ========== I/O =====================
170
171std::ostream & operator<< (std::ostream & os, const Boost & b) {
172 // TODO - this will need changing for machine-readable issues
173 // and even the human readable form needs formatting improvements
174 double m[16];
175 b.GetLorentzRotation(m);
176 os << "\n" << m[0] << " " << m[1] << " " << m[2] << " " << m[3];
177 os << "\n" << "\t" << " " << m[5] << " " << m[6] << " " << m[7];
178 os << "\n" << "\t" << " " << "\t" << " " << m[10] << " " << m[11];
179 os << "\n" << "\t" << " " << "\t" << " " << "\t" << " " << m[15] << "\n";
180 return os;
181}
182
183} //namespace Math
184} //namespace ROOT
#define b(i)
Definition RSha256.hxx:100
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Lorentz boost class with the (4D) transformation represented internally by a 4x4 orthosymplectic matr...
Definition Boost.h:47
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:114
void Invert()
Invert a Boost in place.
Definition Boost.cxx:154
Scalar fM[10]
Definition Boost.h:285
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
void SetIdentity()
Definition Boost.cxx:67
Boost Inverse() const
Return inverse of a boost.
Definition Boost.cxx:161
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:141
void Rectify()
Re-adjust components to eliminate small deviations from a perfect orthosyplectic matrix.
Definition Boost.cxx:122
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:98
XYZVector BetaVector() const
Definition Boost.cxx:107
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
double beta(double x, double y)
Calculates the beta function.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Namespace for new Math classes and functions.
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Definition AxisAngle.cxx:91
void GenVector_Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
Namespace for new ROOT classes and functions.
TMarker m
Definition textangle.C:8