9#include <analysis/utility/PCmsLabTransform.h>
11#include <initializer_list>
17 struct CmsTransformCache {
19 DBObjPtr<CollisionInvariantMass> invariantMass;
21 DBObjPtr<CollisionBoostVector> boostVector;
23 DBObjPtr<CollisionAxisCMS> axisCms;
30 ROOT::Math::XYZVector boost;
32 ROOT::Math::LorentzRotation labToCms;
34 ROOT::Math::LorentzRotation cmsToLab;
36 ROOT::Math::PxPyPzEVector beamFourMomentum;
40 for (DBAccessorBase* accessor : std::initializer_list<DBAccessorBase*> {&invariantMass, &boostVector, &axisCms}) {
44 accessor->addCallback([
this]() { valid =
false; },
false);
45 accessor->addCallback([
this]() { valid =
false; },
true);
50 const CmsTransformCache& get()
53 cmsEnergy = invariantMass->getMass();
54 boost = ROOT::Math::XYZVector(boostVector->getBoost());
56 cmsToLab = labToCms.Inverse();
57 beamFourMomentum = cmsToLab * ROOT::Math::PxPyPzEVector(0, 0, 0, cmsEnergy);
65 const CmsTransformCache& cmsTransform()
67 static CmsTransformCache cache;
74 return cmsTransform().boost;
79 return cmsTransform().cmsEnergy;
84 return cmsTransform().beamFourMomentum;
89 return cmsTransform().labToCms;
94 return cmsTransform().cmsToLab;
100 return T.rotateLabToCms() * vector;
106 return T.rotateCmsToLab() * vector;
112 return T.rotateLabToCms() * vector;
118 return T.rotateCmsToLab() * vector;
static ROOT::Math::LorentzRotation rotateLabToCms(const ROOT::Math::XYZVector &boostVector, double cmsAngleXZ, double cmsAngleYZ)
Function takes 3D boostVector and angles of the HER momentum in the CM system obtained by pure boost.
Abstract base class for different kinds of events.