ThePEG is hosted by Hepforge, IPPP Durham
ThePEG  2.1.0
ThePEG::EventGenerator Class Reference

The EventGenerator class manages a whole event generator run. More...

#include <EventGenerator.h>

Inheritance diagram for ThePEG::EventGenerator:

Public Types

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 Member Functions

virtual void addTag (string tag)
 Append a tag to the run name. More...
 
Standard constructors and destructors.
 EventGenerator ()
 Default constructor.
 
 EventGenerator (const EventGenerator &)
 Copy-constructor.
 
virtual ~EventGenerator ()
 Destructor.
 
Access special objects in the run.
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.
 
Main functions to controll 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.
 
Functions for accessing output files.
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...
 
Access objects included in this run.
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.
 
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...
 
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. 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.
 
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 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

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.
 
Main virtual functions to be overridden by sub-classes.
virtual void doGo (long next, long maxevent, bool tics)
 Run this EventGenerator session. More...
 
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...
 
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 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...
 
virtual IVector getReferences ()
 Return a vector of all pointers to Interfaced objects used in this object. More...
 
virtual void rebind (const TranslationMap &)
 Rebind pointer to other Interfaced objects. 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.
 

Protected Attributes

long ieve
 The current event number;.
 
double weightSum
 The sum of the weights of the events produced so far.
 
int theDebugLevel
 The debug level.
 

Private Member Functions

const vector< IPtr > & defaultObjects () const
 Return the vector of default objects.
 
ParticleMap & localParticles ()
 Access the special particles used in this generator. More...
 
const ParticleMap & localParticles () const
 Access the special particles used in this generator. More...
 
void path (string f)
 Set the directory where the output files will be stored.
 
void strategy (StrategyPtr)
 Set a pointer to the strategy object containing a set of non-default particles to use.
 
string doSaveRun (string)
 Isolate, initialize and save this generator to a file.
 
string doMakeRun (string)
 Isolate and initialize this generator.
 
void setLocalParticles (PDPtr pd, int)
 Utility function for the interface.
 
void insLocalParticles (PDPtr pd, int)
 Utility function for the interface.
 
void delLocalParticles (int place)
 Utility function for the interface.
 
vector< PDPtrgetLocalParticles () const
 Utility function for the interface.
 
void setPath (string newPath)
 Utility function for the interface.
 
string defPath () const
 Utility function for the interface.
 
EventGeneratoroperator= (const EventGenerator &)
 Private and non-existent assignment operator.
 

Private Attributes

vector< IPtrtheDefaultObjects
 A vector of default objects.
 
ParticleMap theLocalParticles
 Map of non-default particles used in this EventGenerator.
 
SMPtr theStandardModel
 Pointer to an object containing standard model parameters.
 
StrategyPtr theStrategy
 Pointer to a strategy object with other non-default particles to be used in this EventGenerator.
 
RanGenPtr theRandom
 Pointer to the default RandomGenerator to be used in this run.
 
EHPtr theEventHandler
 Pointer to the event handler used to generate the indivudual events.
 
AnalysisVector theAnalysisHandlers
 A vector of all analysis handlers to be called after each event.
 
HistFacPtr theHistogramFactory
 A pointer to an associated factory objects for handling histograms to be used by AnalysisHandlers.
 
EvtManipPtr theEventManipulator
 A pointer to an optional event manipulator object.
 
string thePath
 The directory where the input and output files resides.
 
string theRunName
 The name of this run.
 
ofstream theOutfile
 A reference to the output file stream.
 
ofstream theLogfile
 A reference to the log file stream.
 
ofstream theReffile
 A reference to the reference file stream.
 
ostringstream theMiscStream
 A stream to be used to redirect cout for external modules which prints out messages there. More...
 
ostringstream theOutStream
 A string stream used as a buffer for messages written to the .out file. More...
 
string theOutFileName
 Remember the name of the file where the output should be sent. More...
 
long theNumberOfEvents
 Number of events to be generated in this run.
 
ObjectSet theObjects
 The set of all objects to be used in this run.
 
ObjectMap theObjectMap
 All objects to be used in this run mapped to their name.
 
ParticleMap theParticles
 The map of all particles to be used in this run, indexed by the id number.
 
PDVector theQuickParticles
 A vector of particles indexed by the id number for quick access. More...
 
long theQuickSize
 Only particles with id number less than theQuickSize are available in theQuickParticles.
 
bool preinitializing
 A flag to tell if we are in the pre-initialization phase where objects with preInitialize() functions returning true are initialized before others.
 
MatcherSet theMatchers
 The set of all matchers to be used in this run.
 
ObjectSet usedObjects
 The set of objects which have actually been used in this run.
 
int logNonDefault
 List all modified interfaces in the log file. More...
 
int printEvent
 If the debug level is higher than 0, print the first 'printEvent' events to the logfile.
 
long dumpPeriod
 If the debug level is higher than 0, dump the complete state of this run to the default dump file every 'dumpPeriod' events. More...
 
bool keepAllDumps
 If this flag is true, keep all dump files of the run, labelled by event number.
 
long debugEvent
 If the debug level is higher than 0, step up to the highest debug level just before the event with number debugEvent is performed.
 
int maxWarnings
 The maximum number of warnings reported of each type. More...
 
int maxErrors
 The maximum number of warnings and errors reported of each type. More...
 
ExceptionMap theExceptions
 A map of all Exceptions which have been caught by the event generator and the number of time each exception type has been caught.
 
UseRandomtheCurrentRandom
 The UseRandom object constructed for the duration of an EventGenerator run so that the default random number generator always can be accessed through the static methods of the UseRandom class.
 
CurrentGeneratortheCurrentGenerator
 The CurrentGenerator object constructed for the duration of an EventGenerator run so that the default event generator always can be accessed through the static methods of the CurrentGenerator class.
 
tEHPtr theCurrentEventHandler
 The currently active EventHandler.
 
tStepHdlPtr theCurrentStepHandler
 The currently active step handler.
 
bool useStdout
 Whether to use files or stdout for logging and output.
 
bool theIntermediateOutput
 Whether to use a modified event number count.
 
vector< string > theGlobalLibraries
 The global libraries needed for objects used in this EventGenerator.
 

Static Private Attributes

static ClassDescription< EventGeneratorinitEventGenerator
 Describe an abstract class with persistent data.
 

Friends

class Repository
 The Repository is a friend. More...
 

The following functions may be called by objects belonging

to this event generator during the initialization phase (in the doinit() function).

It is typically used by objects which need to introduce other Interfaced objects depending the parameters of the StandardModel object used. Note that objects which use these functions MUST override the preInitialize() function to return true, otherwize the whole initialization procedure may be corrupted.

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...
 
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...
 
DMPtr constructDecayMode (string &tag)
 Used internally by preinitCreateDecayMode();.
 

Additional Inherited Members

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

Detailed Description

The EventGenerator class manages a whole event generator run.

It keeps a list of all Interfaced objects which are needed for a particular run (these objects each have a pointer back to the EventGenerator). Some objects are special, such as a default RandomGenerator object, a StandardModelBase object and a Strategy object and lists of ParticleData and MatcherBase objects used in the run.

The EventGenerator also manages information about the run such as the exceptions being thrown, files to write output and error messages to, etc.

There are three main external member functions:
go() generates a specified number of events and exits.

shoot() generates one Event and returns it.

generateEvent() takes an initial Step or a partially generated Event as argument and generates subsequent steps defined in the generator.

doShoot() is a virtual function called by shoot() and may be overridden in sub-classes.

doGenrateEvent() is a virtual function called by generateEvent() and may to be overridden in sub-classes.

See also
The interfaces defined for EventGenerator.
Interfaced
RandomGenerator
StandardModelBase
Strategy
ParticleData
Event
Step
FullEventGenerator

Definition at line 68 of file EventGenerator.h.

Member Typedef Documentation

◆ ExceptionMap

A map of integers giving the number of times an exception of the key type has been thrown.

Definition at line 79 of file EventGenerator.h.

Member Function Documentation

◆ addTag()

virtual void ThePEG::EventGenerator::addTag ( string  tag)
inlinevirtual

Append a tag to the run name.

Derived classes may put special meaning to the tags.

Reimplemented in ThePEG::MultiEventGenerator.

Definition at line 542 of file EventGenerator.h.

References runName().

◆ checkSignalState()

void ThePEG::EventGenerator::checkSignalState ( )
protected

Check if there has been an interrupt signal from the OS.

If that's the case, finalize() is called

Referenced by used().

◆ clone()

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

Make a simple clone of this object.

Returns
a pointer to the new object.

Implements ThePEG::InterfacedBase.

Reimplemented in ThePEG::MultiEventGenerator.

Referenced by globalLibraries().

◆ dofinish()

virtual void ThePEG::EventGenerator::dofinish ( )
protectedvirtual

Finalize this object.

Called in the run phase just after a run has ended. Used eg. to write out statistics.

Reimplemented from ThePEG::InterfacedBase.

Referenced by globalLibraries().

◆ doGenerateEvent() [1/2]

virtual EventPtr ThePEG::EventGenerator::doGenerateEvent ( tEventPtr  )
protectedvirtual

Finish generating an event constructed from the outside.

Is called by generateEvent(tEventPtr).

Referenced by random().

◆ doGenerateEvent() [2/2]

virtual EventPtr ThePEG::EventGenerator::doGenerateEvent ( tStepPtr  )
protectedvirtual

Finish generating an event starting from a Step constructed from the outside.

Is called by generateEvent(tStepPtr).

◆ doGo()

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

Run this EventGenerator session.

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

Reimplemented in ThePEG::MultiEventGenerator.

Referenced by random().

◆ doinit()

virtual void ThePEG::EventGenerator::doinit ( )
protectedvirtual

Initialize this object after the setup phase before saving an EventGenerator to disk.

Exceptions
InitExceptionif object could not be initialized properly.

Reimplemented from ThePEG::InterfacedBase.

Referenced by globalLibraries().

◆ doInitialize()

virtual void ThePEG::EventGenerator::doInitialize ( bool  initOnly = false)
protectedvirtual

Initialize this generator.

Is called from initialize().

Referenced by random().

◆ doinitrun()

virtual void ThePEG::EventGenerator::doinitrun ( )
protectedvirtual

Initialize this object.

Called in the run phase just before a run begins.

Reimplemented from ThePEG::InterfacedBase.

Referenced by globalLibraries().

◆ doShoot()

virtual EventPtr ThePEG::EventGenerator::doShoot ( )
protectedvirtual

Generate one event.

Is called from shoot().

Referenced by random().

◆ filename()

string ThePEG::EventGenerator::filename ( ) const
inline

The base filename used in this run.

The actual files are called filename.run, filename.dump, filename.out, filename.log and filename.tex for the input configuration file, output dump file, output file, log file, and reference file respectively. The filename is constructed from the path() and runName().

Definition at line 297 of file EventGenerator.h.

References path(), and runName().

◆ finalize()

void ThePEG::EventGenerator::finalize ( )

Indicate that the run has ended and call finish() for all objects including this one.

Note that finish() should not be called directly.

Referenced by manipulator().

◆ findDecayMode()

tDMPtr ThePEG::EventGenerator::findDecayMode ( string  tag) const

Find a decaymode given a decay tag.

Returns
null if no decay mode was found.

Referenced by path().

◆ findMatcher()

tPMPtr ThePEG::EventGenerator::findMatcher ( string  name) const

Find a matcher in this run given its name.

Returns
null if no mather is found.

Referenced by path().

◆ findParticle()

tPDPtr ThePEG::EventGenerator::findParticle ( string  pdgname) const

Find a particle in this run, using its PDG name.

Returns
null if no particle is found.

Referenced by path().

◆ fullclone()

virtual IBPtr ThePEG::EventGenerator::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::InterfacedBase.

Reimplemented in ThePEG::MultiEventGenerator.

Referenced by globalLibraries().

◆ generateEvent() [1/2]

EventPtr ThePEG::EventGenerator::generateEvent ( Event event)

Finish generating an event which has already been partially constructed from the outside.

Calls the virtual method do doGenerateEvent().

Referenced by manipulator().

◆ generateEvent() [2/2]

EventPtr ThePEG::EventGenerator::generateEvent ( Step step)

Finish generating an event starting from a step which has already been partially constructed from the outside.

Calls the virtual method do doGenerateEvent().

◆ getDefault()

template<typename T >
Ptr<T>::pointer ThePEG::EventGenerator::getDefault ( ) const

Return the default object for class T.

Returns the null pointer if non-existent.

Referenced by ThePEG::CurrentGenerator::getDefault(), and getObject().

◆ getObject()

template<typename T >
Ptr<T>::pointer ThePEG::EventGenerator::getObject ( string  name) const
inline

Return a pointer to an object of type T present in this run given its full name.

Return the null pointer if non-existent. Calls getPointer(string) and dynamically casts the result to the requested pointer type.

Definition at line 416 of file EventGenerator.h.

References ThePEG::Pointer::dynamic_ptr_cast(), getDefault(), getParticle(), getParticleData(), and getPointer().

Referenced by ThePEG::CurrentGenerator::getObject().

◆ getPointer()

IBPtr ThePEG::EventGenerator::getPointer ( string  name) const

Return a pointer to an object present in this run given its full name.

Return the null pointer if non-existent.

Referenced by getObject(), ThePEG::CurrentGenerator::getPointer(), and objectMap().

◆ getPtr()

template<typename T >
Ptr<T>::pointer ThePEG::EventGenerator::getPtr ( const T &  ) const

Return a garbage collected pointer to a given object.

If the object is not included in the run, a null pointer will be returned.

Referenced by ThePEG::CurrentGenerator::getPtr(), and objectMap().

◆ go()

void ThePEG::EventGenerator::go ( long  next = 1,
long  maxevent = -1,
bool  tics = false 
)

Run this EventGenerator session.

Calls the virtual method doGo().

Parameters
nextthe number of the firts event to be generated. If negative it is assumed that this generator was previously interrupted (or dumped to a file) and the execution will resume from where it started. Default is 1.
maxeventthe maximum number of events to be generated. If negative the N() is used instead. Default is -1.
ticsif true information the number of events generated and elapsed time will be written to std::cerr after each event.

Referenced by manipulator().

◆ histogramScale()

CrossSection ThePEG::EventGenerator::histogramScale ( ) const

Histogram scale.

A histogram bin which has been filled with the weights associated with the Event objects should be scaled by this factor to give the correct cross section.

Referenced by N().

◆ initialize()

void ThePEG::EventGenerator::initialize ( bool  initOnly = false)

Initialize this generator.

This is done automatically if 'go()' is used. Calls the virtual method doInitialize().

Referenced by manipulator().

◆ loadMain()

bool ThePEG::EventGenerator::loadMain ( string  file)

Dynamically load the Main class in the given file, making it run its Init() method where it may use this EventGenerator.

Also call the initialize function before and the finish() function afterwards.

Referenced by manipulator().

◆ localParticles() [1/2]

ParticleMap& ThePEG::EventGenerator::localParticles ( )
inlineprivate

Access the special particles used in this generator.

Not relevant in the run phase.

Definition at line 557 of file EventGenerator.h.

References theLocalParticles.

◆ localParticles() [2/2]

const ParticleMap& ThePEG::EventGenerator::localParticles ( ) const
inlineprivate

Access the special particles used in this generator.

Not relevant in the run phase.

Definition at line 563 of file EventGenerator.h.

References theLocalParticles.

◆ log()

ostream& ThePEG::EventGenerator::log ( )

Return a reference to the stream connected to the file for logging information.

If no file is connected, BaseRepository::cout() will be used instead.

Referenced by ThePEG::CurrentGenerator::log(), and reffile().

◆ maximumCMEnergy()

virtual Energy ThePEG::EventGenerator::maximumCMEnergy ( ) const
virtual

Return the maximum center of mass energy possible for an event.

Return zero if the assigned EventHander is not able to generatr full events.

Referenced by manipulator().

◆ misc()

ostream& ThePEG::EventGenerator::misc ( )
inline

Return a reference to a stream to be used to redirect cout for external modules which prints out messages there.

The output will instead be appended to the log() stream at the end of the run.

Definition at line 370 of file EventGenerator.h.

References ref(), and theMiscStream.

◆ out()

ostream& ThePEG::EventGenerator::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.

When used at other times, the output will be cashed internally before written out in the finish() phase. This is then written to the .out file, or if useStdOut() is true, to BaseRepository::cout().

Referenced by ThePEG::CurrentGenerator::out(), and reffile().

◆ persistentInput()

void ThePEG::EventGenerator::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 path().

◆ persistentOutput()

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

Function used to write out object persistently.

Parameters
osthe persistent output stream written to.

Referenced by path().

◆ preinitCreate()

IPtr ThePEG::EventGenerator::preinitCreate ( string  classname,
string  fullname,
string  libraries = "" 
)

Create a new Interfaced object to be used in the run being initialized.

Parameters
classnamethe class name of the object being created.
fullnamethe full name including the directory path. Note that although the full path is given the object will not be inserted in the Repository, but only in this current EventGenerator.
librariesan optional list of shared libraries to be loaded to be able to create an object of the specified class.
Returns
the created object if the it was successfully created. Return null if the object could not be created or if another object of that name already exists.

Referenced by path().

◆ preinitCreateDecayMode()

tDMPtr ThePEG::EventGenerator::preinitCreateDecayMode ( string  tag)

Create a decay mode according to the given tag.

Returns
null if no decay mode could be created.

Referenced by path().

◆ preinitInterface() [1/4]

string ThePEG::EventGenerator::preinitInterface ( string  fullname,
string  ifcname,
string  cmd,
string  value 
)

Manipulate an interface of an Interfaced object.

Parameters
fullnamethe name including the full path of an object to be manipulated.
ifcnamethe name of the interface to be used.
cmdthe operation to be performed on the interface (set or get).
valueOptional value to be passed to the interface.
Returns
a string containing the result of the operation. If this string starts with "Error: " then something went wrong.

Referenced by path().

◆ preinitInterface() [2/4]

string ThePEG::EventGenerator::preinitInterface ( string  fullname,
string  ifcname,
int  index,
string  cmd,
string  value 
)

Manipulate an interface of vector type (RefVector or ParVector) of an Interfaced object.

Parameters
fullnamethe name including the full path of an object to be manipulated.
ifcnamethe name of the interface to be used.
indexthe vector index corresponding to the element to be manipulated.
cmdthe operation to be performed on the interface (set, get, insert or erase).
valueOptional value to be passed to the interface.
Returns
a string containing the result of the operation. If this string starts with "Error: " then something went wrong.

◆ preinitInterface() [3/4]

string ThePEG::EventGenerator::preinitInterface ( IPtr  obj,
string  ifcname,
string  cmd,
string  value 
)

Manipulate an interface of an Interfaced object.

Parameters
objthe object to be manipulated.
ifcnamethe name of the interface to be used.
cmdthe operation to be performed on the interface (set or get).
valueOptional value to be passed to the interface.
Returns
a string containing the result of the operation. If this string starts with "Error: " then something went wrong.

◆ preinitInterface() [4/4]

string ThePEG::EventGenerator::preinitInterface ( IPtr  obj,
string  ifcname,
int  index,
string  cmd,
string  value 
)

Manipulate an interface of vector type (RefVector or ParVector) of an Interfaced object.

Parameters
objthe object to be manipulated.
ifcnamethe name of the interface to be used.
indexthe vector index corresponding to the element to be manipulated.
cmdthe operation to be performed on the interface (set, get, insert or erase).
valueOptional value to be passed to the interface.
Returns
a string containing the result of the operation. If this string starts with "Error: " then something went wrong.

◆ preinitRegister()

bool ThePEG::EventGenerator::preinitRegister ( IPtr  obj,
string  fullname 
)

Register a new object to be included in the run currently being initialized.

Parameters
obj(pointer to) the object being registered.
fullnamethe full name including the directory path. Note that although the full path is given the object will not be inserted in the Repository, but only in this current EventGenerator.
Returns
false if another object of that name already exists.

Referenced by path().

◆ ref()

ostream& ThePEG::EventGenerator::ref ( )

Return a reference to the stream connected to the filea for references from used objects.

If no file is connected, BaseRepository::cout() will be used instead.

Referenced by misc(), and ThePEG::CurrentGenerator::ref().

◆ reffile()

ofstream& ThePEG::EventGenerator::reffile ( )
inline

Return a reference to the reference file stream.

This file is used to output LaTeX text with information about the models used in the run.

Definition at line 346 of file EventGenerator.h.

References log(), out(), and theReffile.

◆ runName()

string ThePEG::EventGenerator::runName ( ) const
inline

Return the name assigned to this run.

If no name is given, the name of the EventGenerator object is returned.

Definition at line 303 of file EventGenerator.h.

References ThePEG::InterfacedBase::name(), and theRunName.

Referenced by addTag(), and filename().

◆ setSeed()

void ThePEG::EventGenerator::setSeed ( long  seed)

Set the random seed for the global random number generator.

Also set the interfaced member variable.

Referenced by currentEventNumber().

◆ setup()

void ThePEG::EventGenerator::setup ( string  newRunName,
ObjectSet &  newObjects,
ParticleMap &  newParticles,
MatcherSet &  newMatchers 
)
protected

Finish the setup of an event generator run.

Set run name, all particles, matchers and other objects to be used. Is used by the Repository when isolating an EventGenerator.

Referenced by random().

◆ shoot()

EventPtr ThePEG::EventGenerator::shoot ( )

Generate one event.

Calls the virtual method doShoot();

Referenced by manipulator().

◆ use()

void ThePEG::EventGenerator::use ( const Interfaced i)

Register a given object as used.

Only objects registered in this way will be included in the file with model references.

Referenced by currentEventNumber().

Friends And Related Function Documentation

◆ Repository

friend class Repository
friend

The Repository is a friend.

Definition at line 71 of file EventGenerator.h.

Member Data Documentation

◆ dumpPeriod

long ThePEG::EventGenerator::dumpPeriod
private

If the debug level is higher than 0, dump the complete state of this run to the default dump file every 'dumpPeriod' events.

If 'dumpPeriod' is -1, dumping is disabled completely, even when runs are aborted.

Definition at line 1035 of file EventGenerator.h.

◆ logNonDefault

int ThePEG::EventGenerator::logNonDefault
private

List all modified interfaces in the log file.

If positive always do this, if negative never do it. If zero, only do it if debugging is turned on.

Definition at line 1021 of file EventGenerator.h.

◆ maxErrors

int ThePEG::EventGenerator::maxErrors
private

The maximum number of warnings and errors reported of each type.

If more than maxErrors errors is reported for one type the run will be aborted. Disable the check by setting to -1.

Definition at line 1061 of file EventGenerator.h.

◆ maxWarnings

int ThePEG::EventGenerator::maxWarnings
private

The maximum number of warnings reported of each type.

If more than maxWarnings warnings of one type is issued, the generation will continue without reporting this warning.

Definition at line 1054 of file EventGenerator.h.

◆ theMiscStream

ostringstream ThePEG::EventGenerator::theMiscStream
private

A stream to be used to redirect cout for external modules which prints out messages there.

The output will instead be appended to the log() stream at the end of the run.

Definition at line 930 of file EventGenerator.h.

Referenced by misc().

◆ theOutFileName

string ThePEG::EventGenerator::theOutFileName
private

Remember the name of the file where the output should be sent.

This is set int openOutputFiles().

Definition at line 945 of file EventGenerator.h.

◆ theOutStream

ostringstream ThePEG::EventGenerator::theOutStream
private

A string stream used as a buffer for messages written to the .out file.

The .out file should in rinciple only be written to in the end of a run, during the finish() phase, but if anything is written before that, it will be cashed in this string stream before written out properly in the end of the run.

Definition at line 939 of file EventGenerator.h.

◆ theQuickParticles

PDVector ThePEG::EventGenerator::theQuickParticles
private

A vector of particles indexed by the id number for quick access.

Only particles with id number less than theQuickSize are available.

Definition at line 972 of file EventGenerator.h.


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