thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
ThePEG::MultiEventGenerator Class Reference

The MultiEventGenerator class is derived from the EventGenerator class and is capable of making several runs with a pre-defined set of parameter and switch values. More...

#include <MultiEventGenerator.h>

Inheritance diagram for ThePEG::MultiEventGenerator:

Public Member Functions

virtual void addTag (string tag)
 Append a tag to the run name. More...
 
Standard constructors and destructors.
 MultiEventGenerator ()
 Default constructor.
 
virtual ~MultiEventGenerator ()
 Destructor.
 
Functions used by the persistent I/O system.
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently. More...
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently. More...
 
- Public Member Functions inherited from ThePEG::EventGenerator
 EventGenerator ()
 Default constructor.
 
 EventGenerator (const EventGenerator &)
 Copy-constructor.
 
virtual ~EventGenerator ()
 Destructor.
 
tSMPtr standardModel () const
 Return a pointer to the standard model parameters.
 
tStrategyPtr strategy () const
 Return a pointer to the strategy object containing a set of non-default particles to use.
 
tEHPtr currentEventHandler () const
 Get the currently active EventHandler.
 
void currentEventHandler (tEHPtr eh)
 Set the currently active EventHandler.
 
tStepHdlPtr currentStepHandler () const
 Get the currently active step handler.
 
void currentStepHandler (tStepHdlPtr sh)
 Set the currently active step handler.
 
tEHPtr eventHandler () const
 Return a pointer to the EventHandler.
 
AnalysisVectoranalysisHandlers ()
 Return the vector of analysis objects to be used in the run.
 
tHistFacPtr histogramFactory () const
 Return a pointer to an associated factory objects for handling histograms to be used by AnalysisHandlers.
 
tEvtManipPtr manipulator () const
 Return the EventManipulator used in the run.
 
void initialize (bool initOnly=false)
 Initialize this generator. More...
 
void go (long next=1, long maxevent=-1, bool tics=false)
 Run this EventGenerator session. More...
 
EventPtr shoot ()
 Generate one event. More...
 
EventPtr generateEvent (Event &event)
 Finish generating an event which has already been partially constructed from the outside. More...
 
EventPtr generateEvent (Step &step)
 Finish generating an event starting from a step which has already been partially constructed from the outside. More...
 
void finalize ()
 Indicate that the run has ended and call finish() for all objects including this one. More...
 
bool loadMain (string file)
 Dynamically load the Main class in the given file, making it run its Init() method where it may use this EventGenerator. More...
 
virtual Energy maximumCMEnergy () const
 Return the maximum center of mass energy possible for an event. More...
 
long currentEventNumber () const
 The number of the event currently being generated.
 
tcEventPtr currentEvent () const
 Return the event being generated.
 
virtual void dump () const
 Dump the full state of the current run - including the number of generated events, so that it can be fully continued from this point.
 
void use (const Interfaced &i)
 Register a given object as used. More...
 
void setSeed (long seed)
 Set the random seed for the global random number generator. More...
 
void logWarning (const Exception &)
 Log a given exception.
 
long N () const
 The number of events to be generated in this run.
 
CrossSection histogramScale () const
 Histogram scale. More...
 
CrossSection integratedXSec () const
 The total integrated cross section of the processes generated in this run.
 
CrossSection integratedXSecErr () const
 The error estimate for the total integrated cross section of the processes generated in this run.
 
double sumWeights () const
 The sum of all weight of the events generated so far.
 
string filename () const
 The base filename used in this run. More...
 
string runName () const
 Return the name assigned to this run. More...
 
string path () const
 The directory in which the filename() is located.
 
bool useStdOut () const
 Has the generator been asked to redirect everything to standard output?
 
void openOutputFiles ()
 Open all ouput files.
 
void flushOutputFile ()
 Flush the content of the internal output string stream to the .out file.
 
void closeOutputFiles ()
 Close all ouput files.
 
ofstream & outfile ()
 Return a reference to the output file stream.
 
ofstream & logfile ()
 Return a reference to the log file stream.
 
ofstream & reffile ()
 Return a reference to the reference file stream. More...
 
ostream & out ()
 This stream should be used for output of information and statistics of an EventGenerator run in the finish() phase, after the actual generation has finished. More...
 
ostream & log ()
 Return a reference to the stream connected to the file for logging information. More...
 
ostream & misc ()
 Return a reference to a stream to be used to redirect cout for external modules which prints out messages there. More...
 
ostream & ref ()
 Return a reference to the stream connected to the filea for references from used objects. More...
 
const ObjectSet & objects () const
 Return the set of objects used in this run.
 
const ObjectMap & objectMap () const
 Return the map of objects used in this run indexed by their name.
 
template<typename T >
Ptr< T >::pointer getPtr (const T &) const
 Return a garbage collected pointer to a given object. More...
 
IBPtr getPointer (string name) const
 Return a pointer to an object present in this run given its full name. More...
 
template<typename T >
Ptr< T >::pointer getObject (string name) const
 Return a pointer to an object of type T present in this run given its full name. More...
 
template<typename T >
Ptr< T >::pointer getDefault () const
 Return the default object for class T. More...
 
PPtr getParticle (PID id) const
 Create a particle instance corresponding to the given id number.
 
PDPtr getParticleData (PID id) const
 Return a pointer to the ParticleData object corresponding to the given id number.
 
const MatcherSet & matchers () const
 Return a reference to the complete list of matchers in this generator.
 
const ParticleMap & particles () const
 Return a reference to the complete map of particle data objects in this generator, indexed by their id numbers.
 
const ObjectSet & used () const
 Return a reference to the set of objects which have been registered as used during the current run.
 
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently. More...
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently. More...
 
const vector< string > & globalLibraries () const
 The global libraries needed for objects used in this EventGenerator.
 
bool preinitRegister (IPtr obj, string fullname)
 Register a new object to be included in the run currently being initialized. More...
 
IPtr preinitCreate (string classname, string fullname, string libraries="")
 Create a new Interfaced object to be used in the run being initialized. More...
 
string preinitInterface (string fullname, string ifcname, string cmd, string value)
 Manipulate an interface of an Interfaced object. More...
 
string preinitInterface (string fullname, string ifcname, int index, string cmd, string value)
 Manipulate an interface of vector type (RefVector or ParVector) of an Interfaced object. More...
 
string preinitInterface (IPtr obj, string ifcname, string cmd, string value)
 Manipulate an interface of an Interfaced object. More...
 
string preinitInterface (IPtr obj, string ifcname, int index, string cmd, string value)
 Manipulate an interface of vector type (RefVector or ParVector) of an Interfaced object. More...
 
bool preinitRemove (IPtr obj)
 Remove the object.
 
tDMPtr findDecayMode (string tag) const
 Find a decaymode given a decay tag. More...
 
tDMPtr preinitCreateDecayMode (string tag)
 Create a decay mode according to the given tag. More...
 
tPDPtr findParticle (string pdgname) const
 Find a particle in this run, using its PDG name. More...
 
tPMPtr findMatcher (string name) const
 Find a matcher in this run given its name. More...
 
- Public Member Functions inherited from ThePEG::Interfaced
virtual ~Interfaced ()
 Empty virtual destructor.
 
virtual bool defaultInit ()
 Functions which are to be used during the actual event generation, after the setup is complete. More...
 
PPtr getParticle (PID) const
 Create a new Particle instance given a id number.
 
PDPtr getParticleData (PID) const
 Return a pointer to the ParticleData object corresponding to the given id number.
 
bool used () const
 Returns true if this object has actally been used.
 
void useMe () const
 Should be called to indicate that this object has actually been used.
 
tEGPtr generator () const
 Return a pointer to the EventGenerator controlling the run. More...
 
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently. More...
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently. More...
 
- Public Member Functions inherited from ThePEG::InterfacedBase
virtual ~InterfacedBase ()
 The virtual (empty) destructor;.
 
string fullName () const
 Returns the full name of this object including its path, e.g. More...
 
string name () const
 Returns the name of this object, without the path.
 
string path () const
 Returns the path to this object including the trailing '/'. More...
 
string comment () const
 Returns a comment assigned to this object.
 
void setup (istream &is)
 Read setup info from a standard istream is. More...
 
virtual void debugme () const
 Print out debugging information for this object on std::cerr. More...
 
void update ()
 Calls the doupdate() function with recursion prevention.
 
void init ()
 Calls the doinit() function with recursion prevention.
 
virtual bool preInitialize () const
 Return true if this object needs to be initialized before all other objects (except those for which this function also returns true). More...
 
void initrun ()
 Calls the doinitrun() function with recursion prevention.
 
void finish ()
 Calls the dofinish() function with recursion prevention.
 
void touch ()
 This function should be called every time something in this object has changed in a way that a sanity check with update() is needed.
 
void reset ()
 Set the state of this object to uninitialized.
 
void clear ()
 Calls reset() and unTouch().
 
InitState state () const
 Return the state of initialization of this object.
 
bool locked () const
 Return true if the BaseRepository is not allowed to change the state of this object.
 
bool touched () const
 Return true if the state of this object has been changed since the last call to update().
 
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently. More...
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently. More...
 
- Public Member Functions inherited from ThePEG::Base
virtual ~Base ()
 The virtual destructor.
 
void debug () const
 Print out debugging information for this object on std::cerr. More...
 
- Public Member Functions inherited from ThePEG::Pointer::ReferenceCounted
CounterType referenceCount () const
 Return the reference count.
 
- Public Member Functions inherited from ThePEG::Named
 Named (const string &newName=string())
 Constructor with name.
 
 Named (const Named &)=default
 Explicit default copy-constructor (too avoid compiler warnings)
 
const string & name () const
 Return name.
 
bool operator== (const Named &other) const
 Test for equality.
 
bool operator< (const Named &other) const
 Lexicographical comparison.
 

Static Public Member Functions

static void Init ()
 Standard Init function used to initialize the interfaces.
 
- Static Public Member Functions inherited from ThePEG::EventGenerator
static void Init ()
 Standard Init function used to initialize the interface.
 
- Static Public Member Functions inherited from ThePEG::Interfaced
static void Init ()
 Standard Init function.
 
- Static Public Member Functions inherited from ThePEG::InterfacedBase
static void Init ()
 Standard Init function.
 
- Static Public Member Functions inherited from ThePEG::Base
static void Init ()
 The standard Init function used to initialize the interfaces. More...
 

Protected Member Functions

string heading (long, const vector< const InterfaceBase *> &, string) const
 return a header for this sub-run.
 
RandomGeneratorrandomArg () const
 A separate random number generator to be used for generating random parameter values (to ensure reproducable sequences).
 
Public virtual functions required by the base class.
virtual void doGo (long next, long maxevent, bool tics)
 Run this EventGenerator session. More...
 
Functions used by the Command<MultiEventGenerator>

interfaces to set up the different parameters of the runs.

string addInterface (string)
 Used to add an interface of an object which should be used with a set of different values. More...
 
string addRndInterface (string)
 Used to add an interface of an object a random value each run. More...
 
string addInterface (string, bool rnd)
 Helper function for addInterface(string) and addRndInterface(string).
 
string removeInterface (string)
 Used to remove an interface of an object which should be used with a set of different values. More...
 
Clone Methods.
virtual IBPtr clone () const
 Make a simple clone of this object. More...
 
virtual IBPtr fullclone () const
 Make a clone of this object, possibly modifying the cloned object to make it sane. More...
 
Standard Interfaced functions.
virtual void rebind (const TranslationMap &trans)
 Rebind pointer to other Interfaced objects. More...
 
virtual IVector getReferences ()
 Return a vector of all pointers to Interfaced objects used in this object. More...
 
- Protected Member Functions inherited from ThePEG::EventGenerator
void checkSignalState ()
 Check if there has been an interrupt signal from the OS. More...
 
RandomGeneratorrandom () const
 Return a reference to the default RandomGenerator object in this run.
 
void setup (string newRunName, ObjectSet &newObjects, ParticleMap &newParticles, MatcherSet &newMatchers)
 Finish the setup of an event generator run. More...
 
void printException (const Exception &)
 Print the message of an exception to the log file.
 
bool logException (const Exception &, tcEventPtr)
 Log a given exception.
 
void N (long n)
 Set number of events to be generated.
 
void runName (string f)
 Set the name of this run.
 
ObjectSet & objects ()
 Return the set of all objects to be used in this run.
 
ObjectMap & objectMap ()
 Return the map of all objects to be used in this run indexed by their name.
 
void generateReferences ()
 Print out the .tex file with descriptions of and references to all models used in the run.
 
int count (const Exception &)
 Increase and return the count for the given exception.
 
virtual void doInitialize (bool initOnly=false)
 Initialize this generator. More...
 
virtual EventPtr doShoot ()
 Generate one event. More...
 
void tic (long currev=0, long totev=0) const
 Write out the number of events generated and the elapsed time in suitable periods.
 
virtual EventPtr doGenerateEvent (tEventPtr)
 Finish generating an event constructed from the outside. More...
 
virtual EventPtr doGenerateEvent (tStepPtr)
 Finish generating an event starting from a Step constructed from the outside. More...
 
virtual void doinit ()
 Initialize this object after the setup phase before saving an EventGenerator to disk. More...
 
virtual void doinitrun ()
 Initialize this object. More...
 
virtual void dofinish ()
 Finalize this object. More...
 
void finally ()
 Additional things to do at the very end after the (do)finish(), such as closing output files etc.
 
- Protected Member Functions inherited from ThePEG::Interfaced
void reporeg (IBPtr object, string name) const
 Register the given object in the Repository with the given name in a subdirectory with the same name as this object. More...
 
template<typename PtrT >
bool setDefaultReference (PtrT &ptr, string classname, string objectname)
 If the pointer, ptr, to an object is not set, create an object of class classname and register it with the Repository with the given objectname in a sib-directory with the same name as this object.
 
 Interfaced ()
 Protected default constructor.
 
 Interfaced (const string &newName)
 Protected constructor taking a name as argument.
 
 Interfaced (const Interfaced &i)
 Protected copy-constructor.
 
void setGenerator (tEGPtr generator)
 Protected function to reset the generator pointer, required for automatic decayer generation in Herwig++ BSM models.
 
- Protected Member Functions inherited from ThePEG::InterfacedBase
 InterfacedBase ()
 Protected default constructor.
 
 InterfacedBase (string newName)
 Protected constructor with the name given as argument.
 
 InterfacedBase (const InterfacedBase &i)
 Protected copy-constructor.
 
virtual void readSetup (istream &is)
 Read setup info from a standard istream is. More...
 
virtual void doupdate ()
 Check sanity of the object during the setup phase. More...
 
- Protected Member Functions inherited from ThePEG::Pointer::ReferenceCounted
 ReferenceCounted ()
 Default constructor.
 
 ReferenceCounted (const ReferenceCounted &)
 Copy-constructor.
 
ReferenceCountedoperator= (const ReferenceCounted &)
 Assignment.
 
- Protected Member Functions inherited from ThePEG::Named
const Namedoperator= (const Named &other)
 Assignment.
 
const string & name (const string &newName)
 Set new name.
 

Private Types

typedef vector< string > StringVector
 A vector of character strings. More...
 

Private Member Functions

MultiEventGeneratoroperator= (const MultiEventGenerator &)=delete
 Private and non-existent assignment operator.
 

Private Attributes

IVector theObjects
 The objects for which there are different interface settings.
 
StringVector theInterfaces
 The interfaces to be modified for the corresponding objects in theObjects.
 
StringVector thePosArgs
 If the there are positional arguments to theInterfaces these are specified here.
 
vector< StringVectortheValues
 The arguments to be used for each of theInterfaces.
 
int firstSubrun
 If non zero, the first subrun to be considered.
 
int lastSubrun
 If non zero, the last subrun to be considered.
 
RanGenPtr theSeparateRandom
 A separate random number generator to be used for generating random parameter values (to ensure reproducable sequences).
 

Static Private Attributes

static ClassDescription< MultiEventGeneratorinitMultiEventGenerator
 Describe a concrete class with persistent data.
 

Additional Inherited Members

- Public Types inherited from ThePEG::EventGenerator
typedef map< pair< string, Exception::Severity >, int > ExceptionMap
 A map of integers giving the number of times an exception of the key type has been thrown. More...
 
- Public Types inherited from ThePEG::InterfacedBase
enum  InitState { initializing = -1, uninitialized = 0, initialized = 1, runready = 2 }
 Enumeration reflecting the state of an InterfacedBase object. More...
 
- Public Types inherited from ThePEG::Pointer::ReferenceCounted
typedef unsigned int CounterType
 The integer type used for counting.
 
- Public Attributes inherited from ThePEG::Pointer::ReferenceCounted
const unsigned long uniqueId
 The unique ID. More...
 
- Static Protected Member Functions inherited from ThePEG::Interfaced
static void registerRepository (IBPtr)
 Register an Interfaced object with the Repository.
 
static void registerRepository (IBPtr, string newName)
 Register an Interfaced object with the Repository, giving it a name.
 
- Protected Attributes inherited from ThePEG::EventGenerator
long ieve
 The current event number;.
 
double weightSum
 The sum of the weights of the events produced so far.
 
int theDebugLevel
 The debug level.
 

Detailed Description

The MultiEventGenerator class is derived from the EventGenerator class and is capable of making several runs with a pre-defined set of parameter and switch values.

With the Command<MultiEventGenerator> interface AddInterface set of parameters for an included object can be specified as eg. object:interface arg1, arg2, arg3 .... The event generator will then be run once with the specified objects interface set to arg1, then once with arg2 etc. If several AddInterface commands are given the event generator will be run once for each possible combination arguments to object interfaces.

See also
EventGenerator

Definition at line 34 of file MultiEventGenerator.h.

Member Typedef Documentation

◆ StringVector

typedef vector<string> ThePEG::MultiEventGenerator::StringVector
private

A vector of character strings.

Definition at line 181 of file MultiEventGenerator.h.

Member Function Documentation

◆ addInterface()

string ThePEG::MultiEventGenerator::addInterface ( string  )
protected

Used to add an interface of an object which should be used with a set of different values.

The argument should be given as "object:interface arg1, arg2, ..."

Referenced by MultiEventGenerator().

◆ addRndInterface()

string ThePEG::MultiEventGenerator::addRndInterface ( string  )
protected

Used to add an interface of an object a random value each run.

The argument should be given as "object:interface N min max mean width"

Referenced by MultiEventGenerator().

◆ addTag()

virtual void ThePEG::MultiEventGenerator::addTag ( string  tag)
virtual

Append a tag to the run name.

Derived classes may put special meaning to the tags. In this case a tag on the form #n will select only subrun number n, while #n-m will select subruns n through m.

Reimplemented from ThePEG::EventGenerator.

Referenced by MultiEventGenerator().

◆ clone()

virtual IBPtr ThePEG::MultiEventGenerator::clone ( ) const
protectedvirtual

Make a simple clone of this object.

Returns
a pointer to the new object.

Reimplemented from ThePEG::EventGenerator.

Referenced by randomArg().

◆ doGo()

virtual void ThePEG::MultiEventGenerator::doGo ( long  next,
long  maxevent,
bool  tics 
)
protectedvirtual

Run this EventGenerator session.

Is called from EventGenerator::go(long,long,bool).

Reimplemented from ThePEG::EventGenerator.

Referenced by MultiEventGenerator().

◆ fullclone()

virtual IBPtr ThePEG::MultiEventGenerator::fullclone ( ) const
protectedvirtual

Make a clone of this object, possibly modifying the cloned object to make it sane.

Returns
a pointer to the new object.

Reimplemented from ThePEG::EventGenerator.

Referenced by randomArg().

◆ getReferences()

virtual IVector ThePEG::MultiEventGenerator::getReferences ( )
protectedvirtual

Return a vector of all pointers to Interfaced objects used in this object.

Returns
a vector of pointers.

Reimplemented from ThePEG::InterfacedBase.

Referenced by randomArg().

◆ persistentInput()

void ThePEG::MultiEventGenerator::persistentInput ( PersistentIStream is,
int  version 
)

Function used to read in object persistently.

Parameters
isthe persistent input stream read from.
versionthe version number of the object when written.

Referenced by randomArg().

◆ persistentOutput()

void ThePEG::MultiEventGenerator::persistentOutput ( PersistentOStream os) const

Function used to write out object persistently.

Parameters
osthe persistent output stream written to.

Referenced by randomArg().

◆ rebind()

virtual void ThePEG::MultiEventGenerator::rebind ( const TranslationMap trans)
protectedvirtual

Rebind pointer to other Interfaced objects.

Called in the setup phase after all objects used in an EventGenerator has been cloned so that the pointers will refer to the cloned objects afterwards.

Parameters
transa TranslationMap relating the original objects to their respective clones.
Exceptions
RebindExceptionif no cloned object was found for a given pointer.

Reimplemented from ThePEG::InterfacedBase.

Referenced by randomArg().

◆ removeInterface()

string ThePEG::MultiEventGenerator::removeInterface ( string  )
protected

Used to remove an interface of an object which should be used with a set of different values.

The argument should be given as "object:interface arg1, arg2, ..."

Referenced by MultiEventGenerator().


The documentation for this class was generated from the following file: