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) {
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
99void 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 }
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
173std::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[16];
177 b.GetLorentzRotation(m);
178 os << "\n" << m[0] << " " << m[1] << " " << m[2] << " " << m[3];
179 os << "\n" << "\t" << " " << m[5] << " " << m[6] << " " << m[7];
180 os << "\n" << "\t" << " " << "\t" << " " << m[10] << " " << m[11];
181 os << "\n" << "\t" << " " << "\t" << " " << "\t" << " " << m[15] << "\n";
182 return os;
183}
184
185} //namespace Math
186} //namespace ROOT
#define b(i)
Definition RSha256.hxx:100
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:115
void Invert()
Invert a Boost in place.
Definition Boost.cxx:156
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:163
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
void Rectify()
Re-adjust components to eliminate small deviations from a perfect orthosyplectic matrix.
Definition Boost.cxx:123
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
XYZVector BetaVector() const
Definition Boost.cxx:108
Class describing a generic displacement vector in 3 dimensions.
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
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.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Namespace for new Math classes and functions.
void Throw(const char *)
function throwing exception, by creating internally a GenVector_exception only when needed
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
TMarker m
Definition textangle.C:8