File: Integrator.h
Description:
Integrator calculates an approximate integral of any
reasonable function of one variable over a simple interval. It is
also possible to sample the function within this interval, in which
case a rejection weight is provided to be able to get a correctly
distributed sample and an correct Monte Carlo estimate of the
integral.
See
also:
namespace Pythia7
template <typename FncT, typename RetT = double,
typename ValT = double, typename ArgT = double>
CLASS
Integrator
Public members:
typedef pair<ArgT,ValT> IBin;
typedef list<IBin> BinList;
typedef BinList::iterator Bin;
typedef BinList::const_iterator CBin;
typedef Selector<CBin> SelT;
typedef set<ArgT> PeakSet;
Integrator(const FncT & fncin, ArgT minin, ArgT maxin,
double weightminin = 0.999, double weightmaxin = 1.001);
The standard ctor.
template <typename Iterator>
Integrator(const FncT & fncin, ArgT minin, ArgT maxin,
double weightmin, double weightmax,
Iterator peak0in, Iterator peaknin);
Ctor with information about possible peaks.
inline RetT integral() const;
Return the approximation of the integral.
ArgT generate(double rnd, double & weight) const;
Generate a value according to the given function giving weight
corresponding to the overestimation used in the numerical
integration for this point.
inline const FncT & function() const;
Return a reference to the function used.
Protected members:
void init(const PeakSet & peaks);
Initialize.
void checksplit(Bin lo, Bin up);
Split the upper bin in into two recursively until the
approximation x^beta agrees with the actual function value
withing the limits specified by the min/max weights.
inline ArgT generate(CBin lo, CBin up, double rnd) const;
Generate a value in the u bin according to the x^beta
approximation.
inline RetT integrate(Bin lo, Bin up) const;
perform the integration of the approximate x^beta in the u bin.
Private members:
const FncT & fnc;
ArgT xmin;
ArgT xmax;
double wmin;
double wmax;
BinList bins;
SelT selector;
Integrator();
Integrator(const Integrator &);
const Integrator & operator=(const Integrator &);
DEFINED MACROS
INCLUDED FILES
Pythia7/Config/Pythia7.h
Pythia7/Utilities/Selector.h
Integrator.icc
Integrator.tcc