File indexing completed on 2025-04-19 09:09:56
0001 #ifndef ATOOLS_Phys_Momentum_Shifter_H
0002 #define ATOOLS_Phys_Momentum_Shifter_H
0003
0004 #include "ATOOLS/Phys/Particle.H"
0005 #include "ATOOLS/Math/Poincare.H"
0006
0007 #include <set>
0008
0009 namespace ATOOLS {
0010
0011 struct ms {
0012
0013 enum error_code {
0014 no_error = 0,
0015 shift_error = 1,
0016 direction_error = 2,
0017 sperp_error = 4,
0018 momenta_error = 8,
0019 boost_error_1 = 16,
0020 boost_error_2 = 32,
0021 scale_error = 64,
0022 setup_error = 128
0023 };
0024
0025 };
0026
0027 std::ostream &operator<<(std::ostream &ostr,const ms::error_code code);
0028
0029 class Momentum_Shifter {
0030 private:
0031
0032 Vec4D m_shift, m_direction;
0033 Vec4D m_pold[3], m_pnew[3], m_pperp[3];
0034
0035 Poincare m_oldcms, m_newcms, m_rotate;
0036 Particle *p_initial[2];
0037
0038 std::set<Particle*> m_boosted;
0039
0040 size_t m_maxdepth;
0041 double m_sp[3];
0042 bool m_setshift, m_setdirection, m_setsp[3];
0043 bool m_initboost, m_initscale;
0044
0045 bool CalculateShift();
0046 bool DetermineDirection();
0047 bool CalculateSPerp();
0048 bool ConstructMomenta();
0049
0050 bool Boost(Particle *const particle,const size_t catcher);
0051 bool BoostBack(Particle *const particle,const size_t catcher);
0052
0053 public:
0054
0055
0056 Momentum_Shifter(Particle *const initial1,Particle *const initial2);
0057
0058
0059 double Lambda2(double sp,double sp1,double sp2);
0060
0061 bool Boost(Particle *const particle);
0062 bool BoostBack(Particle *const particle);
0063
0064 ms::error_code Boost();
0065 ms::error_code BoostBack();
0066
0067 ms::error_code Scale();
0068
0069 void Reset();
0070
0071
0072 inline void SetMaxDepth(const size_t depth) { m_maxdepth=depth; }
0073
0074 inline void SetSPerp(const double sp,const size_t i) { m_sp[i]=sp; m_setsp[i]=true; }
0075
0076 inline void SetShift(const Vec4D &shift) { m_shift=shift; m_setshift=true; }
0077 inline void SetDirection(const Vec4D &dir) { m_direction=dir; m_setdirection=true; }
0078
0079 inline size_t MaxDepth() const { return m_maxdepth; }
0080
0081 inline double SPerp(const size_t i) const { return m_sp[i]; }
0082
0083 inline const Vec4D &Shift() const { return m_shift; }
0084 inline const Vec4D &Direction() const { return m_direction; }
0085
0086 };
0087
0088 }
0089
0090 #endif