thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
Strategy.h
1 // -*- C++ -*-
2 //
3 // Strategy.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_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 &) = delete;
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 */
string localParticlesDir() const
A directory in the repository which will be scanned for particles which will be included as default p...
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...
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
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...
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
This is the main config header file for ThePEG.
ParticleMap & particles()
Return the map of local particles.
Definition: Strategy.h:130
static void Init()
Standard Init function used to initialize the interface.
vector< PDPtr > getLocalParticles() const
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
void setLocalParticles(PDPtr pd, int)
Utility function used by the interface.
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
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 persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual IBPtr clone() const
Make a simple clone of this object.
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
virtual const string versionstring() const
Return a freeform version string.
Definition: Strategy.h:83
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
static ClassDescription< Strategy > initStrategy
Describe a concrete class with persistent data.
Definition: Strategy.h:211
Strategy & operator=(const Strategy &)=delete
Private and non-existent assignment operator.
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.
const vector< IPtr > & defaultObjects() const
Return the vector of default objects.
Definition: Strategy.h:76
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
string theLocalParticlesDir
A directory in the repository which will be scanned for particles which will be included as default p...
Definition: Strategy.h:146