thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
Repository.h
1// -*- C++ -*-
2//
3// Repository.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad
5//
6// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef ThePEG_Repository_H
10#define ThePEG_Repository_H
11// This is the declaration of the Repository class.
12
14#include "BaseRepository.h"
15#include "EventGenerator.h"
16#include "ThePEG/PDT/ParticleData.h"
17#include "ThePEG/PDT/MatcherBase.h"
18
19namespace ThePEG {
20
46
47public:
48
50 typedef map<string,EGPtr> GeneratorMap;
51
52public:
53
60
66
67public:
68
76 static void Register(IBPtr);
77
83 static void Register(IBPtr, string newName);
85
94 static void defaultParticle(tPDPtr);
95
101
109 static tPDPtr findParticle(string name);
110
114 static const ParticleDataSet & allParticles() { return particles(); }
115
119 static const MatcherSet & allMatchers() { return matchers(); }
120
124 static tPMPtr findMatcher(string name);
125
131 static string copyParticle(tPDPtr, string);
133
140 static EGPtr makeRun(tEGPtr eg, string name);
141
146 static void saveRun(string EGname, string name, string filename);
148
156 static string load(string filename);
157
161 static void save(string filename);
162
166 static void save() { save(currentFileName()); }
167
171 static void stats(ostream &);
173
179 static void help(string command, ostream & os);
180
185 static void remove(tIBPtr);
186
193 static string remove(const ObjectSet & rmset);
194
203 static void read(istream & is, ostream & os, string prompt = "");
204
216 static string read(string filename, ostream & os);
217
224 static string exec(string cmd, ostream &);
225
235 static string modifyEventGenerator(EventGenerator & eg, string filename,
236 ostream & os, bool initOnly = false);
237
244
248 static string version();
249
253 static string banner();
254
255private:
256
261
266
270 static void execAndCheckReply(string, ostream &);
271
272protected:
273
280 static ParticleMap & defaultParticles();
281
285 static ParticleDataSet & particles();
286
290 static MatcherSet & matchers();
291
296
300 static string & currentFileName();
301
302public:
303
308 static int & exitOnError();
309
316 static void cleanup();
318
319private:
320
326
331 Repository & operator=(const Repository &) = delete;
332
336 static int ninstances;
337
338
339};
340
341}
342
343#endif /* ThePEG_Repository_H */
This is the main config header file for ThePEG.
BaseRepository is a purely static class which keeps a set of InterfacedBase objects indexed by their ...
The EventGenerator class manages a whole event generator run.
PID is a helper class implementing the type of PDG particle ids.
Definition: PID.h:23
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
Repository inherits from the BaseRepository class.
Definition: Repository.h:45
static const ParticleDataSet & allParticles()
Return the set of all particles in the repository.
Definition: Repository.h:114
static string load(string filename)
Load a whole repository from the given file.
static void registerMatcher(tPMPtr)
Used by Register.
static string banner()
Return a string with a ThePEG banner.
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 com...
static tPDPtr findParticle(string name)
Get a pointer to a particle based on the given path or name.
static MatcherSet & matchers()
The set of all matchers.
static void registerParticle(tPDPtr)
Used by Register.
static string read(string filename, ostream &os)
Read commands from a file and send them one by one to exec().
map< string, EGPtr > GeneratorMap
A map of EventGenerator objects indexed by their run name.
Definition: Repository.h:50
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.
static void stats(ostream &)
Write some statistics about the repository to the standard output.
Repository()
The default constructor is the only one that should be used.
static void save()
Save the repository to the default file.
Definition: Repository.h:166
static void defaultParticle(tPDPtr)
Add a particle to the list of default ones.
static const MatcherSet & allMatchers()
Return the set of all matchers in the repository.
Definition: Repository.h:119
static void cleanup()
Call this function to clean up the repository at the end of your program if you are using the static ...
static void remove(tIBPtr)
Remove the given object from 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 save(string filename)
Save the repository to the given file.
static void Register(IBPtr)
Register an object with BaseRepository::Register() and add it to the list of particles or matchers if...
static PDPtr defaultParticle(PID id)
Get a pointer to the default particle of the given type or generic name.
Repository & operator=(const Repository &)=delete
It makes no sense to copy a Repository, so this assignment is not implemented.
static string copyParticle(tPDPtr, string)
Special function for copying particles.
static tPMPtr findMatcher(string name)
Find a matcher with a given generic name.
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 string exec(string cmd, ostream &)
Interpret the command in cmd and return possible messages.
~Repository()
The destructor will do some clean-up when the last Repository is deleted.
static string remove(const ObjectSet &rmset)
Remove objects.
static int ninstances
Count the number of repositorys instantiated.
Definition: Repository.h:336
static ParticleMap & defaultParticles()
The set of default particles.
static void help(string command, ostream &os)
Print out a help message.
static void resetEventGenerator(EventGenerator &eg)
Reset the given EventGenerator; equivalent to modifyEventGenerator without reading an input file.
static GeneratorMap & generators()
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.
static void execAndCheckReply(string, ostream &)
Used by read()
static string version()
Return the version number of ThePEG.
static ParticleDataSet & particles()
The set of all particles.
static void read(istream &is, ostream &os, string prompt="")
Read commands from a stream and send them one by one to exec().
static void Register(IBPtr, string newName)
Register an object with BaseRepository::Register() and add it to the list of particles or matchers if...
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28