Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:10:10

0001 #ifndef PHASIC_Main_Process_Integrator_H
0002 #define PHASIC_Main_Process_Integrator_H
0003 
0004 #include "ATOOLS/Math/Vector.H"
0005 #include "ATOOLS/Math/Histogram.H"
0006 #include "ATOOLS/Org/Info_Key.H"
0007 #include "PHASIC++/Process/Process_Base.H"
0008 #include "ATOOLS/Org/Terminator_Objects.H"
0009 
0010 #include <string>
0011 
0012 namespace ATOOLS {
0013   class Blob_Data_Base;
0014   class Cluster_Amplitude;
0015 }
0016 namespace BEAM   { class Beam_Spectra_Handler; }
0017 namespace PDF    { class ISR_Handler; }
0018 namespace YFS    { class YFS_Handler; }
0019 
0020 namespace PHASIC {
0021 
0022   class Multi_Channel;
0023   class Color_Integrator;
0024   class Helicity_Integrator;
0025 
0026   class Phase_Space_Handler;
0027 
0028   class Process_Integrator: public ATOOLS::Terminator_Object {
0029   protected:
0030 
0031     Process_Base *p_proc;
0032 
0033     /// handler created by this instance, automatically deleted with this
0034     std::unique_ptr<Phase_Space_Handler> p_ownpshandler;
0035     /// pointer to actually used phase space handler,
0036     /// might be owned by different instance and not deleted by this
0037     Phase_Space_Handler * p_pshandler;
0038 
0039     BEAM::Beam_Spectra_Handler *p_beamhandler;
0040     PDF::ISR_Handler           *p_isrhandler;
0041     YFS::YFS_Handler           *p_yfshandler;
0042 
0043     std::string m_resultpath;
0044     size_t      m_nin, m_nout, m_smode, m_swmode;
0045 
0046     ATOOLS::Vec4D_Vector p_momenta;
0047 
0048     cls::scheme m_colorscheme;
0049     hls::scheme m_helicityscheme;
0050 
0051     double m_threshold, m_enhancefac, m_maxeps, m_rsfac;
0052 
0053     long unsigned int m_n, m_itmin;
0054 
0055     double m_max, m_totalxs, m_totalsum, m_totalsumsqr, m_totalerr;
0056     double m_ssum, m_ssumsqr, m_smax, m_ssigma2, m_wmin;
0057     double m_mssum, m_mssumsqr, m_msn;
0058 
0059     std::vector<double> m_vsmax, m_vsum;
0060     std::vector<long unsigned int> m_vsn;
0061 
0062     long unsigned int m_sn, m_son;
0063 
0064     bool m_writeout;
0065 
0066     ATOOLS::Histogram *p_whisto;
0067 
0068     std::shared_ptr<Color_Integrator>    p_colint;
0069     std::shared_ptr<Helicity_Integrator> p_helint;
0070 
0071     double Sigma2() const;
0072 
0073   public:
0074 
0075     double TotalSigma2() const;
0076     double TotalResult() const;
0077     double TotalVar() const;
0078 
0079   public:
0080 
0081     // constructor
0082     Process_Integrator(Process_Base *const proc);
0083 
0084     // destructor
0085     ~Process_Integrator();
0086   
0087     // member functions
0088     bool Initialize(BEAM::Beam_Spectra_Handler *const beamhandler=NULL,
0089             PDF::ISR_Handler *const isrhandler=NULL,
0090             YFS::YFS_Handler *const yfshandler=NULL);
0091   
0092     void SetMomenta(const ATOOLS::Vec4D_Vector &p);
0093     void SetMomenta(const ATOOLS::Cluster_Amplitude &ampl);
0094 
0095     void AddPoint(const double xs);
0096     void Reset(const int mode=1);
0097 
0098     void SetMax(const double max);
0099     void SetTotal(const int mode=1);
0100 
0101     void ResetMax(int);  
0102     void OptimizeSubResult(const double &s2);
0103 
0104     //void SetPSHandler(const std::shared_ptr<Phase_Space_Handler> &pshandler);
0105     void SetPSHandler(Phase_Space_Handler * pshandler);
0106     void SetPSHandler(const double &maxerr,const std::string eobs,const std::string efunc);
0107     void SetISRThreshold(const double threshold);
0108     
0109     void InitWeightHistogram();
0110     void ReadInHistogram(std::string);
0111     void WriteOutHistogram(std::string);
0112     bool ReadInXSecs(const std::string &path);
0113     void WriteOutXSecs(const std::string &path);
0114 
0115     void OptimizeResult();
0116     void EndOptimize();
0117 
0118     double GetMaxEps(double);
0119     void   SetUpEnhance(const int omode=0);
0120 
0121     void ReadResults();
0122     void StoreResults(const int mode=0);
0123     void StoreBackupResults();
0124     void PrepareTerminate();
0125 
0126     void SetEnhanceFactor(const double &efac);
0127     void SetMaxEpsilon(const double &maxeps);
0128     void SetRSEnhanceFactor(const double &rsfac);
0129 
0130     double SelectionWeight(const int mode) const;
0131 
0132     void MPISync(const int mode=0);
0133     void MPICollect(std::vector<double> &sv,std::vector<double> &mv,size_t &i);
0134     void MPIReturn(std::vector<double> &sv,std::vector<double> &mv,size_t &i);
0135 
0136     // inline functions
0137     inline Process_Base *Process() const { return p_proc; }
0138 
0139     inline void SetColorScheme(const cls::scheme &s)    { m_colorscheme=s;    }
0140     inline void SetHelicityScheme(const hls::scheme &s) { m_helicityscheme=s; }
0141 
0142     inline void SetItMin(const long unsigned int &itmin) { m_itmin=itmin;  }
0143 
0144     inline size_t NIn() const     { return m_nin;     }
0145     inline size_t NOut() const    { return m_nout;    }
0146 
0147     inline const ATOOLS::Vec4D_Vector &Momenta() const { return p_momenta;  }
0148     inline ATOOLS::Vec4D_Vector       &Momenta()       { return p_momenta;  }
0149 
0150     inline double   Sum() const     { return m_totalsum;    }
0151     inline double   SumSqr() const  { return m_totalsumsqr; }
0152     inline long int Points() const  { return m_n+m_sn;      }
0153     inline long int SPoints() const { return m_sn;          }
0154 
0155     inline double TotalXS() const    { return m_totalxs;  }
0156     inline double TotalError() const { return m_totalerr; }
0157     inline double Max() const        { return m_max;      }
0158 
0159     inline double ISRThreshold() const      { return m_threshold;   }
0160     inline double EnhanceFactor() const     { return m_enhancefac;  }
0161     inline double RSEnhanceFactor() const   { return m_rsfac;       }
0162 
0163     inline cls::scheme ColorScheme() const    { return m_colorscheme;    }
0164     inline hls::scheme HelicityScheme() const { return m_helicityscheme; }
0165 
0166     inline void SetBeam(BEAM::Beam_Spectra_Handler *const beam) 
0167     { p_beamhandler=beam; }
0168     inline void SetISR(PDF::ISR_Handler *const isr)  
0169     { p_isrhandler=isr;  }
0170     inline void SetYFS(YFS::YFS_Handler *const yfs)
0171     { p_yfshandler=yfs;  }
0172 
0173     inline BEAM::Beam_Spectra_Handler *Beam() const 
0174     { return p_beamhandler; }
0175     inline PDF::ISR_Handler           *ISR() const  
0176     { return p_isrhandler;  }
0177 
0178     inline YFS::YFS_Handler           *YFS() const
0179     { return p_yfshandler;  }
0180     //inline std::shared_ptr<Phase_Space_Handler> PSHandler() const
0181     //{ return p_pshandler; }
0182 
0183     inline Phase_Space_Handler * PSHandler() const { return p_pshandler; }
0184 
0185     inline void SetColorIntegrator(const std::shared_ptr<Color_Integrator> colint)
0186     { p_colint=colint; }
0187     inline void SetHelicityIntegrator(const std::shared_ptr<Helicity_Integrator> helint)
0188     { p_helint=helint; }
0189 
0190     inline std::shared_ptr<Color_Integrator> ColorIntegrator() const
0191     { return p_colint; }
0192     inline std::shared_ptr<Helicity_Integrator> HelicityIntegrator() const
0193     { return p_helint; }
0194 
0195     inline long unsigned int ItMin() const { return m_itmin; }
0196 
0197     inline void SetResultPath(const std::string &path) { m_resultpath=path; }
0198 
0199     inline std::string ResultPath() const { return m_resultpath; }
0200 
0201     inline ATOOLS::Histogram *WeightHisto() const { return p_whisto; }
0202 
0203   };// end of class Process_Integrator
0204 
0205 }// end of namespace PHASIC
0206 
0207 #endif
0208 
0209