00001 // @(#)root/mathcore:$Id: BoostX.cxx 24923 2008-07-23 15:43:05Z moneta $ 00002 // Authors: M. Fischler 2005 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2005 , LCG ROOT FNAL MathLib Team * 00007 * * 00008 * * 00009 **********************************************************************/ 00010 00011 // Header file for class BoostX, a 4x4 symmetric matrix representation of 00012 // an axial Lorentz transformation 00013 // 00014 // Created by: Mark Fischler Mon Nov 1 2005 00015 // 00016 #include "Math/GenVector/BoostX.h" 00017 #include "Math/GenVector/LorentzVector.h" 00018 #include "Math/GenVector/PxPyPzE4D.h" 00019 #include "Math/GenVector/DisplacementVector3D.h" 00020 #include "Math/GenVector/Cartesian3D.h" 00021 #include "Math/GenVector/GenVector_exception.h" 00022 00023 #include <cmath> 00024 #include <algorithm> 00025 00026 namespace ROOT { 00027 00028 namespace Math { 00029 00030 00031 BoostX::BoostX() : fBeta(0.0), fGamma(1.0) {} 00032 00033 void BoostX::SetComponents (Scalar bx ) { 00034 // set component 00035 Scalar bp2 = bx*bx; 00036 if (bp2 >= 1) { 00037 GenVector::Throw ( 00038 "Beta Vector supplied to set BoostX represents speed >= c"); 00039 return; 00040 } 00041 fBeta = bx; 00042 fGamma = 1.0 / std::sqrt(1.0 - bp2); 00043 } 00044 00045 void BoostX::GetComponents (Scalar& bx) const { 00046 // get component 00047 bx = fBeta; 00048 } 00049 00050 DisplacementVector3D< Cartesian3D<BoostX::Scalar> > 00051 BoostX::BetaVector() const { 00052 // return beta vector 00053 return DisplacementVector3D< Cartesian3D<Scalar> > ( fBeta, 0.0, 0.0 ); 00054 } 00055 00056 void BoostX::GetLorentzRotation (Scalar r[]) const { 00057 // get corresponding LorentzRotation 00058 r[kLXX] = fGamma; r[kLXY] = 0.0; r[kLXZ] = 0.0; r[kLXT] = fGamma*fBeta; 00059 r[kLYX] = 0.0; r[kLYY] = 1.0; r[kLYZ] = 0.0; r[kLYT] = 0.0; 00060 r[kLZX] = 0.0; r[kLZY] = 0.0; r[kLZZ] = 1.0; r[kLZT] = 0.0; 00061 r[kLTX] = fGamma*fBeta; r[kLTY] = 0.0; r[kLTZ] = 0.0; r[kLTT] = fGamma; 00062 } 00063 00064 void BoostX::Rectify() { 00065 // Assuming the representation of this is close to a true Lorentz Rotation, 00066 // but may have drifted due to round-off error from many operations, 00067 // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation 00068 // again. 00069 00070 if (fGamma <= 0) { 00071 GenVector::Throw ( 00072 "Attempt to rectify a boost with non-positive gamma"); 00073 return; 00074 } 00075 Scalar beta = fBeta; 00076 if ( beta >= 1 ) { 00077 beta /= ( beta * ( 1.0 + 1.0e-16 ) ); 00078 } 00079 SetComponents ( beta ); 00080 } 00081 00082 LorentzVector< PxPyPzE4D<double> > 00083 BoostX::operator() (const LorentzVector< PxPyPzE4D<double> > & v) const { 00084 // apply boost to a LV 00085 Scalar x = v.Px(); 00086 Scalar t = v.E(); 00087 return LorentzVector< PxPyPzE4D<double> > 00088 ( fGamma*x + fGamma*fBeta*t 00089 , v.Py() 00090 , v.Pz() 00091 , fGamma*fBeta*x + fGamma*t ); 00092 } 00093 00094 void BoostX::Invert() { 00095 // invert 00096 fBeta = -fBeta; 00097 } 00098 00099 BoostX BoostX::Inverse() const { 00100 // return an inverse boostX 00101 BoostX tmp(*this); 00102 tmp.Invert(); 00103 return tmp; 00104 } 00105 00106 // ========== I/O ===================== 00107 00108 std::ostream & operator<< (std::ostream & os, const BoostX & b) { 00109 os << " BoostX( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) "; 00110 return os; 00111 } 00112 00113 } //namespace Math 00114 } //namespace ROOT