thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
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.
 
- Public Types inherited from ThePEG::BaseRepository
typedef StringSet DirectorySet
 A set of strings.
 
typedef vector< string > StringVector
 A vector of character strings.
 
typedef set< const InterfaceBase * > InterfaceSet
 A set of pointers to InterfaceBase objects.
 
typedef map< const ClassDescriptionBase *, InterfaceSetTypeInterfaceMap
 A map of sets of IterfaceBase objects indexed by pointers to ClassDescriptionBase objects.
 
typedef map< const ClassDescriptionBase *, const ClassDocumentationBase * > TypeDocumentationMap
 A map of ClassDocumentationBase objects indexed by pointers to ClassDescriptionBase objects.
 

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
static void defaultParticle (tPDPtr)
 Add a particle to the list of default ones.
 
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.
 
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 string 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.
 
- Static Public Member Functions inherited from ThePEG::BaseRepository
static string exec (string cmd, ostream &)
 Interpret the command in cmd and return possible messages.
 
static void Register (const InterfaceBase &, const type_info &)
 Register an interface.
 
static void Register (const ClassDocumentationBase &, const type_info &)
 Register a class documentation.
 
static void Register (IBPtr)
 Register a new object using the its current name.
 
static void Register (IBPtr, string name)
 Register a new object giving it a new name.
 
static void remove (tIBPtr)
 Remove the given object from the repository.
 
static string remove (const ObjectSet &rmset)
 Remove objects.
 
static void rename (tIBPtr object, string newName)
 Rename a given object.
 
static void CreateDirectory (string)
 Create a new directory with the given name.
 
static void CheckObjectDirectory (string)
 Check if directory exixts.
 
static void CheckDirectory (string)
 Check if directory exixts.
 
static void DirectoryAppend (string &)
 Return the absolute path.
 
static void ChangeDirectory (string name)
 Set the current directory to name.
 
static void PushDirectory (string name)
 Set the current directory to name.
 
static void PopDirectory ()
 Pop the directory stack.
 
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.
 
template<typename PtrType >
static PtrType GetPtr (string)
 Return a pointer of the specified type to an object with the given name.
 
template<typename PtrType >
static PtrType GetObject (string)
 Return a pointer of the specified type to an object with the given name.
 
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.
 
static IBPtr TraceObject (string name)
 Find an object.
 
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.
 
static IVector GetObjectsReferringTo (IBPtr)
 Get referring objects.
 
static IVector DirectReferences (IBPtr)
 Get direct references.
 
static void addReferences (tIBPtr obj, ObjectSet &refs)
 Get all references.
 
static InterfaceMap getInterfaces (const type_info &ti, bool all=true)
 Get interfaces.
 
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.
 
static string getPosArgFromNoun (string noun)
 Get interface index.
 
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.
 
static void lock (tIBPtr ip)
 Lock the given object.
 
static void unlock (tIBPtr ip)
 Unlock the given object.
 
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().
 

Functions containing the static instances of objects used

by the repository.

static int ninstances
 Count the number of repositorys instantiated.
 
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 GeneratorMapgenerators ()
 All isolated generators mapped to their run name.
 
static string & currentFileName ()
 The default file name used by save().
 
 Repository (const Repository &)
 It makes no sense to copy a Repository, so this constructor is not implemented.
 
Repositoryoperator= (const Repository &)=delete
 It makes no sense to copy a Repository, so this assignment is not implemented.
 

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 string 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.
 
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.
 
static void resetEventGenerator (EventGenerator &eg)
 Reset the given EventGenerator; equivalent to modifyEventGenerator without reading an input file.
 
static string version ()
 Return the version number of ThePEG.
 
static string banner ()
 Return a string with a ThePEG banner.
 
static void registerParticle (tPDPtr)
 Used by Register.
 
static void registerMatcher (tPMPtr)
 Used by Register.
 
static void execAndCheckReply (string, ostream &)
 Used by read()
 

Additional Inherited Members

- Static Protected Member Functions inherited from ThePEG::BaseRepository
template<typename T >
static Ptr< T >::pointer clone (const T &t)
 Return a clone of the given object.
 
template<typename T >
static Ptr< T >::pointer fullclone (const T &t)
 Return a clone of the given object.
 
static void rebind (InterfacedBase &obj, const TranslationMap &trans, const IVector &defaults)
 Rebind references.
 
static void addInterfaces (const ClassDescriptionBase &, InterfaceMap &, bool all=true)
 Add interfaces to the given map for the class with the given class description.
 
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

◆ allMatchers()

static const MatcherSet & ThePEG::Repository::allMatchers ( )
inlinestatic

Return the set of all matchers in the repository.

Definition at line 119 of file Repository.h.

References matchers().

◆ allParticles()

static const ParticleDataSet & ThePEG::Repository::allParticles ( )
inlinestatic

Return the set of all particles in the repository.

Definition at line 114 of file Repository.h.

References particles().

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

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

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

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

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

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

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

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

◆ remove() [2/2]

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

Remove the given object from the repository.

If the object was not present nothing will happen.

◆ save()

static void ThePEG::Repository::save ( )
inlinestatic

Save the repository to the default file.

Definition at line 166 of file Repository.h.

References currentFileName(), and save().

Referenced by save().

Member Data Documentation

◆ ninstances

int ThePEG::Repository::ninstances
staticprivate

Count the number of repositorys instantiated.

Definition at line 336 of file Repository.h.


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