12#include <Math/Vector3D.h>
24 static constexpr auto XYZToTVector = [](
const ROOT::Math::XYZVector& a)
26 return TVector3(a.X(), a.Y(), a.Z());
29 namespace VectorUtil {
38 inline void setMagThetaPhi(ROOT::Math::XYZVector& vector,
39 double mag,
double theta,
double phi)
41 const double amag = std::abs(mag);
42 const double sinTheta = std::sin(theta);
43 const double x = amag * sinTheta * std::cos(phi);
44 const double y = amag * sinTheta * std::sin(phi);
45 const double z = amag * std::cos(theta);
46 vector.SetXYZ(x, y, z);
54 inline void setMag(ROOT::Math::XYZVector& vector,
double mag)
56 setMagThetaPhi(vector, mag, vector.Theta(), vector.Phi());
64 inline void setTheta(ROOT::Math::XYZVector& vector,
double theta)
66 setMagThetaPhi(vector, vector.R(), theta, vector.Phi());
74 inline void setPhi(ROOT::Math::XYZVector& vector,
double phi)
76 setMagThetaPhi(vector, vector.R(), vector.Theta(), phi);
86 inline void setPtThetaPhi(ROOT::Math::XYZVector& vector,
87 double pt,
double theta,
double phi)
89 const double aPt = std::abs(pt);
90 const double x = aPt * std::cos(phi);
91 const double y = aPt * std::sin(phi);
92 const double tanTheta = std::tan(theta);
93 const double z = tanTheta ? aPt / tanTheta : 0;
94 vector.SetXYZ(x, y, z);
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Abstract base class for different kinds of events.