Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef SHERPA_Main_Sherpa_H
0002 #define SHERPA_Main_Sherpa_H
0003 
0004 #include "ATOOLS/Math/Uncertain.H"
0005 #include "ATOOLS/Org/CXXFLAGS_PACKAGES.H"
0006 #include "ATOOLS/Org/Terminator_Objects.H"
0007 #include "SHERPA/Main/Filter.H"
0008 
0009 namespace ATOOLS {
0010   class Blob_List;
0011   class Cluster_Amplitude;
0012 }
0013 
0014 #ifdef USING__HEPMC3
0015 namespace HepMC3{ class GenEvent; }
0016 namespace SHERPA { class HepMC3_Interface; }
0017 #endif
0018 
0019 namespace SHERPA {
0020   class Initialization_Handler;
0021   class Event_Handler;
0022 
0023   class Sherpa: public ATOOLS::Terminator_Object {
0024   private:
0025     long int      m_trials, m_debugstep, m_debuginterval, m_displayinterval;
0026     long int      m_evt_output, m_evt_output_start;
0027     double        m_evt_starttime;
0028     bool          m_showtrials;
0029     bool          m_filter;
0030 
0031     Initialization_Handler * p_inithandler;
0032     Event_Handler          * p_eventhandler;
0033 #ifdef USING__HEPMC3
0034     HepMC3_Interface       * p_hepmc3;
0035 #endif
0036     Filter                 * p_filter;
0037 
0038     void RegisterDefaults();
0039     void DrawLogo(const bool& shouldprintversioninfo);
0040 
0041     void PrepareTerminate();
0042 
0043   public:
0044 
0045     Sherpa(int argc, char* argv[]);
0046     ~Sherpa();
0047 
0048     bool InitializeTheRun();
0049     bool InitializeTheEventHandler();
0050 
0051     bool GenerateOneEvent(bool reset=true);
0052 #ifdef USING__HEPMC3
0053     void FillHepMCEvent(HepMC3::GenEvent&);
0054 #endif
0055 
0056     ATOOLS::Uncertain<double> TotalNominalXS() const;
0057 
0058     // Legacy methods
0059     double TotalXS() const { return TotalNominalXS().value; }
0060     double TotalErr() const { return TotalNominalXS().error; }
0061 
0062     std::string PDFInfo();
0063 
0064     bool SummarizeRun();
0065 
0066     long int NumberOfEvents() const;
0067 
0068     const ATOOLS::Blob_List &GetBlobList() const;
0069 
0070     double GetMEWeight(const ATOOLS::Cluster_Amplitude &ampl,const int mode=0) const;
0071     
0072     inline Initialization_Handler * GetInitHandler() const 
0073     { return p_inithandler; }
0074     inline Event_Handler * GetEventHandler() const 
0075     { return p_eventhandler; }
0076     
0077   };
0078 
0079   /*!
0080     \namespace SHERPA
0081     \brief The namespace for the organisation overhead of the event generator.
0082   */
0083   /*!
0084     \class Sherpa
0085     \brief Overall steering of the package.
0086 
0087     At the moment, event generation with Sherpa proceeds in two major phases, an initialization
0088     and, following that, corresponding calls to single event generation. For this, both weighted and
0089     unweighted events are available.
0090 
0091     The initialization is done through the SHERPA::Initialization_Handler. This object 
0092     - defines the physical model for the run, 
0093     - sets up the beams and pdf's, 
0094     - initializes and evaluates matrix elements for the hard processes, 
0095     - sets up the parton showers, 
0096     - the fragmentation including the beam remnant handling
0097 
0098     The single events are organized through the Event_Handler. This object owns a list of
0099     Event_Phase_Handlers (e.g. Signal_Process, JetEvolution, etc.) that take care of the 
0100     evolution of the event. This proceeds trough a list of Blob's (objects with n incoming 
0101     and m outgoing particles), which is passed through the list of Event_Phase_Handler's. Each of 
0102     them checks, if any "active" blob is of a type the specific Event_Phase_Handler can deal with. 
0103     If so, the Blob_List and the Blob will be modified accordingly to allow for 
0104     more modifications in other phases of the event.
0105 
0106     It should be noted that the specific Event_Phase_Handlers and their base class as well as 
0107     the Event_Handler can be found in the subdirectory SingleEvents, whereas specific handlers 
0108     that are filled into the Event_Phase_Handlers (such as Matrix_Element_Handler or Shower_Handler) 
0109     can be found in the subdirectories PerturbativePhysics or SoftPhysics.
0110   */
0111   /*!
0112     \var long int Sherpa::m_trials
0113     The number of trials per single event. At the moment, m_trials = 100.
0114   */
0115   /*!
0116     \var Initialization_Handler * Sherpa::p_inithandler
0117     A pointer to the Initialization_Handler that manages the initialization of all parts of the 
0118     package and triggers any caluclation/evaluation (like, e.g. of matrix elements) that has to 
0119     be done before the simluation of single events. Eventually, the Initialization_Handler
0120     also deletes all modules after run termination.
0121   */
0122   /*!
0123     \var Event_Handler * Sherpa::p_eventhandler
0124     A pointer to the handler of single event production.
0125   */
0126   /*!
0127     \fn void Sherpa::DrawLogo()  
0128     Has to be filled with a nice logo.
0129   */
0130   /*!
0131     \fn Sherpa::Sherpa()
0132     Constructor of the class, sets the number of allowed trials, m_trials, per single event.
0133   */
0134   /*!
0135     \fn Sherpa::~Sherpa()
0136     Deletes this object and various static members of other classes.
0137   */
0138   /*!
0139     \fn bool Sherpa::InitializeTheRun(std::string _path = std::string("./"))
0140     Initializes the full run through instantiation of the Initialization_Handler and corresponding
0141     calls to its methods. If the initialization of the framework was successful, cross sections are
0142     evaluated, if this worked out, true is returned. If any of the tasks above fails, false is 
0143     returned.
0144   */
0145   /*!
0146     \fn bool Sherpa::InitializeTheEventHandler()
0147     The event handler is instatiated, individual event phases are initialized and added to the event 
0148     handler's list of event phases to be dealt with. Per default, true is returned.
0149   */
0150   /*!
0151     \fn bool Sherpa::GenerateOneEvent()
0152     In this method, up to m_trials (default 100) trials are made to geenrate one single event. If 
0153     this succeeds, true is returned, otherwise the result is false. 
0154   */
0155   /*!
0156     \fn bool Sherpa::SummarizeRun()
0157     Print out event generation statistics and ask the Event_Handler instance to finish.
0158     Always returns true.
0159   */
0160 }
0161 #endif
0162