Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

FourVector.C

Go to the documentation of this file.
00001 
00002 // Class FourVector
00003 //
00004 // Author: Benno List
00005 // Last update: $Date: 2004/06/01 16:40:09 $
00006 //          by: $Author: blist $
00007 // 
00008 // Description: class for four-vectors
00009 //               
00011 
00012 #include "jbltools/kinfit/FourVector.h"
00013 
00014 #include <cmath>
00015 #include <cassert>
00016 #include "jbltools/kinfit/ftypes.h"
00017 #include "jbltools/kinfit/cernlib.h"
00018 
00019 
00020 FourVector& FourVector::boost (const FourVector& P) {
00021   // See CERNLIB U101 for a description
00022   
00023   double pP = -(p*P.p);
00024   double e = getE();
00025   double M = P.getM();
00026   
00027   E = (e*P.getE() - pP)/M;
00028   p = p - ((pP/(P.getE()+M)-e)/M)*P.p;
00029   
00030   return *this;
00031 }
00032 
00033 void FourVector::decayto (FourVector& d1, FourVector& d2) const {
00034   // Let this particle decay isotropically into 4-vectors d1 and d2;
00035   // d1 and d2 must have definite mass at beginning
00036   using std::abs;
00037   using std::sqrt; 
00038   using std::pow;
00039 
00040   double M2 = getM2();
00041   double M  = getM();;
00042   double m1 = d1.getM();
00043   double m2 = d2.getM();
00044   
00045   FReal randoms[2];
00046   FInteger ilen = 2;
00047 //  ranmar_ (randoms, &ilen);
00048   ranmar (randoms, 2);
00049   
00050   assert (m1+m2<=M);
00051   
00052   double pstar = 0.5*sqrt (abs((M2-pow(m1+m2,2))*(M2-pow(m1-m2,2))))/M;
00053   double phistar = 2*M_PI*randoms[0];
00054   double costhetastar = 2*randoms[1]-1;
00055   double sinthetastar = sqrt(abs (1-costhetastar*costhetastar));
00056   double E1 = sqrt(m1*m1+pstar*pstar);
00057   double E2 = sqrt(m2*m2+pstar*pstar);
00058   
00059 //  cout << "pstar=" << pstar << ", E1=" << E1 << ", E2=" << E2 << endl;
00060   
00061   
00062           
00063   d1 = FourVector (E1, pstar*sinthetastar*cos(phistar), 
00064                        pstar*sinthetastar*sin(phistar),  
00065                        pstar*costhetastar);
00066   d2 = FourVector (E2, -pstar*sinthetastar*cos(phistar),  
00067                        -pstar*sinthetastar*sin(phistar),  
00068                        -pstar*costhetastar);
00069                        
00070 //   cout << "d1 = " << d1 << "\nd2 = " << d2 << "\nsum= " << d1+d2 << ", mass: " << (d1+d2).getM() << endl;
00071   d1.boost (*this);
00072   d2.boost (*this);
00073   
00074 //   std::cout << "Decay of " << mother 
00075 //             << "\nto  " << d1 
00076 //             << "\nand " << d2 
00077 //             << "\n:   " << mother-(d1+d2) << endl;
00078 }

Generated on Fri Sep 14 17:38:20 2007 for Kinfit by doxygen 1.3.2