thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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

Standard constructors and destructors.
 MultiEventGenerator ()
 Default constructor.
 
virtual ~MultiEventGenerator ()
 Destructor.
 
virtual void addTag (string tag)
 Append a tag to the run name.
 
- 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.
 
void go (long next=1, long maxevent=-1, bool tics=false)
 Run this EventGenerator session.
 
EventPtr shoot ()
 Generate one event.
 
EventPtr generateEvent (Event &event)
 Finish generating an event which has already been partially constructed from the outside.
 
EventPtr generateEvent (Step &step)
 Finish generating an event starting from a step which has already been partially constructed from the outside.
 
void finalize ()
 Indicate that the run has ended and call finish() for all objects including this one.
 
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.
 
virtual Energy maximumCMEnergy () const
 Return the maximum center of mass energy possible for an event.
 
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.
 
void setSeed (long seed)
 Set the random seed for the global random number generator.
 
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.
 
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.
 
string runName () const
 Return the name assigned to this run.
 
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.
 
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.
 
ostream & log ()
 Return a reference to the stream connected to the file for logging information.
 
ostream & misc ()
 Return a reference to a stream to be used to redirect cout for external modules which prints out messages there.
 
ostream & ref ()
 Return a reference to the stream connected to the filea for references from used objects.
 
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.
 
IBPtr getPointer (string name) const
 Return a pointer to an object present in this run given its full name.
 
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.
 
template<typename T >
Ptr< T >::pointer getDefault () const
 Return the default object for class T.
 
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.
 
bool preinitRegister (IPtr obj, string fullname)
 Register a new object to be included in the run currently being initialized.
 
IPtr preinitCreate (string classname, string fullname, string libraries="")
 Create a new Interfaced object to be used in the run being initialized.
 
string preinitInterface (string fullname, string ifcname, string cmd, string value)
 Manipulate an interface of an Interfaced object.
 
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.
 
string preinitInterface (IPtr obj, string ifcname, string cmd, string value)
 Manipulate an interface of an Interfaced object.
 
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.
 
bool preinitRemove (IPtr obj)
 Remove the object.
 
tDMPtr findDecayMode (string tag) const
 Find a decaymode given a decay tag.
 
tDMPtr preinitCreateDecayMode (string tag)
 Create a decay mode according to the given tag.
 
tPDPtr findParticle (string pdgname) const
 Find a particle in this run, using its PDG name.
 
tPMPtr findMatcher (string name) const
 Find a matcher in this run given its name.
 
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently.
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently.
 
const vector< string > & globalLibraries () const
 The global libraries needed for objects used in this EventGenerator.
 
- 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.
 
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.
 
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently.
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently.
 
- 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.
 
string name () const
 Returns the name of this object, without the path.
 
string path () const
 Returns the path to this object including the trailing '/'.
 
string comment () const
 Returns a comment assigned to this object.
 
void setup (istream &is)
 Read setup info from a standard istream is.
 
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).
 
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.
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently.
 
virtual void debugme () const
 Print out debugging information for this object on std::cerr.
 
- 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.
 
virtual void debugme () const
 Print out debugging information for this object on std::cerr.
 
- 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.
 

Protected Member Functions

Public virtual functions required by the base class.
virtual void doGo (long next, long maxevent, bool tics)
 Run this EventGenerator session.
 
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.
 
string addRndInterface (string)
 Used to add an interface of an object a random value each run.
 
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.
 
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).
 
Clone Methods.
virtual IBPtr clone () const
 Make a simple clone of this object.
 
virtual IBPtr fullclone () const
 Make a clone of this object, possibly modifying the cloned object to make it sane.
 
- Protected Member Functions inherited from ThePEG::EventGenerator
virtual void doinit ()
 Initialize this object after the setup phase before saving an EventGenerator to disk.
 
virtual void doinitrun ()
 Initialize this object.
 
virtual void dofinish ()
 Finalize this object.
 
void finally ()
 Additional things to do at the very end after the (do)finish(), such as closing output files etc.
 
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.
 
void checkSignalState ()
 Check if there has been an interrupt signal from the OS.
 
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.
 
virtual void doInitialize (bool initOnly=false)
 Initialize this generator.
 
virtual EventPtr doShoot ()
 Generate one event.
 
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.
 
virtual EventPtr doGenerateEvent (tStepPtr)
 Finish generating an event starting from a Step constructed from the outside.
 
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.
 
- 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.
 
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
virtual void readSetup (istream &is)
 Read setup info from a standard istream is.
 
virtual void doupdate ()
 Check sanity of the object during the setup phase.
 
 InterfacedBase ()
 Protected default constructor.
 
 InterfacedBase (string newName)
 Protected constructor with the name given as argument.
 
 InterfacedBase (const InterfacedBase &i)
 Protected copy-constructor.
 
- 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.
 

Standard Interfaced functions.

typedef vector< string > StringVector
 A vector of character strings.
 
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 ClassDescription< MultiEventGeneratorinitMultiEventGenerator
 Describe a concrete class with persistent data.
 
virtual void rebind (const TranslationMap &trans)
 Rebind pointer to other Interfaced objects.
 
virtual IVector getReferences ()
 Return a vector of all pointers to Interfaced objects used in this object.
 
MultiEventGeneratoroperator= (const MultiEventGenerator &)=delete
 Private and non-existent assignment operator.
 

Functions used by the persistent I/O system.

void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently.
 
void persistentInput (PersistentIStream &is, int version)
 Function used to read in object persistently.
 
static void Init ()
 Standard Init function used to initialize the interfaces.
 

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.
 
- 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.
 
- 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.
 
- Public Attributes inherited from ThePEG::Pointer::ReferenceCounted
const unsigned long uniqueId
 The unique ID.
 
- 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.

Constructor & Destructor Documentation

◆ MultiEventGenerator()

ThePEG::MultiEventGenerator::MultiEventGenerator ( )
inline

Default constructor.

Definition at line 43 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, ..."

◆ 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"

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ persistentOutput()

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

Function used to write out object persistently.

Parameters
osthe persistent output stream written to.

◆ randomArg()

RandomGenerator & ThePEG::MultiEventGenerator::randomArg ( ) const
inlineprotected

A separate random number generator to be used for generating random parameter values (to ensure reproducable sequences).

Definition at line 110 of file MultiEventGenerator.h.

References ThePEG::EventGenerator::random(), and theSeparateRandom.

◆ 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.

◆ 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, ..."

Member Data Documentation

◆ firstSubrun

int ThePEG::MultiEventGenerator::firstSubrun
private

If non zero, the first subrun to be considered.

Definition at line 208 of file MultiEventGenerator.h.

◆ initMultiEventGenerator

ClassDescription<MultiEventGenerator> ThePEG::MultiEventGenerator::initMultiEventGenerator
staticprivate

Describe a concrete class with persistent data.

Definition at line 226 of file MultiEventGenerator.h.

◆ lastSubrun

int ThePEG::MultiEventGenerator::lastSubrun
private

If non zero, the last subrun to be considered.

Definition at line 213 of file MultiEventGenerator.h.

◆ theInterfaces

StringVector ThePEG::MultiEventGenerator::theInterfaces
private

The interfaces to be modified for the corresponding objects in theObjects.

Definition at line 192 of file MultiEventGenerator.h.

◆ theObjects

IVector ThePEG::MultiEventGenerator::theObjects
private

The objects for which there are different interface settings.

Definition at line 186 of file MultiEventGenerator.h.

◆ thePosArgs

StringVector ThePEG::MultiEventGenerator::thePosArgs
private

If the there are positional arguments to theInterfaces these are specified here.

Definition at line 198 of file MultiEventGenerator.h.

◆ theSeparateRandom

RanGenPtr ThePEG::MultiEventGenerator::theSeparateRandom
private

A separate random number generator to be used for generating random parameter values (to ensure reproducable sequences).

Definition at line 219 of file MultiEventGenerator.h.

Referenced by randomArg().

◆ theValues

vector<StringVector> ThePEG::MultiEventGenerator::theValues
private

The arguments to be used for each of theInterfaces.

Definition at line 203 of file MultiEventGenerator.h.


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