Herwig++
2.7.0
|
00001 // -*- C++ -*- 00002 // 00003 // ExSampler.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator 00004 // Copyright (C) 2002-2012 The Herwig Collaboration 00005 // 00006 // Herwig++ 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 Herwig_ExSampler_H 00010 #define Herwig_ExSampler_H 00011 // 00012 // This is the declaration of the ExSampler class. 00013 // 00014 00015 #include "BinSampler.h" 00016 #include "Herwig++/Exsample2/exsample/generator.h" 00017 00018 namespace Herwig { 00019 00020 using namespace ThePEG; 00021 00030 class ExSampler: public Herwig::BinSampler { 00031 00032 public: 00033 00039 ExSampler(); 00040 00044 virtual ~ExSampler(); 00046 00047 public: 00048 00052 virtual bool isUnweighting() const { return true; } 00053 00057 virtual bool compensating() const { return generator_.compensating(); } 00058 00064 virtual void generate(bool noMaxInfo = false); 00065 00069 virtual void initialize(bool progress); 00070 00074 virtual void finalize(bool verbose); 00075 00076 public: 00077 00081 virtual void reject() { 00082 GeneralStatistics::reject(); 00083 generator_.reject(); 00084 } 00085 00086 public: 00087 00091 double evaluate(const vector<double>& p) const { 00092 double ret; 00093 try { 00094 ret = eventHandler()->dSigDR(p) / nanobarn; 00095 } catch (Veto&) { 00096 ret = 0.0; 00097 } catch (...) { 00098 throw; 00099 } 00100 return ret; 00101 } 00102 00107 pair<vector<double>,vector<double> > support() const { 00108 vector<double> lower(dimension(),0.); 00109 vector<double> upper(dimension(),1.); 00110 return make_pair(lower,upper); 00111 } 00112 00116 void start_presampling() { } 00117 00121 void stop_presampling() { } 00122 00123 public: 00124 00131 void persistentOutput(PersistentOStream & os) const; 00132 00138 void persistentInput(PersistentIStream & is, int version); 00140 00147 static void Init(); 00148 00149 protected: 00150 00157 virtual IBPtr clone() const; 00158 00163 virtual IBPtr fullclone() const; 00165 00166 00167 // If needed, insert declarations of virtual function defined in the 00168 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs). 00169 00170 private: 00171 00175 unsigned long presampling_points_; 00176 00180 unsigned long freeze_grid_; 00181 00185 double efficiency_threshold_; 00186 00190 double gain_threshold_; 00191 00195 exsample::generator<ExSampler,UseRandom> generator_; 00196 00197 private: 00198 00203 ExSampler & operator=(const ExSampler &); 00204 00205 }; 00206 00207 } 00208 00209 #endif /* Herwig_ExSampler_H */