00001 // @(#)root/mathcore:$Id: BoostZ.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 BoostZ, 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/BoostZ.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 BoostZ::BoostZ() : fBeta(0.0), fGamma(1.0) {} 00031 00032 void BoostZ::SetComponents (Scalar bz) { 00033 // set component 00034 Scalar bp2 = bz*bz; 00035 if (bp2 >= 1) { 00036 GenVector::Throw ( 00037 "Beta Vector supplied to set BoostZ represents speed >= c"); 00038 return; 00039 } 00040 fBeta = bz; 00041 fGamma = 1.0 / std::sqrt(1.0 - bp2); 00042 } 00043 00044 void BoostZ::GetComponents (Scalar& bz) const { 00045 // get component 00046 bz = fBeta; 00047 } 00048 00049 DisplacementVector3D< Cartesian3D<BoostZ::Scalar> > 00050 BoostZ::BetaVector() const { 00051 // return beta vector 00052 return DisplacementVector3D< Cartesian3D<Scalar> > 00053 ( 0.0, 0.0, fBeta ); 00054 } 00055 00056 void BoostZ::GetLorentzRotation (Scalar r[]) const { 00057 // get corresponding LorentzRotation 00058 r[kLXX] = 1.0; r[kLXY] = 0.0; r[kLXZ] = 0.0; r[kLXT] = 0.0 ; 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] = fGamma; r[kLZT] = fGamma*fBeta; 00061 r[kLTX] = 0.0; r[kLTY] = 0.0; r[kLTZ] = fGamma*fBeta; r[kLTT] = fGamma; 00062 } 00063 00064 void BoostZ::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 BoostZ::operator() (const LorentzVector< PxPyPzE4D<double> > & v) const { 00084 // apply boost to a LV 00085 Scalar z = v.Pz(); 00086 Scalar t = v.E(); 00087 return LorentzVector< PxPyPzE4D<double> > 00088 ( v.Px() 00089 , v.Py() 00090 , fGamma*z + fGamma*fBeta*t 00091 , fGamma*fBeta*z + fGamma*t ); 00092 } 00093 00094 void BoostZ::Invert() { 00095 // invert 00096 fBeta = -fBeta; 00097 } 00098 00099 BoostZ BoostZ::Inverse() const { 00100 // return an inverse boostZ 00101 BoostZ tmp(*this); 00102 tmp.Invert(); 00103 return tmp; 00104 } 00105 00106 // ========== I/O ===================== 00107 00108 std::ostream & operator<< (std::ostream & os, const BoostZ & b) { 00109 os << " BoostZ( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) "; 00110 return os; 00111 } 00112 00113 } //namespace Math 00114 } //namespace ROOT