Juggler
Juggling algorithms and event processing using gaudi framework
Boost.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 // Copyright (C) 2022 Wouter Deconinck, Barak Schmookler
3 
4 #pragma once
5 
6 #include "Math/Vector4D.h"
7 using ROOT::Math::PxPyPzEVector;
8 
9 #include "Math/LorentzRotation.h"
10 #include "Math/LorentzVector.h"
11 #include "Math/RotationX.h"
12 #include "Math/RotationY.h"
13 #include "Math/Boost.h"
14 
15 namespace Jug::Base::Boost {
16 
17  using ROOT::Math::LorentzRotation;
18 
19  inline LorentzRotation determine_boost(PxPyPzEVector ei, PxPyPzEVector pi) {
20 
21  using ROOT::Math::RotationX;
22  using ROOT::Math::RotationY;
23  using ROOT::Math::Boost;
24 
25  // Step 1: Find the needed boosts and rotations from the incoming lepton and hadron beams
26  // (note, this will give you a perfect boost, in principle you will not know the beam momenta exactly and should use an average)
27 
28  // Define the Boost to make beams back-to-back
29  const auto cmBoost = (ei + pi).BoostToCM();
30 
31  const Boost boost_to_cm(-cmBoost);
32 
33  // This will boost beams from a center of momentum frame back to (nearly) their original energies
34  const Boost boost_to_headon(cmBoost); // FIXME
35 
36  // Boost and rotate the incoming beams to find the proper rotations TLorentzVector
37 
38  // Boost to COM frame
39  boost_to_cm(pi);
40  boost_to_cm(ei);
41  // Rotate to head-on
42  RotationY rotAboutY(-1.0*atan2(pi.Px(), pi.Pz())); // Rotate to remove x component of beams
43  RotationX rotAboutX(+1.0*atan2(pi.Py(), pi.Pz())); // Rotate to remove y component of beams
44 
45  LorentzRotation tf;
46  tf *= boost_to_cm;
47  tf *= rotAboutY;
48  tf *= rotAboutX;
49  tf *= boost_to_headon;
50  return tf;
51  }
52 
53  inline PxPyPzEVector apply_boost(const LorentzRotation& tf, PxPyPzEVector part) {
54 
55  // Step 2: Apply boosts and rotations to any particle 4-vector
56  // (here too, choices will have to be made as to what the 4-vector is for reconstructed particles)
57 
58  // Boost and rotate particle 4-momenta into the headon frame
59  tf(part);
60  return part;
61  }
62 
63 } // namespace Jug::Base::Boost
Jug::Base::Boost::apply_boost
PxPyPzEVector apply_boost(const LorentzRotation &tf, PxPyPzEVector part)
Definition: Boost.h:53
Jug::Base::Boost::determine_boost
LorentzRotation determine_boost(PxPyPzEVector ei, PxPyPzEVector pi)
Definition: Boost.h:19
Jug::Base::Boost
Definition: Boost.h:15