12#ifndef ROOT_TUnuranSampler
13#define ROOT_TUnuranSampler
63 using DistSampler::SetFunction;
84 bool Init(
const char * algo =
"")
override;
104 void SetSeed(
unsigned int seed)
override;
123 void SetMode(
const std::vector<double> &modes)
override;
154 bool Sample(
double *
x)
override;
167 bool SampleBin(
double prob,
double & value,
double *error =
nullptr)
override;
#define ClassDef(name, id)
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
class describing the range in the coordinates it supports multiple range in a coordinate.
Class describing the un-binned data sets (just x coordinates values) of any dimensions.
DistSampler options class.
Interface class for generic sampling of a distribution, i.e.
const double * Sample()
Sample one event and return an array x with sample coordinates values.
This is the base class for the ROOT Random number generators.
const ROOT::Math::IGenFunction * fDPDF
1D Derivative function pointer
bool Init(const char *algo="") override
initialize the generators with the given algorithm If no algorithm is passed used the default one for...
const ROOT::Math::IGenFunction * fCDF
CDF function pointer.
void SetRandom(TRandom *r) override
Set the random engine to be used Needs to be called before Init to have effect.
void SetUseLogPdf(bool on=true) override
Set using of logarithm of PDF (only for 1D continuous case).
void SetFunction(const ROOT::Math::IGenFunction &func) override
Set the parent function distribution to use for random sampling (one dim case).
TRandom * GetRandom() override
Get the random engine used by the sampler.
bool fHasMode
flag to indicate if a mode is set
bool fHasArea
flag to indicate if a area is set
void SetSeed(unsigned int seed) override
Set the random seed for the TRandom instances used by the sampler classes Needs to be called before I...
void SetPrintLevel(int level)
Set the print level (if level=-1 use default).
bool DoInitND(const char *algo)
Initialization for multi-dim distributions.
TUnuran * fUnuran
unuran engine class
void SetArea(double area) override
Set the normalization area of distribution.
const ROOT::Math::IGenFunction * fFunc1D
1D function pointer (pdf)
bool DoInit1D(const char *algo)
Initialization for 1D distributions.
void SetMode(double mode) override
Set the mode of the distribution (1D case).
bool fUseLogPdf
flag to indicate if we use the log of the PDF
double Sample1D() override
sample one event in one dimension better implementation could be provided by the derived classes
void SetDPdf(const ROOT::Math::IGenFunction &dpdf) override
set the Derivative of the PDF used for random sampling (one dim continuous case)
TUnuranSampler()
default constructor
bool fDiscrete
flag to indicate if the function is discrete
bool fOneDim
flag to indicate if the function is 1 dimension
void SetCdf(const ROOT::Math::IGenFunction &cdf) override
set the cumulative distribution function of the PDF used for random sampling (one dim case)
double fMode
mode of dist (1D)
std::vector< double > fNDMode
mode of the multi-dim distribution
~TUnuranSampler() override
virtual destructor
bool SampleBin(double prob, double &value, double *error=nullptr) override
sample one bin given an estimated of the pdf in the bin (this can be function value at the center or ...
bool DoInitDiscrete1D(const char *algo)
Initialization for 1D discrete distributions.
Namespace for the fitting classes.
IBaseFunctionOneDim IGenFunction