ROOT 6.18/05 Reference Guide |
TUnuranSampler class class implementing the ROOT::Math::DistSampler interface using the UNU.RAN package for sampling distributions.
Definition at line 49 of file TUnuranSampler.h.
Public Member Functions | |
TUnuranSampler () | |
default constructor More... | |
virtual | ~TUnuranSampler () |
virtual destructor More... | |
TRandom * | GetRandom () |
Get the random engine used by the sampler. More... | |
bool | Init (const char *algo="") |
initialize the generators with the given algorithm If no algorithm is passed used the default one for the type of distribution More... | |
bool | Init (const ROOT::Math::DistSamplerOptions &opt) |
initialize the generators with the given algorithm If no algorithm is passed used the default one for the type of distribution More... | |
bool | Sample (double *x) |
sample one event in multi-dimension by filling the given array return false if sampling failed More... | |
double | Sample1D () |
sample one event in one dimension better implementation could be provided by the derived classes More... | |
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 More... | |
void | SetArea (double area) |
set the normalization area of distribution implemented by derived classes if needed More... | |
void | SetFunction (const ROOT::Math::IGenFunction &func) |
set the parent function distribution to use for random sampling (one dim case) More... | |
void | SetFunction (TF1 *pdf) |
set the Function using a TF1 pointer More... | |
void | SetMode (double mode) |
set the mode of the distribution (could be useful to some methods) implemented by derived classes if needed More... | |
void | SetPrintLevel (int level) |
Set the print level (if level=-1 use default) More... | |
void | SetRandom (TRandom *r) |
Set the random engine to be used Needs to be called before Init to have effect. More... | |
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. More... | |
Public Member Functions inherited from ROOT::Math::DistSampler | |
DistSampler () | |
default constructor More... | |
virtual | ~DistSampler () |
virtual destructor More... | |
virtual bool | Generate (unsigned int nevt, const int *nbins, ROOT::Fit::BinData &data, bool extend=true) |
generate a bin data set . More... | |
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 More... | |
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 More... | |
virtual TRandom * | GetRandom () |
Get the random engine used by the sampler To be implemented by the derived classes who needs it Returns zero by default. More... | |
virtual bool | Init (const char *="") |
initialize the generators with the given algorithm Implemented by derived classes who needs it (like UnuranSampler) If nothing is specified use default algorithm from DistSamplerOptions::SetDefaultAlgorithm More... | |
virtual bool | Init (const DistSamplerOptions &opt) |
initialize the generators with the given option which my include the algorithm but also more if the method is re-impelmented by derived class The default implementation calls the above method passing just the algorithm name More... | |
unsigned int | NDim () const |
return the dimension of the parent distribution (and the data) More... | |
const ROOT::Math::IMultiGenFunction & | ParentPdf () const |
get the parent distribution function (must be called after setting the function) More... | |
const double * | Sample () |
sample one event and rerturning array x with coordinates More... | |
virtual bool | Sample (double *x)=0 |
sample one event in multi-dimension by filling the given array return false if sampling failed More... | |
virtual double | Sample1D () |
sample one event in one dimension better implementation could be provided by the derived classes More... | |
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 its integral in the bin divided by the bin width) By default do not do random sample, just return the function values Typically Poisson statistics will be used More... | |
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 More... | |
virtual void | SetArea (double) |
set the normalization area of distribution implemented by derived classes if needed More... | |
virtual void | SetFunction (const ROOT::Math::IGenFunction &func) |
set the parent function distribution to use for random sampling (one dim case) More... | |
virtual void | SetFunction (const ROOT::Math::IMultiGenFunction &func) |
set the parent function distribution to use for random sampling (multi-dim case) More... | |
template<class Function > | |
void | SetFunction (Function &func, unsigned int dim) |
set the parent function distribution to use for sampling (generic case) More... | |
virtual void | SetMode (double) |
set the mode of the distribution (could be useful to some methods) implemented by derived classes if needed More... | |
virtual void | SetRandom (TRandom *) |
Set the random engine to be used To be implemented by the derived classes who provides random sampling. More... | |
void | SetRange (const double *xmin, const double *xmax) |
set range for all dimensions More... | |
void | SetRange (const ROOT::Fit::DataRange &range) |
set range using DataRange class More... | |
void | SetRange (double xmin, double xmax, int icoord=0) |
set range in a given dimension More... | |
virtual void | SetSeed (unsigned int) |
Set the random seed for the TRandom instances used by the sampler classes To be implemented by the derived classes who provides random sampling. More... | |
Protected Member Functions | |
bool | DoInit1D (const char *algo) |
bool | DoInitDiscrete1D (const char *algo) |
bool | DoInitND (const char *algo) |
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 More... | |
Private Attributes | |
double | fArea |
bool | fDiscrete |
const ROOT::Math::IGenFunction * | fFunc1D |
bool | fHasArea |
bool | fHasMode |
int | fLevel |
double | fMode |
bool | fOneDim |
TUnuran * | fUnuran |
#include <TUnuranSampler.h>
TUnuranSampler::TUnuranSampler | ( | ) |
default constructor
Definition at line 32 of file TUnuranSampler.cxx.
|
virtual |
virtual destructor
Definition at line 43 of file TUnuranSampler.cxx.
|
protected |
Definition at line 100 of file TUnuranSampler.cxx.
|
protected |
Definition at line 130 of file TUnuranSampler.cxx.
|
protected |
Definition at line 165 of file TUnuranSampler.cxx.
|
virtual |
Get the random engine used by the sampler.
Reimplemented from ROOT::Math::DistSampler.
Definition at line 201 of file TUnuranSampler.cxx.
|
virtual |
initialize the generators with the given algorithm If no algorithm is passed used the default one for the type of distribution
Reimplemented from ROOT::Math::DistSampler.
Definition at line 48 of file TUnuranSampler.cxx.
|
virtual |
initialize the generators with the given algorithm If no algorithm is passed used the default one for the type of distribution
Reimplemented from ROOT::Math::DistSampler.
Definition at line 93 of file TUnuranSampler.cxx.
|
virtual |
sample one event in multi-dimension by filling the given array return false if sampling failed
Implements ROOT::Math::DistSampler.
Definition at line 211 of file TUnuranSampler.cxx.
|
virtual |
sample one event in one dimension better implementation could be provided by the derived classes
Reimplemented from ROOT::Math::DistSampler.
Definition at line 206 of file TUnuranSampler.cxx.
|
virtual |
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 219 of file TUnuranSampler.cxx.
|
inlinevirtual |
set the normalization area of distribution implemented by derived classes if needed
Reimplemented from ROOT::Math::DistSampler.
Definition at line 116 of file TUnuranSampler.h.
|
inlinevirtual |
set the parent function distribution to use for random sampling (one dim case)
Reimplemented from ROOT::Math::DistSampler.
Definition at line 64 of file TUnuranSampler.h.
set the Function using a TF1 pointer
Definition at line 186 of file TUnuranSampler.cxx.
|
inlinevirtual |
set the mode of the distribution (could be useful to some methods) implemented by derived classes if needed
Reimplemented from ROOT::Math::DistSampler.
Definition at line 108 of file TUnuranSampler.h.
|
inline |
Set the print level (if level=-1 use default)
Definition at line 103 of file TUnuranSampler.h.
Set the random engine to be used Needs to be called before Init to have effect.
Reimplemented from ROOT::Math::DistSampler.
Definition at line 191 of file TUnuranSampler.cxx.
|
virtual |
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 196 of file TUnuranSampler.cxx.
|
private |
Definition at line 174 of file TUnuranSampler.h.
|
private |
Definition at line 169 of file TUnuranSampler.h.
|
private |
Definition at line 175 of file TUnuranSampler.h.
|
private |
Definition at line 171 of file TUnuranSampler.h.
|
private |
Definition at line 170 of file TUnuranSampler.h.
|
private |
Definition at line 172 of file TUnuranSampler.h.
|
private |
Definition at line 173 of file TUnuranSampler.h.
|
private |
Definition at line 168 of file TUnuranSampler.h.
|
private |
Definition at line 176 of file TUnuranSampler.h.