herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
MonacoSampler.h
1// -*- C++ -*-
2//
3// MonacoSampler.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4// Copyright (C) 2002-2019 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
27namespace Herwig {
28
29using namespace ThePEG;
30
41
42public:
43
50
54 virtual ~MonacoSampler();
56
57public:
58
62 Ptr<MonacoSampler>::ptr cloneMe() const {
63 return dynamic_ptr_cast<Ptr<MonacoSampler>::ptr>(clone());
64 }
65
66public:
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
111public:
112
120
126 void persistentInput(PersistentIStream & is, int version);
128
135 static void Init();
136
137protected:
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
158private:
159
163 double theAlpha;
164
169
175 boost::numeric::ublas::matrix<double> theGrid;
176
180 boost::numeric::ublas::matrix<double> theGridData;
181
182private:
183
188
189private:
190
196
197};
198
199}
200
201#endif /* Herwig_MonacoSampler_H */
BinSampler samples XCombs bins. This default implementation performs flat MC integration.
Definition: BinSampler.h:38
MonacoSampler samples XCombs bins using using Monaco.
Definition: MonacoSampler.h:40
virtual void initialize(bool progress)
Initialize this bin sampler.
virtual void saveGrid() const
Save grid data.
MonacoSampler()
The default constructor.
virtual void adapt()
Adapt this sampler after an iteration has been run.
virtual IBPtr clone() const
Make a simple clone of this object.
virtual void fromXML(const XML::Element &)
Fill Monaco grid data from an XML element.
size_t theGridDivisions
Number of grid divisions per dimension.
static void Init()
The standard Init function used to initialize the interfaces.
virtual XML::Element toXML() const
Return an XML element for the data of the Monaco grid.
size_t theIterationPoints
Number of points collected in iteration so far.
virtual ~MonacoSampler()
The destructor.
MonacoSampler & operator=(const MonacoSampler &)=delete
The assignment operator is private and must never be called.
boost::numeric::ublas::matrix< double > theGrid
Grid boundaries (first index: dimension of random numbers, second index: dimension of partitions per ...
boost::numeric::ublas::matrix< double > theGridData
Collected value per grid bin.
virtual double generate()
Generate the next point and return its weight; store the point in lastPoint().
virtual bool existsGrid() const
Return true, if grid data exists for this sampler.
virtual void finalize(bool)
Finalize this sampler.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
double theAlpha
Rate of grid modification (0 for no modification)
Ptr< MonacoSampler >::ptr cloneMe() const
Clone this object.
Definition: MonacoSampler.h:62
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
Element represents a (tree of) XML elements.
Definition: Element.h:56
-*- C++ -*-
ThePEG::Ptr< InterfacedBase >::pointer IBPtr