00001 // -*- C++ -*- 00002 // 00003 // SamplerBase.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef ThePEG_SamplerBase_H 00010 #define ThePEG_SamplerBase_H 00011 // This is the declaration of the SamplerBase class. 00012 00013 #include "ThePEG/Interface/Interfaced.h" 00014 #include "SamplerBase.fh" 00015 #include "ThePEG/Handlers/StandardEventHandler.fh" 00016 // #include "SamplerBase.xh" 00017 00018 namespace ThePEG { 00019 00035 class SamplerBase: public Interfaced { 00036 00037 public: 00038 00044 virtual ~SamplerBase(); 00046 00047 public: 00048 00054 void setEventHandler(tStdEHPtr eh) { theEventHandler = eh; } 00055 00062 virtual void initialize() = 0; 00063 00068 virtual double generate() = 0; 00069 00073 virtual void rejectLast() = 0; 00074 00078 const vector<double> & lastPoint() const { return theLastPoint; } 00079 00085 virtual int lastBin() const { return 0; } 00086 00091 virtual CrossSection integratedXSec() const = 0; 00092 00097 virtual CrossSection integratedXSecErr() const = 0; 00098 00102 virtual CrossSection maxXSec() const = 0; 00103 00108 virtual double sumWeights() const = 0; 00110 00111 protected: 00112 00116 vector<double> & lastPoint() { return theLastPoint; } 00117 00121 tStdEHPtr eventHandler() const { return theEventHandler; } 00122 00123 public: 00124 00131 void persistentOutput(PersistentOStream & os) const; 00132 00138 void persistentInput(PersistentIStream & is, int version); 00140 00144 static void Init(); 00145 00146 private: 00147 00151 tStdEHPtr theEventHandler; 00152 00156 vector<double> theLastPoint; 00157 00158 private: 00159 00163 static AbstractClassDescription<SamplerBase> initSamplerBase; 00164 00168 SamplerBase & operator=(const SamplerBase &); 00169 00170 }; 00171 00172 } 00173 00174 00175 namespace ThePEG { 00176 00183 template <> 00184 struct BaseClassTrait<SamplerBase,1>: public ClassTraitsType { 00186 typedef Interfaced NthBase; 00187 }; 00188 00193 template <> 00194 struct ClassTraits<SamplerBase>: public ClassTraitsBase<SamplerBase> { 00196 static string className() { return "ThePEG::SamplerBase"; } 00197 00198 }; 00199 00202 } 00203 00204 #endif /* ThePEG_SamplerBase_H */