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 =
"")
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)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
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
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.
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...