herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
MonacoSampler.h
1 // -*- C++ -*-
2 //
3 // MonacoSampler.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2017 The Herwig Collaboration
5 //
6 // Herwig 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 Herwig_MonacoSampler_H
10 #define Herwig_MonacoSampler_H
11 //
12 // This is the declaration of the MonacoSampler class.
13 //
14 
15 #include "Herwig/Sampling/BinSampler.h"
16 
17 #include "Herwig/Utilities/XML/Element.h"
18 
19 // work around a Boost 1.64 bug where ublas headers would fail otherwise
20 #include <boost/version.hpp>
21 #if (BOOST_VERSION / 100 >= 1064)
22 #include <boost/serialization/array_wrapper.hpp>
23 #endif
24 
25 #include <boost/numeric/ublas/matrix.hpp>
26 
27 namespace Herwig {
28 
29 using namespace ThePEG;
30 
41 
42 public:
43 
49  MonacoSampler();
50 
54  virtual ~MonacoSampler();
56 
57 public:
58 
62  Ptr<MonacoSampler>::ptr cloneMe() const {
63  return dynamic_ptr_cast<Ptr<MonacoSampler>::ptr>(clone());
64  }
65 
66 public:
67 
68 
73  virtual double generate();
74 
78  virtual void adapt();
79 
83  virtual bool existsGrid() const;
84 
88  virtual void saveGrid() const;
89 
93  virtual void initialize(bool progress);
94 
98  virtual void finalize(bool);
99 
103  virtual void fromXML(const XML::Element&);
104 
108  virtual XML::Element toXML() const;
109 
110 
111 public:
112 
119  void persistentOutput(PersistentOStream & os) const;
120 
126  void persistentInput(PersistentIStream & is, int version);
128 
135  static void Init();
136 
137 protected:
138 
145  virtual IBPtr clone() const;
146 
151  virtual IBPtr fullclone() const;
153 
154 
155 // If needed, insert declarations of virtual function defined in the
156 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
157 
158 private:
159 
163  double theAlpha;
164 
169 
175  boost::numeric::ublas::matrix<double> theGrid;
176 
180  boost::numeric::ublas::matrix<double> theGridData;
181 
182 private:
183 
188 
189 private:
190 
195  MonacoSampler & operator=(const MonacoSampler &) = delete;
196 
197 };
198 
199 }
200 
201 #endif /* Herwig_MonacoSampler_H */
MonacoSampler samples XCombs bins using using Monaco.
Definition: MonacoSampler.h:40
boost::numeric::ublas::matrix< double > theGridData
Collected value per grid bin.
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
boost::numeric::ublas::matrix< double > theGrid
Grid boundaries (first index: dimension of random numbers, second index: dimension of partitions per ...
Ptr< MonacoSampler >::ptr cloneMe() const
Clone this object.
Definition: MonacoSampler.h:62
size_t theGridDivisions
Number of grid divisions per dimension.
BinSampler samples XCombs bins. This default implementation performs flat MC integration.
Definition: BinSampler.h:38
double theAlpha
Rate of grid modification (0 for no modification)
Element represents a (tree of) XML elements.
Definition: Element.h:56
pair< double, double > generate(const Generator< Density > &gen, double r)
Generate a random variable and return its weight.
-*- C++ -*-
size_t theIterationPoints
Number of points collected in iteration so far.