LorentzVectorB.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id:$
00003 // ---------------------------------------------------------------------------
00004 //
00005 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00006 //
00007 // This is the implementation of the HepLorentzVector class:
00008 // Those methods originating in ZOOM dealing with simple boosts and rotations.
00009 // Use of one of these methods will not force loading of the HepRotation or
00010 // HepLorentzRotation class.
00011 //
00012 
00013 #ifdef GNUPRAGMA
00014 #pragma implementation
00015 #endif
00016 
00017 #include "CLHEP/Vector/LorentzVector.h"
00018 
00019 namespace CLHEP  {
00020 
00021 //-*********
00022 // rotationOf()
00023 //-*********
00024 
00025 // Each of these is a shell over a rotate method.
00026 
00027 HepLorentzVector rotationXOf
00028         (const HepLorentzVector & vec, double phi){
00029   HepLorentzVector vv (vec);
00030   return vv.rotateX (phi);
00031 }
00032 
00033 HepLorentzVector rotationYOf
00034         (const HepLorentzVector & vec, double phi){
00035   HepLorentzVector vv (vec);
00036   return vv.rotateY (phi);
00037 }
00038 
00039 HepLorentzVector rotationZOf
00040         (const HepLorentzVector & vec, double phi){
00041   HepLorentzVector vv (vec);
00042   return vv.rotateZ (phi);
00043 }
00044 
00045 //-********
00046 // boost
00047 //-********
00048 
00049 HepLorentzVector & HepLorentzVector::boost 
00050                         ( const Hep3Vector & aaxis,  double bbeta ) {
00051   if (bbeta==0) {
00052     return *this; // do nothing for a 0 boost
00053   }
00054   double r2 = aaxis.mag2();
00055   if ( r2 == 0 ) {
00056     std::cerr << "HepLorentzVector::boost() - "
00057       << "A zero vector used as axis defining a boost -- no boost done"
00058       << std::endl;
00059     return *this;
00060   } 
00061   double b2 = bbeta*bbeta;
00062   if (b2 >= 1) {
00063     std::cerr << "HepLorentzVector::boost() - "
00064       << "LorentzVector boosted with beta >= 1 (speed of light) -- \n"
00065       << "no boost done" << std::endl;
00066   } else {
00067     Hep3Vector u = aaxis.unit();
00068     register double ggamma = std::sqrt(1./(1.-b2));
00069     register double betaDotV = u.dot(pp)*bbeta;
00070     register double tt = ee;
00071 
00072     ee = ggamma * (tt + betaDotV);
00073     pp += ( ((ggamma-1)/b2)*betaDotV*bbeta + ggamma*bbeta*tt ) * u;
00074     // Note:  I have verified the behavior of this even when beta is very
00075     //        small -- (gamma-1)/b2 becomes inaccurate by O(1), but it is then
00076     //        multiplied by O(beta**2) and added to an O(beta) term, so the
00077     //        inaccuracy does not affect the final result.
00078   }
00079   return *this;
00080 } /* boost (axis, beta) */
00081 
00082 }  // namespace CLHEP

Generated on Mon May 27 17:50:31 2013 for Geant4 by  doxygen 1.4.7