Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
BoostY.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 BoostY, 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/BoostY.h"
22 
23 #include <cmath>
24 #include <algorithm>
25 
26 namespace ROOT {
27 
28 namespace Math {
29 
30 BoostY::BoostY() : fBeta(0.0), fGamma(1.0) {}
31 
32 void BoostY::SetComponents (Scalar by) {
33  // set component
34  Scalar bp2 = by*by;
35  if (bp2 >= 1) {
36  GenVector::Throw(
37  "Beta Vector supplied to set BoostY represents speed >= c");
38  return;
39  }
40  fBeta = by;
41  fGamma = 1.0 / std::sqrt(1.0-bp2);
42 }
43 
44 void BoostY::GetComponents (Scalar& by) const {
45  // get component
46  by = fBeta;
47 }
48 
49 DisplacementVector3D< Cartesian3D<BoostY::Scalar> >
50 BoostY::BetaVector() const {
51  // return beta vector
52  return DisplacementVector3D< Cartesian3D<Scalar> > ( 0.0, fBeta, 0.0 );
53 }
54 
55 void BoostY::GetLorentzRotation (Scalar r[]) const {
56  // get corresponding LorentzRotation
57  r[kLXX] = 1.0; r[kLXY] = 0.0; r[kLXZ] = 0.0; r[kLXT] = 0.0;
58  r[kLYX] = 0.0; r[kLYY] = fGamma; r[kLYZ] = 0.0; r[kLYT] = fGamma*fBeta;
59  r[kLZX] = 0.0; r[kLZY] = 0.0; r[kLZZ] = 1.0; r[kLZT] = 0.0;
60  r[kLTX] = 0.0; r[kLTY] = fGamma*fBeta; r[kLTZ] = 0.0; r[kLTT] = fGamma;
61 }
62 
63 void BoostY::Rectify() {
64  // Assuming the representation of this is close to a true Lorentz Rotation,
65  // but may have drifted due to round-off error from many operations,
66  // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation
67  // again.
68 
69  if (fGamma <= 0) {
70  GenVector::Throw (
71  "Attempt to rectify a boost with non-positive gamma");
72  return;
73  }
74  Scalar beta = fBeta;
75  if ( beta >= 1 ) {
76  beta /= ( beta * ( 1.0 + 1.0e-16 ) );
77  }
78  SetComponents ( beta );
79 }
80 
81 LorentzVector< PxPyPzE4D<double> >
82 BoostY::operator() (const LorentzVector< PxPyPzE4D<double> > & v) const {
83  // apply boost to a LV
84  Scalar y = v.Py();
85  Scalar t = v.E();
86  return LorentzVector< PxPyPzE4D<double> >
87  ( v.Px()
88  , fGamma*y + fGamma*fBeta*t
89  , v.Pz()
90  , fGamma*fBeta*y + fGamma*t );
91 }
92 
93 void BoostY::Invert() {
94  // invert Boost
95  fBeta = -fBeta;
96 }
97 
98 BoostY BoostY::Inverse() const {
99  // return inverse
100  BoostY tmp(*this);
101  tmp.Invert();
102  return tmp;
103 }
104 
105 // ========== I/O =====================
106 
107 std::ostream & operator<< (std::ostream & os, const BoostY & b) {
108  os << " BoostY( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) ";
109  return os;
110 }
111 
112 } //namespace Math
113 } //namespace ROOT