00001
00002
00003
00004
00005
00006
00007
00008
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
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
00035
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
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
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
00071 d1.boost (*this);
00072 d2.boost (*this);
00073
00074
00075
00076
00077
00078 }