CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

LorentzVectorB.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: LorentzVectorB.cc,v 1.2 2003/08/13 20:00:14 garren Exp $
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/defs.h"
00018 #include "CLHEP/Vector/LorentzVector.h"
00019 #include "CLHEP/Vector/ZMxpv.h"
00020 
00021 namespace CLHEP  {
00022 
00023 //-*********
00024 // rotationOf()
00025 //-*********
00026 
00027 // Each of these is a shell over a rotate method.
00028 
00029 HepLorentzVector rotationXOf
00030         (const HepLorentzVector & vec, double phi){
00031   HepLorentzVector vv (vec);
00032   return vv.rotateX (phi);
00033 }
00034 
00035 HepLorentzVector rotationYOf
00036         (const HepLorentzVector & vec, double phi){
00037   HepLorentzVector vv (vec);
00038   return vv.rotateY (phi);
00039 }
00040 
00041 HepLorentzVector rotationZOf
00042         (const HepLorentzVector & vec, double phi){
00043   HepLorentzVector vv (vec);
00044   return vv.rotateZ (phi);
00045 }
00046 
00047 //-********
00048 // boost
00049 //-********
00050 
00051 HepLorentzVector & HepLorentzVector::boost 
00052                         ( const Hep3Vector & axis,  double beta ) {
00053   if (beta==0) {
00054     return *this; // do nothing for a 0 boost
00055   }
00056   double r2 = axis.mag2();
00057   if ( r2 == 0 ) {
00058     ZMthrowA (ZMxpvZeroVector(
00059       "A zero vector used as axis defining a boost -- no boost done"));
00060     return *this;
00061   } 
00062   double b2 = beta*beta;
00063   if (b2 >= 1) {
00064     ZMthrowA (ZMxpvTachyonic(
00065       "LorentzVector boosted with beta >= 1 (speed of light) -- \n"
00066       "no boost done"));
00067   } else {
00068     Hep3Vector u = axis.unit();
00069     register double gamma = sqrt(1./(1.-b2));
00070     register double betaDotV = u.dot(pp)*beta;
00071     register double tt = ee;
00072 
00073     ee = gamma * (tt + betaDotV);
00074     pp += ( ((gamma-1)/b2)*betaDotV*beta + gamma*beta*tt ) * u;
00075     // Note:  I have verified the behavior of this even when beta is very
00076     //        small -- (gamma-1)/b2 becomes inaccurate by O(1), but it is then
00077     //        multiplied by O(beta**2) and added to an O(beta) term, so the
00078     //        inaccuracy does not affect the final result.
00079   }
00080   return *this;
00081 } /* boost (axis, beta) */
00082 
00083 }  // namespace CLHEP

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7