13#ifndef ROOT_Math_DistSampler
14#define ROOT_Math_DistSampler
36 class DistSamplerOptions;
71 template<
class Function>
81 SetFunction<const ROOT::Math::IGenFunction>(func, 1);
101 virtual bool Init(
const char * =
"") {
return true;}
171 return &
fData.front();
187 virtual bool SampleBin(
double prob,
double & value,
double * error = 0) {
189 if (error) *error = 0;
198 virtual bool SampleBins(
unsigned int n,
const double * prob,
double * values,
double * errors = 0) {
199 std::copy(prob,prob+
n, values);
200 if (errors) std::fill(errors,errors+
n,0);
229 int nbs[1]; nbs[0] = nbins;
230 return Generate(nevt, nbs, data, extend);
Double_t(* Function)(Double_t)
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 unbinned 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 rerturning array x with coordinates
virtual 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 ...
virtual bool Sample(double *x)=0
sample one event in multi-dimension by filling the given array return false if sampling failed
ROOT::Fit::DataRange * fRange
virtual void DoSetFunction(const ROOT::Math::IMultiGenFunction &func, bool copy)
const ROOT::Math::IMultiGenFunction & ParentPdf() const
get the parent distribution function (must be called after setting the function)
bool Generate(unsigned int nevt, int nbins, double xmin, double xmax, ROOT::Fit::BinData &data, bool extend=true)
same as before but passing the range in case of 1 dim data
unsigned int NDim() const
return the dimension of the parent distribution (and the data)
virtual void SetFunction(const ROOT::Math::IGenFunction &func)
set the parent function distribution to use for random sampling (one dim case)
virtual ~DistSampler()
virtual destructor
virtual bool Generate(unsigned int nevt, ROOT::Fit::UnBinData &data)
generate a un-binned data sets (fill the given data set) if dataset has already data append to it
const ROOT::Math::IMultiGenFunction * fFunc
DistSampler()
default constructor
void SetRange(double xmin, double xmax, int icoord=0)
set range in a given dimension
const ROOT::Fit::DataRange & PdfRange() const
return the data range of the Pdf . Must be called after setting the function
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the parent function distribution to use for random sampling (multi-dim case)
void SetFunction(Function &func, unsigned int dim)
set the parent function distribution to use for sampling (generic case)
virtual TRandom * GetRandom()
Get the random engine used by the sampler To be implemented by the derived classes who needs it Retur...
virtual bool Init(const char *="")
initialize the generators with the given algorithm Implemented by derived classes who needs it (like ...
virtual void SetArea(double)
set the normalization area of distribution implemented by derived classes if needed
virtual double Sample1D()
sample one event in one dimension better implementation could be provided by the derived classes
virtual void SetRandom(TRandom *)
Set the random engine to be used To be implemented by the derived classes who provides random samplin...
virtual bool SampleBins(unsigned int n, const double *prob, double *values, double *errors=0)
sample a set of bins given a vector of probabilities Typically multinomial statistics will be used an...
std::vector< double > fData
virtual void SetMode(double)
set the mode of the distribution (could be useful to some methods) implemented by derived classes if ...
virtual void SetSeed(unsigned int)
Set the random seed for the TRandom instances used by the sampler classes To be implemented by the de...
Documentation for the abstract class IBaseFunctionMultiDim.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
This is the base class for the ROOT Random number generators.
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...