ThePEG is hosted by Hepforge, IPPP Durham
ThePEG  2.1.4
ThePEG::Repository Class Reference

Repository inherits from the BaseRepository class. More...

#include <Repository.h>

Inheritance diagram for ThePEG::Repository:

Public Types

typedef map< string, EGPtrGeneratorMap
 A map of EventGenerator objects indexed by their run name. More...
 
- Public Types inherited from ThePEG::BaseRepository
typedef StringSet DirectorySet
 A set of strings. More...
 
typedef vector< string > StringVector
 A vector of character strings. More...
 
typedef set< const InterfaceBase * > InterfaceSet
 A set of pointers to InterfaceBase objects. More...
 
typedef map< const ClassDescriptionBase *, InterfaceSetTypeInterfaceMap
 A map of sets of IterfaceBase objects indexed by pointers to ClassDescriptionBase objects. More...
 
typedef map< const ClassDescriptionBase *, const ClassDocumentationBase * > TypeDocumentationMap
 A map of ClassDocumentationBase objects indexed by pointers to ClassDescriptionBase objects. More...
 

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

static string version ()
 Return the version number of ThePEG.
 
static string banner ()
 Return a string with a ThePEG banner.
 
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
static void defaultParticle (tPDPtr)
 Add a particle to the list of default ones. More...
 
static PDPtr defaultParticle (PID 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. More...
 
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. More...
 
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 string load (string filename)
 Load a whole repository from the given file. More...
 
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. More...
 
static void remove (tIBPtr)
 Remove the given object from the repository. More...
 
static string remove (const ObjectSet &rmset)
 Remove objects. More...
 
static void read (istream &is, ostream &os, string prompt="")
 Read commands from a stream and send them one by one to exec(). More...
 
static string read (string filename, ostream &os)
 Read commands from a file and send them one by one to exec(). More...
 
static string exec (string cmd, ostream &)
 Interpret the command in cmd and return possible messages. More...
 
static string modifyEventGenerator (EventGenerator &eg, string filename, ostream &os, bool initOnly=false)
 Insert the given EventGenerator and its dependent Interfaced objects into the repository and read commands to modify its interfaces. More...
 
static void resetEventGenerator (EventGenerator &eg)
 Reset the given EventGenerator; equivalent to modifyEventGenerator without reading an input file.
 
- Static Public Member Functions inherited from ThePEG::BaseRepository
static string exec (string cmd, ostream &)
 Interpret the command in cmd and return possible messages. More...
 
static void Register (const InterfaceBase &, const type_info &)
 Register an interface. More...
 
static void Register (const ClassDocumentationBase &, const type_info &)
 Register a class documentation. More...
 
static void Register (IBPtr)
 Register a new object using the its current name. More...
 
static void Register (IBPtr, string name)
 Register a new object giving it a new name. More...
 
static void remove (tIBPtr)
 Remove the given object from the repository. More...
 
static string remove (const ObjectSet &rmset)
 Remove objects. More...
 
static void rename (tIBPtr object, string newName)
 Rename a given object. More...
 
static void CreateDirectory (string)
 Create a new directory with the given name. More...
 
static void CheckObjectDirectory (string)
 Check if directory exixts. More...
 
static void CheckDirectory (string)
 Check if directory exixts. More...
 
static void DirectoryAppend (string &)
 Return the absolute path. More...
 
static void ChangeDirectory (string name)
 Set the current directory to name. More...
 
static void PushDirectory (string name)
 Set the current directory to name. More...
 
static void PopDirectory ()
 Pop the directory stack. More...
 
static vector< string > & globalLibraries ()
 A list of all globally loaded libraries.
 
template<typename T >
static Ptr< T >::pointer GetPtr (const T &)
 Return a reference counted pointer to the given object. More...
 
template<typename PtrType >
static PtrType GetPtr (string)
 Return a pointer of the specified type to an object with the given name. More...
 
template<typename PtrType >
static PtrType GetObject (string)
 Return a pointer of the specified type to an object with the given name. More...
 
static IBPtr GetPointer (string)
 Return a pointer to an object with the given name or null if no such object exists.
 
static IVector SearchDirectory (string name, string className="")
 Return all objects in the directory name. More...
 
static IBPtr TraceObject (string name)
 Find an object. More...
 
static string GetInterfacedBaseClasses (const ClassDescriptionBase *cdb)
 Return a string containing the name of the given class description and its base classes, one on each line.
 
static IBPtr getObjectFromNoun (string noun)
 Get an object. More...
 
static IVector GetObjectsReferringTo (IBPtr)
 Get referring objects. More...
 
static IVector DirectReferences (IBPtr)
 Get direct references. More...
 
static void addReferences (tIBPtr obj, ObjectSet &refs)
 Get all references. More...
 
static InterfaceMap getInterfaces (const type_info &ti, bool all=true)
 Get interfaces. More...
 
static const InterfaceBaseFindInterface (IBPtr object, string name)
 Return an interface with the given name to the given object.
 
static string getInterfaceFromNoun (string noun)
 Get an interface name. More...
 
static string getPosArgFromNoun (string noun)
 Get interface index. More...
 
template<typename Cont >
static vector< pair< IBPtr, const InterfaceBase * > > getNonDefaultInterfaces (const Cont &)
 Return a list of the interfaces which do not have their default values for the given objects.
 
static void update ()
 Call the InterfacedBase::update() function of all objects.
 
template<typename Cont >
static void clearAll (const Cont &c)
 Clear the InterfacedBase::touched() flag in all objects in the given container.
 
template<typename Cont >
static void resetAll (const Cont &c)
 Set the status of all objects in the given container to InterfacedBase::uninitialized.
 
static void readSetup (tIBPtr ip, istream &is)
 Setup an object. More...
 
static void lock (tIBPtr ip)
 Lock the given object. More...
 
static void unlock (tIBPtr ip)
 Unlock the given object. More...
 
static const ClassDocumentationBasegetDocumentation (tcIBPtr ip)
 Return the class documentation of a given object.
 
static string getModelDescription (tcIBPtr ip)
 Get the description for the model implemented in the class of the given object.
 
static string getModelReferences (tcIBPtr ip)
 Get the references for the model implemented in the class of the given object.
 
static void cout (ostream &os)
 Set the standard output stream.
 
static ostream & cout ()
 Get the standard output stream.
 
static void cerr (ostream &os)
 Set the standard error stream.
 
static ostream & cerr ()
 Get the standard error stream.
 
static void clog (ostream &os)
 Set the standard log stream.
 
static ostream & clog ()
 Get the standard log stream.
 
static const vector< string > & listReadDirs ()
 Access to list of directories to search for files for the "read" command.
 
static void prependReadDir (string)
 Add a directory to readDirs().
 
static void prependReadDir (const std::vector< std::string > &dirs)
 Add a string vector with directories to readDirs().
 
static void appendReadDir (string)
 Add a directory to readDirs().
 
static void appendReadDir (const std::vector< std::string > &dirs)
 Add a string vector with directories to readDirs().
 

Private Member Functions

 Repository (const Repository &)
 It makes no sense to copy a Repository, so this constructor is not implemented.
 
Repositoryoperator= (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 void checkDuplicatePDGName (PDPtr)
 Check that the PDG name is not a duplicate.
 

Static Private Attributes

static int ninstances
 Count the number of repositorys instantiated.
 

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. More...
 
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 GeneratorMapgenerators ()
 All isolated generators mapped to their run name.
 
static string & currentFileName ()
 The default file name used by save().
 

Additional Inherited Members

- Static Protected Member Functions inherited from ThePEG::BaseRepository
static void addInterfaces (const ClassDescriptionBase &, InterfaceMap &, bool all=true)
 Add interfaces to the given map for the class with the given class description. More...
 
template<typename T >
static Ptr< T >::pointer clone (const T &t)
 Return a clone of the given object. More...
 
template<typename T >
static Ptr< T >::pointer fullclone (const T &t)
 Return a clone of the given object. More...
 
static void rebind (InterfacedBase &obj, const TranslationMap &trans, const IVector &defaults)
 Rebind references. More...
 
static ObjectMap & objects ()
 All InterfacedBase objects mapped to their name.
 
static ObjectSet & allObjects ()
 All InterfacedBase objects.
 
static TypeInterfaceMapinterfaces ()
 Sets of InterfaceBase objects mapped to the class description of the class for which they are defined.
 
static TypeDocumentationMapdocumentations ()
 Sets of ClassDocumentationBase objects mapped to the class description of the class for which they are defined.
 
static DirectorySetdirectories ()
 All defined directories.
 
static StringVectordirectoryStack ()
 The current directory stack.
 
static bool & updating ()
 Flag to say if we are in the middle of an update procedure.
 
static ostream *& coutp ()
 The current current standard output stream.
 
static ostream *& cerrp ()
 The current current standard error stream.
 
static ostream *& clogp ()
 The current current standard log stream.
 
static stack< string > & currentReadDirStack ()
 The stack of directories used by the "read" command.
 
static vector< string > & readDirs ()
 List of directories to search for files for the "read" command.
 

Detailed Description

Repository inherits from the BaseRepository class.

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.

See also
BaseRepository
InterfacedBase
ParticleData
ParticleMatcher
EventGenerator

Definition at line 45 of file Repository.h.

Member Typedef Documentation

◆ GeneratorMap

A map of EventGenerator objects indexed by their run name.

Definition at line 50 of file Repository.h.

Member Function Documentation

◆ cleanup()

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.

Referenced by save().

◆ copyParticle()

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.

Referenced by allMatchers().

◆ defaultParticle()

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

◆ exec()

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.

Referenced by save().

◆ findParticle()

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.

◆ help()

static void ThePEG::Repository::help ( string  command,
ostream &  os 
)
static

Print out a help message.

Extended text for a specific command if given.

Referenced by save().

◆ load()

static string ThePEG::Repository::load ( string  filename)
static

Load a whole repository from the given file.

All objects previously in the Repository are discarded. Any errors will be reported in the returned string.

Referenced by allMatchers().

◆ modifyEventGenerator()

static string ThePEG::Repository::modifyEventGenerator ( EventGenerator eg,
string  filename,
ostream &  os,
bool  initOnly = false 
)
static

Insert the given EventGenerator and its dependent Interfaced objects into the repository and read commands to modify its interfaces.

Any line accepted by the command-line interface will be executed, but the main purpose of this function is to modify an already saved and initialized EventGenerator before running without re-initializing. If an interface which does not have the dependencySafe() flag set, a warning will be emitted.

Referenced by save().

◆ read() [1/2]

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

Parameters
isthe stream from which to read commands.
osthe stream where output is written.
promptbefore reading a command from is, this string is written to os.

Referenced by save().

◆ read() [2/2]

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

Returns possible messages.

Parameters
filenamethe file from which to read commands.
osthe stream where output is written.

◆ remove() [1/2]

static void ThePEG::Repository::remove ( tIBPtr  )
static

Remove the given object from the repository.

If the object was not present nothing will happen.

◆ remove() [2/2]

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.


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