34 #ifndef LORENTZVECTOR_H
35 #define LORENTZVECTOR_H
52 void SetXYZT(
double x,
double y,
double z,
double t);
53 void SetPxPyPzE(
double px,
double py,
double pz,
double e) { SetXYZT(px, py, pz, e); };
55 double GetPx()
const {
return fSpaceVec.GetVector()[0]; }
56 double GetPy()
const {
return fSpaceVec.GetVector()[1]; }
57 double GetPz()
const {
return fSpaceVec.GetVector()[2]; }
58 double GetE()
const {
return fTime; }
62 fSpaceVec += vec.fSpaceVec;
68 fSpaceVec -= vec.fSpaceVec;
73 double M2()
const {
return fTime * fTime - fSpaceVec.Mag2(); }
76 const double mag2 = M2();
77 return (mag2 < 0) ? -sqrt(-mag2) : sqrt(mag2);
81 {
return vector3(fSpaceVec.X() / fTime, fSpaceVec.Y() / fTime, fSpaceVec.Z() / fTime); }
84 const double beta2 = beta.Mag2();
85 const double gamma = 1 / sqrt(1 - beta2);
86 const double betaTimesMom = beta.X() * fSpaceVec.X() + beta.Y() * fSpaceVec.Y() + beta.Z() * fSpaceVec.Z();
87 const double gamma2 = (beta2 > 0) ? (gamma - 1) / beta2 : 0;
88 SetXYZT(fSpaceVec.X() + gamma2 * betaTimesMom * beta.X() + gamma * beta.X() * fTime,
89 fSpaceVec.Y() + gamma2 * betaTimesMom * beta.Y() + gamma * beta.Y() * fTime,
90 fSpaceVec.Z() + gamma2 * betaTimesMom * beta.Z() + gamma * beta.Z() * fTime,
91 gamma * (fTime + betaTimesMom));
94 friend std::ostream& operator << (std::ostream& out,
97 out <<
"(" << vec.GetPx() <<
", " << vec.GetPy() <<
", " << vec.GetPz()
98 <<
"; " << vec.GetE() <<
")";
110 #endif // LORENTZVECTOR_H