ThePEG  1.8.0
SamplerBase.h
1 // -*- C++ -*-
2 //
3 // SamplerBase.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_SamplerBase_H
10 #define ThePEG_SamplerBase_H
11 // This is the declaration of the SamplerBase class.
12 
13 #include "ThePEG/Interface/Interfaced.h"
14 #include "SamplerBase.fh"
15 #include "ThePEG/Handlers/StandardEventHandler.fh"
16 // #include "SamplerBase.xh"
17 
18 namespace ThePEG {
19 
35 class SamplerBase: public Interfaced {
36 
37 public:
38 
44  virtual ~SamplerBase();
46 
47 public:
48 
55 
62  virtual void initialize() = 0;
63 
68  virtual double generate() = 0;
69 
73  virtual void rejectLast() = 0;
74 
78  const vector<double> & lastPoint() const { return theLastPoint; }
79 
85  virtual int lastBin() const { return 0; }
86 
91  virtual CrossSection integratedXSec() const = 0;
92 
97  virtual CrossSection integratedXSecErr() const = 0;
98 
102  virtual CrossSection maxXSec() const = 0;
103 
108  virtual double sumWeights() const = 0;
110 
111 protected:
112 
116  vector<double> & lastPoint() { return theLastPoint; }
117 
122 
123 public:
124 
131  void persistentOutput(PersistentOStream & os) const;
132 
138  void persistentInput(PersistentIStream & is, int version);
140 
144  static void Init();
145 
146 private:
147 
152 
156  vector<double> theLastPoint;
157 
158 private:
159 
164 
168  SamplerBase & operator=(const SamplerBase &);
169 
170 };
171 
172 }
173 
174 
175 namespace ThePEG {
176 
183 template <>
184 struct BaseClassTrait<SamplerBase,1>: public ClassTraitsType {
186  typedef Interfaced NthBase;
187 };
188 
193 template <>
194 struct ClassTraits<SamplerBase>: public ClassTraitsBase<SamplerBase> {
196  static string className() { return "ThePEG::SamplerBase"; }
197 
198 };
199 
202 }
203 
204 #endif /* ThePEG_SamplerBase_H */