ThePEG  1.8.0
Strategy.h
1 // -*- C++ -*-
2 //
3 // Strategy.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_Strategy_H
10 #define ThePEG_Strategy_H
11 // This is the declaration of the Strategy class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "Strategy.fh"
15 #include "ThePEG/Interface/Interfaced.h"
16 
17 namespace ThePEG {
18 
41 class Strategy: public Interfaced {
42 
43 public:
44 
50  const ParticleMap & particles() const { return theParticles; }
51 
59  string localParticlesDir() const;
60 
69  const vector<string> & defaultParticlesDirs() const {
71  }
72 
76  const vector<IPtr> & defaultObjects() const { return theDefaultObjects; }
78 
83  virtual const string versionstring() const { return ""; }
84 
85 public:
86 
93  void persistentOutput(PersistentOStream & os) const;
94 
100  void persistentInput(PersistentIStream & is, int version);
102 
106  static void Init();
107 
108 protected:
109 
116  virtual IBPtr clone() const;
117 
122  virtual IBPtr fullclone() const;
124 
125 private:
126 
130  ParticleMap & particles() { return theParticles; }
131 
132 private:
133 
137  ParticleMap theParticles;
138 
147 
151  vector<IPtr> theDefaultObjects;
152 
162  vector<string> theDefaultParticlesDirs;
163 
164 private:
165 
169  void setLocalParticles(PDPtr pd, int);
170 
174  void insLocalParticles(PDPtr pd, int);
175 
179  void delLocalParticles(int place);
180 
184  vector<PDPtr> getLocalParticles() const;
185 
189  void setLocalParticlesDir(string);
190 
194  void setDefaultParticlesDirs(string,int);
195 
199  void insDefaultParticlesDirs(string,int);
200 
204  static bool checkDir(string);
205 
206 private:
207 
212 
216  Strategy & operator=(const Strategy &);
217 
218 };
219 
224 template <>
225 struct BaseClassTrait<Strategy,1>: public ClassTraitsType {
227  typedef Interfaced NthBase;
228 };
229 
232 template <>
233 struct ClassTraits<Strategy>: public ClassTraitsBase<Strategy> {
235  static string className() { return "ThePEG::Strategy"; }
236 };
237 
240 }
241 
242 #endif /* ThePEG_Strategy_H */
Strategy & operator=(const Strategy &)
Private and non-existent assignment operator.
virtual IBPtr clone() const
Make a simple clone of this object.
void setDefaultParticlesDirs(string, int)
Utility function used by the interface.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
void insDefaultParticlesDirs(string, int)
Utility function used by the interface.
static bool checkDir(string)
Utility function used by the interface.
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
void setLocalParticlesDir(string)
Utility function used by the interface.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
const vector< string > & defaultParticlesDirs() const
By default all particles in the Repository are included in a run, although only one particle per PDG ...
Definition: Strategy.h:69
string localParticlesDir() const
A directory in the repository which will be scanned for particles which will be included as default p...
The Strategy class represents a general strategy to be assigned to an EventGenerator.
Definition: Strategy.h:41
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
ParticleMap & particles()
Return the map of local particles.
Definition: Strategy.h:130
static void Init()
Standard Init function used to initialize the interface.
void setLocalParticles(PDPtr pd, int)
Utility function used by the interface.
const ParticleMap & particles() const
Return the map of local particles indexed by their PDG id number.
Definition: Strategy.h:50
vector< string > theDefaultParticlesDirs
By default all particles in the Repository are included in a run, although only one particle per PDG ...
Definition: Strategy.h:162
void insLocalParticles(PDPtr pd, int)
Utility function used by the interface.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
const vector< IPtr > & defaultObjects() const
Return the vector of default objects.
Definition: Strategy.h:76
vector< IPtr > theDefaultObjects
A vector of default objects.
Definition: Strategy.h:151
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition: Interfaced.h:38
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
static ClassDescription< Strategy > initStrategy
Describe a concrete class with persistent data.
Definition: Strategy.h:211
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
vector< PDPtr > getLocalParticles() const
Utility function used by the interface.
virtual const string versionstring() const
Return a freeform version string.
Definition: Strategy.h:83
ParticleMap theParticles
the map of default particles.
Definition: Strategy.h:137
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
void delLocalParticles(int place)
Utility function used by the interface.
string theLocalParticlesDir
A directory in the repository which will be scanned for particles which will be included as default p...
Definition: Strategy.h:146