BoostY.cxx

Go to the documentation of this file.
00001 // @(#)root/mathcore:$Id: BoostY.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 BoostY, 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/BoostY.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 BoostY::BoostY() : fBeta(0.0), fGamma(1.0) {}
00031 
00032 void BoostY::SetComponents (Scalar by) {
00033    // set component
00034    Scalar bp2 = by*by;
00035    if (bp2 >= 1) {
00036       GenVector::Throw( 
00037                               "Beta Vector supplied to set BoostY represents speed >= c");
00038       return;
00039    }    
00040    fBeta = by;
00041    fGamma = 1.0 / std::sqrt(1.0-bp2);
00042 }
00043 
00044 void BoostY::GetComponents (Scalar& by) const {
00045    // get component
00046    by = fBeta;
00047 }
00048 
00049 DisplacementVector3D< Cartesian3D<BoostY::Scalar> >
00050 BoostY::BetaVector() const {
00051    // return beta vector
00052    return DisplacementVector3D< Cartesian3D<Scalar> > ( 0.0, fBeta, 0.0 );
00053 }
00054 
00055 void BoostY::GetLorentzRotation (Scalar r[]) const {
00056    // get corresponding LorentzRotation
00057    r[kLXX] = 1.0;  r[kLXY] = 0.0;           r[kLXZ] = 0.0;  r[kLXT] = 0.0;  
00058    r[kLYX] = 0.0;  r[kLYY] = fGamma;        r[kLYZ] = 0.0;  r[kLYT] = fGamma*fBeta; 
00059    r[kLZX] = 0.0;  r[kLZY] = 0.0;           r[kLZZ] = 1.0;  r[kLZT] = 0.0;  
00060    r[kLTX] = 0.0;  r[kLTY] = fGamma*fBeta;  r[kLTZ] = 0.0;  r[kLTT] = fGamma;  
00061 }
00062 
00063 void BoostY::Rectify() {
00064    // Assuming the representation of this is close to a true Lorentz Rotation,
00065    // but may have drifted due to round-off error from many operations,
00066    // this forms an "exact" orthosymplectic matrix for the Lorentz Rotation
00067    // again.
00068    
00069    if (fGamma <= 0) {   
00070       GenVector::Throw ( 
00071                               "Attempt to rectify a boost with non-positive gamma");
00072       return;
00073    }    
00074    Scalar beta = fBeta;
00075    if ( beta >= 1 ) {                       
00076       beta /= ( beta * ( 1.0 + 1.0e-16 ) );  
00077    }
00078    SetComponents ( beta );
00079 }
00080 
00081 LorentzVector< PxPyPzE4D<double> >
00082 BoostY::operator() (const LorentzVector< PxPyPzE4D<double> > & v) const {
00083    // apply boost to a LV
00084    Scalar y = v.Py();
00085    Scalar t = v.E();
00086    return LorentzVector< PxPyPzE4D<double> > 
00087       (  v.Px()
00088          , fGamma*y       + fGamma*fBeta*t
00089          ,  v.Pz()
00090          , fGamma*fBeta*y + fGamma*t );
00091 }
00092 
00093 void BoostY::Invert() {
00094    // invert Boost
00095    fBeta = -fBeta;
00096 }
00097 
00098 BoostY BoostY::Inverse() const {
00099    // return inverse
00100    BoostY tmp(*this);
00101    tmp.Invert();
00102    return tmp; 
00103 }
00104 
00105 // ========== I/O =====================
00106 
00107 std::ostream & operator<< (std::ostream & os, const BoostY & b) {
00108    os << " BoostY( beta: " << b.Beta() << ", gamma: " << b.Gamma() << " ) ";
00109    return os;
00110 }
00111 
00112 } //namespace Math
00113 } //namespace ROOT

Generated on Tue Jul 5 14:30:53 2011 for ROOT_528-00b_version by  doxygen 1.5.1