19#include "analysis/OrcaKInFit/FourVector.h"
33 namespace OrcaKinFit {
35 static TRandom* rnd = 0;
37 FourVector& FourVector::boost(
const FourVector& P)
41 double pP = -(
p * P.p);
45 E = (e * P.getE() - pP) / M;
46 p =
p - ((pP / (P.getE() + M) - e) / M) * P.p;
51 void FourVector::decayto(FourVector& d1, FourVector& d2)
const
61 double m1 = d1.getM();
62 double m2 = d2.getM();
65 if (rnd == 0) rnd =
new TRandom3();
66 rnd->RndmArray(2, randoms);
71 double pstar = 0.5 *
sqrt(abs((M2 - pow(m1 + m2, 2)) * (M2 - pow(m1 - m2, 2)))) / M;
72 double phistar = 2 * M_PI * randoms[0];
73 double costhetastar = 2 * randoms[1] - 1;
74 double sinthetastar =
sqrt(abs(1 - costhetastar * costhetastar));
75 double E1 =
sqrt(m1 * m1 + pstar * pstar);
76 double E2 =
sqrt(m2 * m2 + pstar * pstar);
79 d1 =
FourVector(E1, pstar * sinthetastar * cos(phistar),
80 pstar * sinthetastar * sin(phistar),
81 pstar * costhetastar);
82 d2 =
FourVector(E2, -pstar * sinthetastar * cos(phistar),
83 -pstar * sinthetastar * sin(phistar),
84 -pstar * costhetastar);
FourVector()
Default constructor.
double getM2() const
Returns the mass squared / magnitude squared.
double getM() const
Returns the mass / magnitude.
ThreeVector p
The momentum three vector.
double getE() const
Returns the energy / 0 component.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.