12#ifndef ROOT_TUnuranSampler
13#define ROOT_TUnuranSampler
63 using DistSampler::SetFunction;
68 SetFunction<const ROOT::Math::IGenFunction>(func, 1);
84 bool Init(
const char * algo =
"");
104 void SetSeed(
unsigned int seed);
123 void SetMode(
const std::vector<double> &modes);
167 bool SampleBin(
double prob,
double & value,
double *error = 0);
#define ClassDef(name, id)
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.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
This is the base class for the ROOT Random number generators.
TUnuranSampler class class implementing the ROOT::Math::DistSampler interface using the UNU....
const ROOT::Math::IGenFunction * fDPDF
CDF function pointer.
double fArea
mode of dist (1D)
TRandom * GetRandom()
Get the random engine used by the sampler.
const ROOT::Math::IGenFunction * fCDF
1D function pointer (pdf)
void SetRandom(TRandom *r)
Set the random engine to be used Needs to be called before Init to have effect.
virtual ~TUnuranSampler()
virtual destructor
bool fHasMode
flag to indicate if the function is discrete
bool fHasArea
flag to indicate if a mode is set
bool SampleBin(double prob, double &value, double *error=0)
sample one bin given an estimated of the pdf in the bin (this can be function value at the center or ...
void SetPrintLevel(int level)
Set the print level (if level=-1 use default)
bool DoInitND(const char *algo)
Initialization for multi-dim distributions.
void SetSeed(unsigned int seed)
Set the random seed for the TRandom instances used by the sampler classes Needs to be called before I...
TUnuran * fUnuran
1D Derivative function pointer
const ROOT::Math::IGenFunction * fFunc1D
mode of the multi-dim distribution
void SetArea(double area)
Set the normalization area of distribution.
void SetCdf(const ROOT::Math::IGenFunction &cdf)
set the cumulative distribution function of the PDF used for random sampling (one dim case)
bool DoInit1D(const char *algo)
Initialization for 1D distributions.
void SetUseLogPdf(bool on=true)
Set using of logarithm of PDF (only for 1D continous case)
bool fUseLogPdf
flag to indicate if a area is set
void SetMode(double mode)
Set the mode of the distribution (1D case).
bool Init(const char *algo="")
initialize the generators with the given algorithm If no algorithm is passed used the default one for...
TUnuranSampler()
default constructor
bool fDiscrete
flag to indicate if the function is 1 dimension
void SetFunction(const ROOT::Math::IGenFunction &func)
Set the parent function distribution to use for random sampling (one dim case).
double Sample1D()
sample one event in one dimension better implementation could be provided by the derived classes
std::vector< double > fNDMode
area of dist
int fLevel
flag to indicate if we use the log of the PDF
bool DoInitDiscrete1D(const char *algo)
Initialization for 1D discrete distributions.
void SetDPdf(const ROOT::Math::IGenFunction &dpdf)
set the Derivative of the PDF used for random sampling (one dim continous case)
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...