Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef PHASIC_Main_Phase_Space_Point_H
0002 #define PHASIC_Main_Phase_Space_Point_H
0003 
0004 #include "PHASIC++/Channels/Beam_Channels.H"
0005 #include "PHASIC++/Channels/ISR_Channels.H"
0006 #include "PHASIC++/Channels/FSR_Channels.H"
0007 #include "ATOOLS/Org/Info_Key.H"
0008 #include "ATOOLS/Org/CXXFLAGS.H"
0009 #include <iostream>
0010 
0011 namespace BEAM { class Beam_Spectra_Handler; }
0012 namespace PDF  { class ISR_Handler; }
0013 namespace YFS  { class YFS_Handler; }
0014 
0015 namespace PHASIC {
0016   class Phase_Space_Handler;
0017   class Process_Integrator;
0018   class Cut_Data;
0019 
0020   struct psmode {    
0021     enum code {
0022       normal_call = 0,
0023       no_lim_isr  = 32,
0024       no_gen_isr  = 64
0025     };
0026   };// end of struct psm
0027   inline psmode::code operator|(const psmode::code &c1,const psmode::code &c2) {
0028     return (psmode::code)((int)c1|(int)c2);
0029   }
0030   inline psmode::code operator&(const psmode::code &c1,const psmode::code &c2) {
0031     return (psmode::code)((int)c1&(int)c2);
0032   }
0033 
0034   
0035   class Phase_Space_Point {
0036   private:
0037     Phase_Space_Handler             * p_pshandler;
0038     BEAM::Beam_Spectra_Handler      * p_beamhandler;
0039     PDF::ISR_Handler                * p_isrhandler;
0040     YFS::YFS_Handler                * p_yfshandler;
0041     ATOOLS::Vec4D_Vector            & p_moms;
0042     Cut_Data                        * p_cuts;
0043     Multi_Channel  * p_beamchannels, * p_isrchannels, * p_fsrchannels;
0044     ATOOLS::Info_Key m_beamspkey, m_beamykey, m_isrspkey, m_isrykey;
0045     
0046     psmode::code        m_mode;    
0047     size_t              m_nin, m_nout, m_nvec;
0048     double              m_Ecms, m_Eprime, m_smin, m_sprime, m_y;
0049     double              m_fixedsprime, m_fixedy;
0050     std::vector<double> m_masses;
0051     double              m_osmass, m_masses2[2];
0052     ATOOLS::Vec4D       m_ISmoms[2];
0053     double              m_weight, m_ISsymmetryfactor;
0054 
0055     void   InitFixedIncomings();
0056     bool   DefineBeamKinematics();
0057     bool   DefineISRKinematics(Process_Integrator * process);
0058     bool   DefineFSRKinematics();
0059     bool   Check4Momentum();
0060     void   CorrectMomenta();
0061 
0062     inline void Reset(const psmode::code & mode) {
0063       m_mode   = mode;
0064       m_sprime = m_fixedsprime; m_y = m_fixedy;
0065       m_ISsymmetryfactor = 1.;
0066       p_moms[0] = m_ISmoms[0];
0067       p_moms[1] = m_ISmoms[1];
0068     }
0069   public:
0070     Phase_Space_Point(Phase_Space_Handler * psh);
0071     ~Phase_Space_Point();
0072 
0073     void   Init();
0074     void   InitCuts(Process_Integrator * process);
0075     bool   operator()(Process_Integrator * process,
0076               const psmode::code & mode=psmode::normal_call);
0077 
0078     double CalculateWeight();
0079     
0080     inline void SetBeamIntegrator(Multi_Channel * channels) { p_beamchannels = channels; }
0081     inline void SetISRIntegrator(Multi_Channel * channels)  { p_isrchannels  = channels; }
0082     inline void SetFSRIntegrator(Multi_Channel * channels)  { p_fsrchannels  = channels; }
0083     inline void SetMomenta(ATOOLS::Vec4D_Vector& moms) {
0084       p_moms = moms;
0085       ATOOLS::Vec4D pin = p_moms[0]+p_moms[1];
0086       m_isrspkey[3] = pin.Abs2();
0087       m_isrykey[2]  = pin.Y();
0088     }
0089     inline void SetOSMass(const double &osmass) {
0090       m_osmass = osmass;
0091       m_isrspkey[4] = osmass*osmass;
0092     }
0093 
0094     inline Multi_Channel * BeamIntegrator()   const { return p_beamchannels; }
0095     inline Multi_Channel * ISRIntegrator()    const { return p_isrchannels; }
0096     inline Multi_Channel * FSRIntegrator()    const { return p_fsrchannels; }
0097     inline Cut_Data      * Cuts()             const { return p_cuts; }
0098     inline const double  & Weight()           const { return m_weight; }
0099     inline const double  & ISSymmetryFactor() const { return m_ISsymmetryfactor; }
0100 
0101 
0102     inline void AddPoint(const double & value) {
0103       if (p_beamchannels) p_beamchannels->AddPoint(value);
0104       if (p_isrchannels)  p_isrchannels->AddPoint(value);
0105       p_fsrchannels->AddPoint(value);
0106     }
0107     inline void Optimize(const double & error) {
0108       if (p_beamchannels) p_beamchannels->Optimize(error);
0109       if (p_isrchannels)  p_isrchannels->Optimize(error);
0110       p_fsrchannels->Optimize(error);
0111     }
0112     inline void EndOptimize(const double & error) {
0113       if (p_beamchannels) p_beamchannels->EndOptimize(error);
0114       if (p_isrchannels)  p_isrchannels->EndOptimize(error);
0115       p_fsrchannels->EndOptimize(error);
0116     }
0117 
0118     inline void MPISync() {
0119       if (p_beamchannels) p_beamchannels->MPISync();
0120       if (p_isrchannels) p_isrchannels->MPISync();
0121       p_fsrchannels->MPISync();
0122     }
0123     inline void WriteOut(const std::string &pID) {
0124       if (p_beamchannels) p_beamchannels->WriteOut(pID+"/MC_Beam");
0125       if (p_isrchannels) p_isrchannels->WriteOut(pID+"/MC_ISR");
0126       if (p_fsrchannels) p_fsrchannels->WriteOut(pID+"/MC_FSR");
0127     }
0128     inline bool ReadIn(const std::string &pID,const size_t exclude) {
0129       bool okay = true;
0130       if (p_beamchannels && !(exclude&1)) okay = okay && p_beamchannels->ReadIn(pID+"/MC_Beam");
0131       if (p_isrchannels && !(exclude&2))  okay = okay && p_isrchannels->ReadIn(pID+"/MC_ISR");
0132       if (p_fsrchannels && !(exclude&16)) okay = okay && p_fsrchannels->ReadIn(pID+"/MC_FSR");
0133       return okay;
0134     }    
0135     
0136     
0137     void Print(std::ostream & str);
0138   };
0139 }
0140 #endif