class implementing the ROOT::Math::DistSampler interface using FOAM for sampling arbitrary distributions.
Definition at line 39 of file TFoamSampler.h.
Public Member Functions | |
TFoamSampler () | |
default constructor | |
virtual | ~TFoamSampler () |
virtual destructor | |
TRandom * | GetRandom () |
Get the random engine used by the sampler. | |
bool | Init (const char *="") |
initialize the generators with the default options | |
bool | Init (const ROOT::Math::DistSamplerOptions &opt) |
initialize the generators with the given options | |
bool | Sample (double *x) |
sample one event in multi-dimension by filling the given array return false if sampling failed | |
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 its integral in the bin divided by the bin width) By default do not do random sample, just return the function values | |
void | SetFunction (const ROOT::Math::IGenFunction &func) |
set the parent function distribution to use for random sampling (one dim case) | |
void | SetFunction (TF1 *pdf) |
set the Function using a TF1 pointer | |
void | SetRandom (TRandom *r) |
Set the random engine to be used Needs to be called before Init to have effect. | |
void | SetSeed (unsigned int seed) |
Set the random seed for the TRandom instances used by the sampler classes Needs to be called before Init to have effect. | |
Public Member Functions inherited from ROOT::Math::DistSampler | |
DistSampler () | |
default constructor | |
virtual | ~DistSampler () |
virtual destructor | |
virtual bool | Generate (unsigned int nevt, const int *nbins, ROOT::Fit::BinData &data, bool extend=true) |
generate a bin data set . | |
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 | |
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 | |
unsigned int | NDim () const |
return the dimension of the parent distribution (and the data) | |
const ROOT::Math::IMultiGenFunction & | ParentPdf () const |
get the parent distribution function (must be called after setting the function) | |
const double * | Sample () |
sample one event and rerturning array x with coordinates | |
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 and the sum of the probabilities will be equal to the total number of events to be generated For sampling the bins indipendently, SampleBin should be used | |
virtual void | SetArea (double) |
set the normalization area of distribution implemented by derived classes if needed | |
virtual void | SetFunction (const ROOT::Math::IMultiGenFunction &func) |
set the parent function distribution to use for random sampling (multi-dim case) | |
template<class Function > | |
void | SetFunction (Function &func, unsigned int dim) |
set the parent function distribution to use for sampling (generic case) | |
virtual void | SetMode (double) |
set the mode of the distribution (could be useful to some methods) implemented by derived classes if needed | |
void | SetRange (const double *xmin, const double *xmax) |
set range for all dimensions | |
void | SetRange (const ROOT::Fit::DataRange &range) |
set range using DataRange class | |
void | SetRange (double xmin, double xmax, int icoord=0) |
set range in a given dimension | |
Private Attributes | |
TFoam * | fFoam |
TFoamIntegrand * | fFoamDist |
const ROOT::Math::IGenFunction * | fFunc1D |
Additional Inherited Members | |
Protected Member Functions inherited from ROOT::Math::DistSampler | |
virtual void | DoSetFunction (const ROOT::Math::IMultiGenFunction &func, bool copy) |
bool | IsInitialized () |
const ROOT::Fit::DataRange & | PdfRange () const |
return the data range of the Pdf . Must be called after setting the function | |
#include <TFoamSampler.h>
TFoamSampler::TFoamSampler | ( | ) |
default constructor
Definition at line 82 of file TFoamSampler.cxx.
|
virtual |
virtual destructor
Definition at line 92 of file TFoamSampler.cxx.
|
virtual |
Get the random engine used by the sampler.
Reimplemented from ROOT::Math::DistSampler.
Definition at line 172 of file TFoamSampler.cxx.
|
virtual |
initialize the generators with the default options
Reimplemented from ROOT::Math::DistSampler.
Definition at line 98 of file TFoamSampler.cxx.
|
virtual |
initialize the generators with the given options
Reimplemented from ROOT::Math::DistSampler.
Definition at line 107 of file TFoamSampler.cxx.
sample one event in multi-dimension by filling the given array return false if sampling failed
Implements ROOT::Math::DistSampler.
Definition at line 182 of file TFoamSampler.cxx.
sample one bin given an estimated of the pdf in the bin (this can be function value at the center or its integral in the bin divided by the bin width) By default do not do random sample, just return the function values
Reimplemented from ROOT::Math::DistSampler.
Definition at line 195 of file TFoamSampler.cxx.
|
inlinevirtual |
set the parent function distribution to use for random sampling (one dim case)
Reimplemented from ROOT::Math::DistSampler.
Definition at line 54 of file TFoamSampler.h.
set the Function using a TF1 pointer
Definition at line 156 of file TFoamSampler.cxx.
Set the random engine to be used Needs to be called before Init to have effect.
Reimplemented from ROOT::Math::DistSampler.
Definition at line 161 of file TFoamSampler.cxx.
Set the random seed for the TRandom instances used by the sampler classes Needs to be called before Init to have effect.
Reimplemented from ROOT::Math::DistSampler.
Definition at line 166 of file TFoamSampler.cxx.
|
private |
Definition at line 120 of file TFoamSampler.h.
|
private |
Definition at line 121 of file TFoamSampler.h.
|
private |
Definition at line 119 of file TFoamSampler.h.