herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
ProjectingSampler.h
00001 // -*- C++ -*-
00002 //
00003 // ProjectingSampler.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_ProjectingSampler_H
00010 #define Herwig_ProjectingSampler_H
00011 //
00012 // This is the declaration of the ProjectingSampler class.
00013 //
00014 
00015 #include "BinSampler.h"
00016 #include "BinnedStatistics.h"
00017 
00018 namespace Herwig {
00019 
00020 using namespace ThePEG;
00021 
00031 class ProjectingSampler: public Herwig::BinSampler {
00032 
00033 public:
00034 
00040   ProjectingSampler();
00041 
00045   virtual ~ProjectingSampler();
00047 
00048 public:
00049 
00055   virtual void generate(bool noMaxInfo = false);
00056 
00060   virtual void initialize(bool progress);
00061 
00065   void adapt();
00066 
00067 public:
00068 
00072   virtual void select(double weight);
00073 
00077   virtual void accept();
00078 
00082   virtual void reject();
00083 
00084 public:
00085 
00092   void persistentOutput(PersistentOStream & os) const;
00093 
00099   void persistentInput(PersistentIStream & is, int version);
00101 
00108   static void Init();
00109 
00110 protected:
00111 
00118   virtual IBPtr clone() const;
00119 
00124   virtual IBPtr fullclone() const;
00126 
00127 
00128 // If needed, insert declarations of virtual function defined in the
00129 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
00130 
00131 
00132 private:
00133 
00138   ProjectingSampler & operator=(const ProjectingSampler &);
00139 
00143   bool theFirstIteration;
00144 
00148   unsigned long theNIterations;
00149 
00153   double theEnhancementFactor;
00154 
00158   unsigned int theNBins;
00159 
00163   double theEpsilon;
00164 
00168   unsigned long theLastNPoints;
00169 
00173   vector<BinnedStatistics> theProjections;
00174 
00178   double theLastValue;
00179 
00183   double theWeightThreshold;
00184 
00185 };
00186 
00187 }
00188 
00189 #endif /* Herwig_ProjectingSampler_H */