File indexing completed on 2026-09-09 08:25:49
0001
0002
0003
0004 #pragma once
0005
0006 #include <Math/Vector4D.h>
0007 #include <Math/LorentzRotation.h>
0008 #include <Math/LorentzVector.h>
0009 #include <Math/RotationX.h>
0010 #include <Math/RotationY.h>
0011 #include <Math/Boost.h>
0012
0013 using ROOT::Math::PxPyPzEVector;
0014
0015 namespace eicrecon {
0016
0017 using ROOT::Math::LorentzRotation;
0018
0019 inline LorentzRotation determine_boost(PxPyPzEVector ei, PxPyPzEVector pi) {
0020
0021 using ROOT::Math::Boost;
0022 using ROOT::Math::RotationX;
0023 using ROOT::Math::RotationY;
0024
0025
0026 PxPyPzEVector eo = ei;
0027 PxPyPzEVector po = pi;
0028
0029
0030 const auto cmBoost = (ei + pi).BoostToCM();
0031 const Boost boost_from_og_to_cm(cmBoost);
0032
0033 ei = boost_from_og_to_cm(ei);
0034 pi = boost_from_og_to_cm(pi);
0035
0036
0037 RotationY rotAboutY(-1.0 * atan2(pi.Px(), pi.Pz()));
0038 RotationX rotAboutX(+1.0 * atan2(pi.Py(), pi.Pz()));
0039
0040 ei = rotAboutX(rotAboutY(ei));
0041 pi = rotAboutX(rotAboutY(pi));
0042
0043
0044 double e_energy = eo.E();
0045 double p_energy = po.E();
0046 double e_pz = -eo.P();
0047 double p_pz = +po.P();
0048
0049 PxPyPzEVector eh(0, 0, e_pz, e_energy);
0050 PxPyPzEVector ph(0, 0, p_pz, p_energy);
0051
0052
0053 const auto hoBoost = (eh + ph).BoostToCM();
0054 const Boost boost_from_cm_to_headon(-hoBoost);
0055
0056
0057 LorentzRotation tf;
0058 tf *= boost_from_cm_to_headon;
0059 tf *= rotAboutX;
0060 tf *= rotAboutY;
0061 tf *= boost_from_og_to_cm;
0062
0063 return tf;
0064 }
0065
0066 inline PxPyPzEVector apply_boost(const LorentzRotation& tf, const PxPyPzEVector& part) {
0067
0068
0069
0070
0071
0072 return tf(part);
0073 }
0074
0075 }