File indexing completed on 2025-04-19 09:10:09
0001 #ifndef PHASIC_Main_CS_Dipole_H
0002 #define PHASIC_Main_CS_Dipole_H
0003
0004 #include "ATOOLS/Phys/Cluster_Amplitude.H"
0005 #include "ATOOLS/Phys/NLO_Subevt.H"
0006 #include "ATOOLS/Org/Info_Key.H"
0007
0008 namespace PHASIC {
0009
0010 class Vegas;
0011 class Cut_Data;
0012 class Multi_Channel;
0013 class Phase_Space_Handler;
0014
0015 class CS_Dipole {
0016 protected:
0017
0018 ATOOLS::NLO_subevt m_sub;
0019
0020 Vegas *p_vegas;
0021 double m_rn[3];
0022
0023 Multi_Channel *p_fsmc, *p_ismc;
0024 ATOOLS::Info_Key m_isrspkey, m_isrykey;
0025
0026 double m_alpha, m_oldalpha, m_weight, m_rbweight;
0027 double m_np, m_sum, m_sum2;
0028 double m_mnp, m_msum, m_msum2;
0029 double m_amin, m_q2min;
0030
0031 std::string m_id;
0032
0033 std::map<size_t,size_t> m_brmap, m_rbmap;
0034
0035 size_t m_type, m_ijt, m_kt, m_idx, m_isrmode;
0036 bool m_on, m_bmcw;
0037
0038 ATOOLS::Flavour m_fli, m_flj, m_flk, m_flij;
0039
0040 double Lambda(const double &s,const double &sb,
0041 const double &sc) const;
0042
0043 double GetS(const double &Q2,const double &y,
0044 const double &mi2,const double &mj2,
0045 const double &mk2) const;
0046 double GetZ(const double &Q2,const double &sij,
0047 const double &y,const double &zt,
0048 const double &mi2,const double &mk2) const;
0049 double GetKT2(const double &Q2,const double &y,const double &z,
0050 const double &mi2,const double &mj2,
0051 const double &mk2) const;
0052 double ConstructLN(const double &Q2,const double &sij,
0053 const double &mij2,const double &mk2,
0054 const ATOOLS::Vec4D &Q,ATOOLS::Vec4D &pk,
0055 ATOOLS::Vec4D &l,ATOOLS::Vec4D &n) const;
0056
0057 public:
0058
0059 CS_Dipole(ATOOLS::NLO_subevt *const sub,
0060 Phase_Space_Handler *const psh,const bool bmcw=0);
0061
0062 virtual ~CS_Dipole();
0063
0064 virtual ATOOLS::Vec4D_Vector GeneratePoint
0065 (const ATOOLS::Vec4D_Vector &p,
0066 Cut_Data *const cuts,const double *rns) = 0;
0067 virtual double GenerateWeight
0068 (const ATOOLS::Vec4D_Vector &p,Cut_Data *const cuts) = 0;
0069
0070 virtual bool ValidPoint(const ATOOLS::Vec4D_Vector& p) = 0;
0071
0072 void InitVegas(const std::string &pid);
0073
0074 double Phi(ATOOLS::Vec4D pijt,ATOOLS::Vec4D pkt,
0075 ATOOLS::Vec4D pi,const bool ii) const;
0076
0077 double Alpha(const int mode) const;
0078
0079 void AddPoint(const double &value,const double &ewgt,const int mode);
0080 void Optimize();
0081 void EndOptimize();
0082 void MPICollect(std::vector<double> &sv,size_t &i);
0083 void MPIReturn(std::vector<double> &sv,size_t &i);
0084 void MPISync();
0085 void Reset();
0086
0087 bool IsMapped(CS_Dipole *const dip) const;
0088
0089 void WriteOut(const std::string &pid,
0090 std::vector<std::string> &info) const;
0091 void ReadIn(const std::string &pid,
0092 const std::vector<std::string> &info);
0093
0094
0095 inline const ATOOLS::NLO_subevt *GetSubEvt() const { return &m_sub; }
0096
0097 inline void SetAMin(const double &amin) { m_amin=amin; }
0098 inline void SetQ2Min(const double &q2min) { m_q2min=q2min; }
0099
0100 inline double Alpha() const { return m_alpha; }
0101 inline double OldAlpha() const { return m_oldalpha; }
0102
0103 inline double Weight() const { return m_weight; }
0104 inline double RBWeight() const { return m_rbweight; }
0105
0106 inline void SetAlpha(const double &alpha) { m_alpha=alpha; }
0107 inline void SetOldAlpha(const double &alpha) { m_oldalpha=alpha; }
0108
0109 inline void SetIdx(const size_t &idx) { m_idx=idx; }
0110
0111 inline double N() const { return m_np; }
0112
0113 inline double Mean() const { return m_sum/m_np; }
0114 inline double Variance() const
0115 { return (m_sum2-m_sum*m_sum/m_np)/(m_np-1.0); }
0116 inline double Sigma() const
0117 { return sqrt(Variance()/m_np); }
0118
0119 inline const std::string &Id() const { return m_id; }
0120
0121 inline size_t Type() const { return m_type; }
0122 inline size_t Idx() const { return m_idx; }
0123
0124 inline void SetOn(const bool on) { m_on=on; }
0125 inline bool On() const { return m_on; }
0126
0127 };
0128
0129 std::ostream &operator<<(std::ostream &ostr,const CS_Dipole &dip);
0130
0131 typedef std::vector<CS_Dipole*> CSDipole_Vector;
0132 typedef std::vector<CSDipole_Vector> CSDipole_Matrix;
0133
0134 }
0135
0136 #endif