13 #ifndef ROOT_Math_DistSampler
14 #define ROOT_Math_DistSampler
16 #ifndef ROOT_Math_IFunctionfwd
20 #ifndef ROOT_Math_WrappedFunction
40 class DistSamplerOptions;
75 template<
class Function>
85 SetFunction<const ROOT::Math::IGenFunction>(
func, 1);
105 virtual bool Init(
const char * =
"") {
return true;}
175 return &
fData.front();
182 virtual bool Sample(
double *
x) = 0;
193 if (error) *error = 0;
202 virtual bool SampleBins(
unsigned int n,
const double * prob,
double * values,
double * errors = 0) {
203 std::copy(prob,prob+n, values);
204 if (errors)
std::fill(errors,errors+n,0);
233 int nbs[1]; nbs[0] =
nbins;
234 return Generate(nevt, nbs, data, extend);
virtual void SetMode(double)
set the mode of the distribution (could be useful to some methods) implemented by derived classes if ...
DistSampler()
default constructor
std::vector< double > fData
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
unsigned int NDim() const
return the dimension of the parent distribution (and the data)
Namespace for new ROOT classes and functions.
const double * Sample()
sample one event and rerturning array x with coordinates
virtual void SetFunction(const ROOT::Math::IGenFunction &func)
set the parent function distribution to use for random sampling (one dim case)
Class describing the unbinned data sets (just x coordinates values) of any dimensions.
const ROOT::Math::IMultiGenFunction & ParentPdf() const
get the parent distribution function (must be called after setting the function)
const ROOT::Fit::DataRange & PdfRange() const
return the data range of the Pdf . Must be called after setting the function
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
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 ...
This is the base class for the ROOT Random number generators.
void SetFunction(Function &func, unsigned int dim)
set the parent function distribution to use for sampling (generic case)
virtual ~DistSampler()
virtual destructor
virtual void SetRandom(TRandom *)
Set the random engine to be used To be implemented by the derived classes who provides random samplin...
DistSampler options class.
ROOT::Fit::DataRange * fRange
const ROOT::Math::IMultiGenFunction * fFunc
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
virtual double Sample1D()
sample one event in one dimension better implementation could be provided by the derived classes ...
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...
virtual void SetArea(double)
set the normalization area of distribution implemented by derived classes if needed ...
void SetRange(double xmin, double xmax, int icoord=0)
set range in a given dimension
Interface class for generic sampling of a distribution, i.e.
class describing the range in the coordinates it supports multiple range in a coordinate.
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
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
double func(double *x, double *p)
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
Namespace for new Math classes and functions.
virtual void SetSeed(unsigned int)
Set the random seed for the TRandom instances used by the sampler classes To be implemented by the de...
virtual bool Init(const char *="")
initialize the generators with the given algorithm Implemented by derived classes who needs it (like ...
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 void DoSetFunction(const ROOT::Math::IMultiGenFunction &func, bool copy)
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)
set the parent function distribution to use for random sampling (multi-dim case)
Documentation for the abstract class IBaseFunctionMultiDim.
virtual TRandom * GetRandom()
Get the random engine used by the sampler To be implemented by the derived classes who needs it Retur...