Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-02 07:54:32

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 Wouter Deconinck, Barak Schmookler
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   // Step 1: Find the needed boosts and rotations from the incoming lepton and hadron beams
0026   // (note, this will give you a perfect boost, in principle you will not know the beam momenta exactly and should use an average)
0027 
0028   // Define the Boost to make beams back-to-back
0029   const auto cmBoost = (ei + pi).BoostToCM();
0030 
0031   const Boost boost_to_cm(-cmBoost);
0032 
0033   // This will boost beams from a center of momentum frame back to (nearly) their original energies
0034   const Boost boost_to_headon(cmBoost); // FIXME
0035 
0036   // Boost and rotate the incoming beams to find the proper rotations TLorentzVector
0037 
0038   // Boost to COM frame
0039   boost_to_cm(pi);
0040   boost_to_cm(ei);
0041   // Rotate to head-on
0042   RotationY rotAboutY(-1.0 * atan2(pi.Px(), pi.Pz())); // Rotate to remove x component of beams
0043   RotationX rotAboutX(+1.0 * atan2(pi.Py(), pi.Pz())); // Rotate to remove y component of beams
0044 
0045   LorentzRotation tf;
0046   tf *= boost_to_cm;
0047   tf *= rotAboutY;
0048   tf *= rotAboutX;
0049   tf *= boost_to_headon;
0050   return tf;
0051 }
0052 
0053 inline PxPyPzEVector apply_boost(const LorentzRotation& tf, PxPyPzEVector part) {
0054 
0055   // Step 2: Apply boosts and rotations to any particle 4-vector
0056   // (here too, choices will have to be made as to what the 4-vector is for reconstructed particles)
0057 
0058   // Boost and rotate particle 4-momenta into the headon frame
0059   tf(part);
0060   return part;
0061 }
0062 
0063 } // namespace eicrecon