Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef SHERPA_Initialization_Initialization_Handler_H
0002 #define SHERPA_Initialization_Initialization_Handler_H
0003 
0004 #include "ATOOLS/Org/CXXFLAGS.H"
0005 #include "ATOOLS/Org/Terminator_Objects.H"
0006 #include "ATOOLS/Org/Exception.H"
0007 
0008 #include "MODEL/Main/Model_Base.H"
0009 #include "BEAM/Main/Beam_Spectra_Handler.H"
0010 #include "PDF/Main/ISR_Handler.H"
0011 #include "REMNANTS/Main/Remnant_Handler.H"
0012 #include "SHERPA/SoftPhysics/Soft_Collision_Handler.H"
0013 #include "SHERPA/PerturbativePhysics/MI_Handler.H"
0014 #include "SHERPA/PerturbativePhysics/Shower_Handler.H"
0015 #include "SHERPA/PerturbativePhysics/Matrix_Element_Handler.H"
0016 #include "SHERPA/Tools/Analysis_Interface.H"
0017 #include "SHERPA/Tools/Output_Base.H"
0018 #include "SHERPA/Tools/Definitions.H"
0019 #include "YFS/Main/YFS_Handler.H"
0020 
0021 #include <map>
0022 #include <string>
0023 #include <iostream>
0024 
0025 namespace ATOOLS {
0026   class Variations;
0027   class Fragmentation_Base;
0028   class Settings;
0029 }
0030 
0031 namespace SHERPA {
0032 
0033   class Matrix_Element_Handler;
0034   class Hard_Decay_Handler;
0035   class Beam_Remnant_Handler;
0036   class Colour_Reconnection_Handler;
0037   class Decay_Handler_Base;
0038   class Soft_Photon_Handler;
0039   class Event_Reader_Base;
0040   class Analysis_Interface;
0041   class Filter;
0042 
0043   class Initialization_Handler: public ATOOLS::Terminator_Object {
0044   private :
0045     std::string m_evtform;
0046     std::set<std::string> m_pdflibs;
0047     std::map<PDF::isr::id, std::array<std::string, 2> >  m_defsets;
0048     std::map<PDF::isr::id, std::vector<size_t> > m_bunchtags;
0049 
0050     ATOOLS::Flavour m_bunch_particles[2];
0051 
0052     eventtype::code m_mode;
0053     bool            m_savestatus;
0054 
0055     MODEL::Model_Base            * p_model;
0056     BEAM::Beam_Spectra_Handler   * p_beamspectra;
0057     PDF::ISR_Handler_Map           m_isrhandlers;
0058     REMNANTS::Remnant_Handler_Map  m_remnanthandlers;
0059     Matrix_Element_Handler       * p_mehandler;
0060     Hard_Decay_Handler           * p_harddecays;
0061     Shower_Handler_Map             m_showerhandlers;
0062     Beam_Remnant_Handler         * p_beamremnants;
0063     Colour_Reconnection_Handler  * p_reconnections;
0064     ATOOLS::Fragmentation_Base   * p_fragmentation;
0065     Soft_Collision_Handler_Map     m_schandlers;
0066     Decay_Handler_Base           * p_hdhandler;
0067     MI_Handler_Map                 m_mihandlers;
0068     Soft_Photon_Handler          * p_softphotons;
0069     Event_Reader_Base            * p_evtreader;
0070     Analysis_Vector                m_analyses;
0071     Output_Vector                  m_outputs;
0072     ATOOLS::Variations           * p_variations;
0073     Filter                       * p_filter;
0074     YFS::YFS_Handler            * p_yfshandler;
0075 
0076     void ShowParameterSyntax();
0077     void CheckVersion();
0078     bool CompareVersions(const size_t& a1,const size_t& b1,const size_t& c1,
0079                          const size_t& a2,const size_t& b2,const size_t& c2);
0080     void LoadLibraries();
0081   private :
0082     bool InitializeTheIO();
0083     bool InitializeTheModel();
0084     bool InitializeTheBeams();
0085     bool InitializeThePDFs();
0086     bool InitializeTheRemnants();
0087     bool InitializeTheMatrixElements();
0088     bool InitializeTheUnderlyingEvents();
0089     bool InitializeTheHardDecays();
0090     bool InitializeTheShowers();
0091     bool InitializeTheBeamRemnants();
0092     bool InitializeTheColourReconnections();
0093     bool InitializeTheFragmentation();
0094     bool InitializeTheSoftCollisions();
0095     bool InitializeTheHadronDecays();
0096     bool InitializeTheSoftPhotons();
0097     bool InitializeTheFilter();
0098     bool InitializeTheAnalyses();
0099     bool InitializeTheReweighting(ATOOLS::Variations_Mode);
0100     bool InitializeTheYFS();
0101 
0102     void RegisterDefaults();
0103     bool CheckBeamISRConsistency();
0104     void LoadPDFLibraries(ATOOLS::Settings& settings);
0105     void InitISRHandler(const PDF::isr::id & pid,ATOOLS::Settings& settings);
0106     void DefineBunchFlavours(ATOOLS::Settings& settings);
0107     void SetGlobalVariables();
0108     void PrepareTerminate();
0109 
0110   public :
0111 
0112     Initialization_Handler();
0113     ~Initialization_Handler();
0114 
0115     bool InitializeTheFramework(int =-1);
0116     bool CalculateTheHardProcesses();
0117     inline const bool AddBeamRescatters() const {
0118       return m_isrhandlers.find(PDF::isr::bunch_rescatter)!=m_isrhandlers.end();
0119     }
0120     Matrix_Element_Handler           * GetMatrixElementHandler()      const { return p_mehandler; }
0121     Decay_Handler_Base               * GetHDHandler()                       { return p_hdhandler; }
0122     Analysis_Vector                  * GetAnalyses()                        { return &m_analyses; }
0123     Output_Vector                    * GetOutputs()                         { return &m_outputs; }
0124     MODEL::Model_Base                * GetModel()                     const { return p_model; }
0125     PDF::ISR_Handler_Map             * GetISRHandlers()                     { return &m_isrhandlers; }
0126     YFS::YFS_Handler             * GetYFSHandler()                  { return p_yfshandler;    }
0127     BEAM::Beam_Spectra_Handler       * GetBeamSpectraHandler()        const { return p_beamspectra; }
0128     Hard_Decay_Handler               * GetHardDecayHandler()          const { return p_harddecays; }
0129     const Shower_Handler_Map         & GetShowerHandlers()            const { return m_showerhandlers; }
0130     Beam_Remnant_Handler             * GetBeamRemnantHandler()        const { return p_beamremnants; }
0131     Colour_Reconnection_Handler      * GetColourReconnectionHandler() const { return p_reconnections; }
0132     ATOOLS::Fragmentation_Base       * GetFragmentation()             const { return p_fragmentation; }
0133     Soft_Collision_Handler_Map       * GetSoftCollisionHandlers()           { return &m_schandlers; }
0134     ATOOLS::Flavour                  * GetBunches()                         { return m_bunch_particles; }
0135     MI_Handler_Map                   * GetMIHandlers()                      { return &m_mihandlers; }
0136     REMNANTS::Remnant_Handler_Map    & GetRemnantHandlers()                 { return m_remnanthandlers; }
0137     Soft_Photon_Handler              * GetSoftPhotonHandler()         const { return p_softphotons; }
0138     Event_Reader_Base                * GetEventReader()               const { return p_evtreader; }
0139     ATOOLS::Variations               * GetVariations()                const { return p_variations; }
0140     Filter                           * GetFilter()                    const { return p_filter; }
0141     inline PDF::ISR_Handler       * GetISRHandler(const PDF::isr::id id)  { return m_isrhandlers[id]; }
0142     inline Soft_Collision_Handler * GetSCHandler(const PDF::isr::id id)   { return m_schandlers[id]; }
0143     inline MI_Handler             * GetMIHandler(const PDF::isr::id id)   { return m_mihandlers[id]; }
0144 
0145     eventtype::code Mode() const { return m_mode; };
0146 
0147   };
0148 
0149   /*!
0150     \file
0151     \brief Contains the class SHERPA::Initialization_Handler
0152   */
0153 
0154   /*!
0155     \class Initialization_Handler
0156     \brief It is in charge of initialising and deleting all physics modules used during a run.
0157 
0158     This class takes care of the proper initialization of all physics modules to be initialized
0159     during the set up of the event generator. In particular, these contain
0160     - the model which contains all physics parameters (like coupling constants,
0161       mixing matrices, etc.)
0162     - beam spectra (which is particularly important for physics processes involving for instance
0163       laser back scattering of photons off electrons)
0164     - the pdf's through the ISR_Handler,
0165     - the matrix elements, if needed they are also evaluated to yield total cross sections,
0166     - the parton shower in the initial and final state,
0167     - the handling of the beam remnants,
0168     - the fragmentation
0169     
0170     These modules are later on taken by the main steering class, Sherpa, and put into
0171     corresponding Event_Phase_Handlers. After termination of the run, they are all deleted.
0172   */
0173   /*!
0174     \var ATOOLS::Flavour Initialization_Handler::m_bunch_particles[2]
0175     The bunch particles, i.e. the particles that are resolved into their constituents by the pdf's.
0176   */
0177   /*!
0178     \var MODEL::Model_Base * Initialization_Handler::p_model
0179     A pointer to the model that is initialized by the Initialization_Handler.
0180   */
0181   /*!
0182     \var BEAM::Beam_Spectra_Handler * Initialization_Handler::p_beamspectra
0183     A pointer to the beam spectra that are initialized by the Initialization_Handler.
0184   */
0185   /*!
0186     \var Initialization_Handler::m_isrhandlers
0187     The ISR handling (the pdf's) that is initialized by the Initialization_Handler.
0188   */
0189   /*!
0190     \var Matrix_Element_Handler * Initialization_Handler::p_mehandler
0191     A pointer to the abstract wrapper around the matrix elements that are initialized
0192     by the Initialization_Handler.
0193   */
0194   /*!
0195     \var Initialization_Handler::m_showerhandlers
0196     The abstract wrappers around the shower module. It is initialized by the
0197     Initialization_Handler.
0198   */
0199   /*!
0200     \var Beam_Remnant_Handler * Initialization_Handler::p_beamremnants
0201     A pointer to the beam remnant handling used thoughout the run.
0202   */
0203   /*!
0204     \var Fragmentation_Handler * Initialization_Handler::p_fragmentation
0205     A pointer to the wrapper around the fragmentation code that will be used during the run.
0206   */
0207   /*!
0208     \var Initialization_Handler::p_hdhandler
0209     A pointer to the wrapper around the hadron decay code that will be used during the run.
0210   */
0211   /*!
0212     \fn Initialization_Handler::~Initialization_Handler()
0213     The destructor deletes all physdics modules that have been used during the run.
0214   */
0215   /*!
0216     \fn bool Initialization_Handler::InitializeTheFramework()
0217     This method first reads in all particles, before subsequently the model, the beams and the pdf's
0218     are set up. After this has been done, consistency of the bunch particles and the beam
0219     handling is checked for. If successul, the matrix elements, showers, beam remanants,
0220     fragmentation and hadron decays are instantiated. If everything worked out, true is returned
0221     and some first corss section evaluation will start.
0222   */
0223   /*!
0224     \fn bool Initialization_Handler::CalculateTheHardProcesses()
0225     Returns true if the calculation of total cross sections by the matrix elements
0226     of choice was successful, otherwise, flase will be returned.
0227   */
0228 
0229   /*!
0230     \fn Initialization_Handler::InitializeTheHadronDecays()
0231     This method reads the fragmentation settings, especially the desired decay model.
0232 
0233     If the model is \c Hadrons it calls the HADRONS constructor for initialisation
0234     and the Hadron_Decay_Handler::EraseTreated method
0235     to remove the particles that HADRONS can cope with from the unstable hadron list. If then
0236     there are still some particles in the list, i.e. those that HADRONS can't deal with, it needs to
0237     initialise Pythia as well.
0238     */
0239 
0240 
0241 }
0242 
0243 
0244 #endif