#include <Repository.h>
Functions containing the static instances of objects used | |
by the repository. | |
static int & | exitOnError () |
If non-zero the setup program will exit with this error code as soon as an error is encountered. | |
static void | cleanup () |
Call this function to clean up the repository at the end of your program if you are using the static functions directly without going through a Repository object. | |
static ParticleMap & | defaultParticles () |
The set of default particles. | |
static ParticleDataSet & | particles () |
The set of all particles. | |
static MatcherSet & | matchers () |
The set of all matchers. | |
static GeneratorMap & | generators () |
All isolated generators mapped to their run name. | |
static string & | currentFileName () |
The default file name used by save(). | |
Public Types | |
typedef map< string, EGPtr > | GeneratorMap |
A map of EventGenerator objects indexed by their run name. | |
Public Member Functions | |
Standsrd constructors and destructors | |
Repository () | |
The default constructor is the only one that should be used. | |
~Repository () | |
The destructor will do some clean-up when the last Repository is deleted. | |
Static Public Member Functions | |
Functions for register objects in the Repository. | |
static void | Register (IBPtr) |
Register an object with BaseRepository::Register() and add it to the list of particles or matchers if of any of those types. | |
static void | Register (IBPtr, string newName) |
Register an object with BaseRepository::Register() and add it to the list of particles or matchers if of any of those types. | |
Access ParticleData and MatcherBase objects in the | |
Repository. | |
static void | defaultParticle (tPDPtr) |
Add a particle to the list of default ones. | |
static PDPtr | defaultParticle (long id) |
Get a pointer to the default particle of the given type or generic name. | |
static tPDPtr | findParticle (string name) |
Get a pointer to a particle based on the given path or name. | |
static const ParticleDataSet & | allParticles () |
Return the set of all particles in the repository. | |
static const MatcherSet & | allMatchers () |
Return the set of all matchers in the repository. | |
static tPMPtr | findMatcher (string name) |
Find a matcher with a given generic name. | |
static string | copyParticle (tPDPtr, string) |
Special function for copying particles. | |
Functions to isolate Eventgenerator objects. | |
static EGPtr | makeRun (tEGPtr eg, string name) |
Isolate an event generator, eg, and save it to disk in a file named name (with .run appended. | |
static void | saveRun (string EGname, string name, string filename) |
Isolate an event generatorn, named EGname, set its run name and save it to a file named filename. | |
I/O functions for the Repository. | |
static void | load (string filename) |
Load a whole repository from the given file. | |
static void | save (string filename) |
Save the repository to the given file. | |
static void | save () |
Save the repository to the default file. | |
static void | stats (ostream &) |
Write some statistics about the repository to the standard output. | |
Command-line interface functions. | |
static void | help (string command, ostream &os) |
Print out a help message. | |
static void | remove (tIBPtr) |
Remove the given object from the repository. | |
static string | remove (const ObjectSet &rmset) |
Remove objects. | |
static void | read (istream &is, ostream &os, string prompt="") |
Read commands from a stream and send them one by one to exec(). | |
static void | read (string filename, ostream &os) |
Read commands from a file and send them one by one to exec(). | |
static string | exec (string cmd, ostream &) |
Interpret the command in cmd and return possible messages. | |
Private Member Functions | |
Repository (const Repository &) | |
It makes no sense to copy a Repository, so this constructor is not implemented. | |
Repository & | operator= (const Repository &) |
It makes no sense to copy a Repository, so this assignment is not implemented. | |
Static Private Member Functions | |
static void | registerParticle (tPDPtr) |
Used by Register. | |
static void | registerMatcher (tPMPtr) |
Used by Register. | |
static void | execAndCheckReply (string, ostream &) |
Used by read(). | |
Static Private Attributes | |
static int | ninstances |
Count the number of repositorys instantiated. |
While BaseRepository is fairly general and could in principle be used for any program where sets of InterfacedBase objects are managed, the Repository is ThePEG specific in that it deals with ParticleData, ParticleMatchers and EventGenerators.
One main function is to write an EventGenerator to disk using saveRun(). Here all objects needed for the run, including the EventGenerator is cloned and isolated from the other objects in the Repository (and are hence not handled by the Repository anymore) before they are all persistently written out to disk.
The Register() function simply pass the objects to the corresonding method in BaseRepository, but if the object is a ParticleData or a ParticleMatcher, they are stored separately.
ParticleMatcher
Definition at line 45 of file Repository.h.
typedef map<string,EGPtr> ThePEG::Repository::GeneratorMap |
A map of EventGenerator objects indexed by their run name.
Definition at line 50 of file Repository.h.
static void ThePEG::Repository::defaultParticle | ( | tPDPtr | ) | [static] |
Add a particle to the list of default ones.
If one of the same type alredy existed, it is removed from the list (but not from the repository).
static tPDPtr ThePEG::Repository::findParticle | ( | string | name | ) | [static] |
Get a pointer to a particle based on the given path or name.
The argument is first treated as a path to an object. If no such particle object is found, the argument is treated as a generic particle PDGName and is searched for among the default set of particles.
static string ThePEG::Repository::copyParticle | ( | tPDPtr | , | |
string | ||||
) | [static] |
Special function for copying particles.
Also corresponding anti-particle is copied to the same directory. In addition, their decay modes are copied.
static void ThePEG::Repository::load | ( | string | filename | ) | [static] |
Load a whole repository from the given file.
All objects previously in the Repository are discarded.
static void ThePEG::Repository::help | ( | string | command, | |
ostream & | os | |||
) | [static] |
Print out a help message.
Extended text for a specific command if given.
static void ThePEG::Repository::remove | ( | tIBPtr | ) | [static] |
Remove the given object from the repository.
If the object was not present nothing will happen.
Reimplemented from ThePEG::BaseRepository.
static string ThePEG::Repository::remove | ( | const ObjectSet & | rmset | ) | [static] |
Remove objects.
Remove the objects in rmset if there are no other objects in the repository referring to them, otherwise return an error message and the names of the objects refering to them separated by new-line characters.
Reimplemented from ThePEG::BaseRepository.
static void ThePEG::Repository::read | ( | istream & | is, | |
ostream & | os, | |||
string | prompt = "" | |||
) | [static] |
Read commands from a stream and send them one by one to exec().
is | the stream from which to read commands. | |
os | the stream where output is written. | |
prompt | before reading a command from is, this string is written to os. |
static void ThePEG::Repository::read | ( | string | filename, | |
ostream & | os | |||
) | [static] |
Read commands from a file and send them one by one to exec().
Passes the call through to read(istream, ostream), but also sets currentReadDirStack() correctly.
filename | the file from which to read commands. | |
os | the stream where output is written. |
static string ThePEG::Repository::exec | ( | string | cmd, | |
ostream & | ||||
) | [static] |
Interpret the command in cmd and return possible messages.
This is the main function for the command-line interface. The syntax is described elsewhere. The ostream argument is currently unused.
Reimplemented from ThePEG::BaseRepository.
static void ThePEG::Repository::cleanup | ( | ) | [static] |
Call this function to clean up the repository at the end of your program if you are using the static functions directly without going through a Repository object.
There, the destructor would do the job.