Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:31

0001 // -*- C++ -*-
0002 //
0003 // Main.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef THEPEG_Main_H
0010 #define THEPEG_Main_H
0011 // This is the declaration of the Main class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 #include "ThePEG/Repository/EventGenerator.h"
0015 
0016 namespace ThePEG {
0017 
0018 /**
0019  * This is a base class for classes implementing a main steering
0020  * routine for running an EventGenerator, in case the standard
0021  * 'go()' function in the EventGenerator is not enough. An example
0022  * is a EventGenerator where the class deriving from Main specifies an
0023  * initial set of partons which should be cascaded and hadronized etc.
0024  *
0025  * The derived class will be dynamically loaded by the standard
0026  * <code>runThePEG</code> program and the static Init() function will
0027  * be run. The loaded EventGenerator will then be available in the
0028  * static eventGenerator() function. In addition the number of events
0029  * requested from the command line will be available from the N()
0030  * function. All other command-line arguments will be available from
0031  * the arguments() function.
0032  *
0033  * @see EventGenerator
0034  */
0035 class Main: public Base {
0036 
0037 public:
0038 
0039   /**
0040    * Set the global event generator.
0041    */
0042   static void eventGenerator(tEGPtr eg) { theEventGenerator = eg; }
0043 
0044   /**
0045    * Get the global event generator.
0046    */
0047   static tEGPtr eventGenerator() { return theEventGenerator; }
0048 
0049   /**
0050    * Set the number of events requested.
0051    */
0052   static void N(long n) { theN = n; }
0053 
0054   /**
0055    * Get the number of events requested.
0056    */
0057   static long N() { return theN; } 
0058 
0059 
0060   /**
0061    * Set the command-line arguments.
0062    */
0063   static void arguments(const vector<string> & args) 
0064   {
0065     theArguments = args;
0066   }
0067 
0068   /**
0069    * Get the command-line arguments.
0070    */
0071   static const vector<string> & arguments() { return theArguments; }
0072 
0073 public:
0074 
0075   /**
0076    * Standard Init function used to initialize the interfaces.
0077    */
0078   static void Init() {}
0079 
0080 private:
0081 
0082   /**
0083    * The global event generator.
0084    */
0085   static EGPtr theEventGenerator;
0086 
0087   /**
0088    * The number of events requested.
0089    */
0090   static long theN;
0091 
0092   /**
0093    * The command-line arguments.
0094    */
0095   static vector<string> theArguments;
0096 
0097 private:
0098 
0099   /**
0100    * Describe an abstract base class without persistent data.
0101    */
0102   static AbstractNoPIOClassDescription<Main> initMain;
0103 
0104   /**
0105    * Private and non-existent assignment operator.
0106    */
0107   Main & operator=(const Main &) = delete;
0108 
0109 };
0110 
0111 }
0112 
0113 
0114 namespace ThePEG {
0115 
0116 /** @cond TRAITSPECIALIZATIONS */
0117 
0118 /** This template specialization informs ThePEG about the base classes
0119  *  of Main. */
0120 template <>
0121 struct BaseClassTrait<Main,1>: public ClassTraitsType {
0122   /** Typedef of the first base class of Main. */
0123   typedef int NthBase;
0124 };
0125 
0126 /** This template specialization informs ThePEG about the name of the
0127  *  Main class. */
0128 template <>
0129 struct ClassTraits<Main>: public ClassTraitsBase<Main> {
0130   /** Return a platform-independent class name */
0131   static string className() { return "ThePEG::Main"; }
0132 
0133 };
0134 
0135 /** @endcond */
0136 
0137 }
0138 
0139 #endif /* THEPEG_Main_H */