Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TUnuranMultiContDist Class Reference

TUnuranMultiContDist class describing multi dimensional continuous distributions.

It is used by TUnuran to generate a set of random numbers according to this distribution via TUnuran::Sample(double *). The class can be constructed from a multi-dimensional function (TF1 pointer, which can be actually also a TF2 or a TF3). It provides a method to set the domain of the distribution ( SetDomain ) which will correspond to the range of the generated random numbers. By default the domain is [(-inf,-inf,...)(+inf,+inf,...)], independently of the range set in the TF1 class used to construct the distribution.

The derivatives of the pdf which are used by some UNURAN methods are estimated numerically in the Derivative() method. Some extra information (like distribution mode) can be set using SetMode. Some methods require instead of the pdf the log of the pdf. This can also be controlled by setting a flag when constructing this class.

Definition at line 47 of file TUnuranMultiContDist.h.

Public Member Functions

 TUnuranMultiContDist (const ROOT::Math::IMultiGenFunction &pdf, bool isLogPdf=false)
 Constructor as before but from a generic function object interface for multi-dim functions.
 
 TUnuranMultiContDist (const TUnuranMultiContDist &)
 Copy constructor.
 
 TUnuranMultiContDist (TF1 *func=nullptr, unsigned int dim=0, bool isLogPdf=false)
 Constructor from a TF1 object representing the Probability density function.
 
 ~TUnuranMultiContDist () override
 Destructor.
 
TUnuranMultiContDistClone () const override
 Clone (required by base class)
 
double Derivative (const double *x, int icoord) const
 evaluate the partial derivative for the given coordinate.
 
const doubleGetLowerDomain () const
 get the distribution lower domain values.
 
const doubleGetMode () const
 get the mode (vector of coordinate positions of the maxima of the distribution) If a mode has not defined return a NULL pointer
 
const doubleGetUpperDomain () const
 get the distribution upper domain values.
 
void Gradient (const double *x, double *grad) const
 evaluate the gradient vector of the Pdf.
 
TClassIsA () const override
 
bool IsLogPdf () const
 flag to control if given function represent the log of a pdf
 
unsigned int NDim () const
 get number of dimension of the distribution
 
TUnuranMultiContDistoperator= (const TUnuranMultiContDist &rhs)
 Assignment operator.
 
double Pdf (const double *x) const
 evaluate the probability density function, used by UnuRan
 
void SetDomain (const double *xmin, const double *xmax)
 set the domain of the distribution giving an array of minimum and maximum values By default otherwise the domain is undefined, i.e.
 
void SetMode (const double *x)
 set the mode of the distribution (coordinates of the distribution maximum values)
 
void Streamer (TBuffer &) override
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TUnuranBaseDist
virtual ~TUnuranBaseDist ()
 Destructor (no operations)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TUnuranBaseDist
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 

Private Attributes

bool fIsLogPdf
 flag to control if function pointer represent log of pdf
 
std::vector< doublefMode
 vector representing the x coordinates of the maximum of the pdf
 
bool fOwnFunc
 flag to indicate if class manages the function pointers
 
const ROOT::Math::IMultiGenFunctionfPdf
 
std::vector< doublefXmax
 vector with upper x values of the domain
 
std::vector< doublefXmin
 vector with lower x values of the domain
 

#include <TUnuranMultiContDist.h>

Inheritance diagram for TUnuranMultiContDist:
[legend]

Constructor & Destructor Documentation

◆ TUnuranMultiContDist() [1/3]

TUnuranMultiContDist::TUnuranMultiContDist ( TF1 func = nullptr,
unsigned int  dim = 0,
bool  isLogPdf = false 
)

Constructor from a TF1 object representing the Probability density function.

The derivatives of the Pdf are estimated, when required by the UNURAN algorithm, using numerical derivation. If a value of dim 0 is passed , the dimension of the function is taken from TF1::GetNdim(). This works only for 2D and 3D (for TF2 and TF3 objects).

Definition at line 29 of file TUnuranMultiContDist.cxx.

◆ TUnuranMultiContDist() [2/3]

TUnuranMultiContDist::TUnuranMultiContDist ( const ROOT::Math::IMultiGenFunction pdf,
bool  isLogPdf = false 
)

Constructor as before but from a generic function object interface for multi-dim functions.

Definition at line 20 of file TUnuranMultiContDist.cxx.

◆ ~TUnuranMultiContDist()

TUnuranMultiContDist::~TUnuranMultiContDist ( )
override

Destructor.

Definition at line 69 of file TUnuranMultiContDist.cxx.

◆ TUnuranMultiContDist() [3/3]

TUnuranMultiContDist::TUnuranMultiContDist ( const TUnuranMultiContDist rhs)

Copy constructor.

Definition at line 43 of file TUnuranMultiContDist.cxx.

Member Function Documentation

◆ Class()

static TClass * TUnuranMultiContDist::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TUnuranMultiContDist::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TUnuranMultiContDist::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 176 of file TUnuranMultiContDist.h.

◆ Clone()

TUnuranMultiContDist * TUnuranMultiContDist::Clone ( ) const
inlineoverridevirtual

Clone (required by base class)

Implements TUnuranBaseDist.

Definition at line 86 of file TUnuranMultiContDist.h.

◆ DeclFileName()

static const char * TUnuranMultiContDist::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 176 of file TUnuranMultiContDist.h.

◆ Derivative()

double TUnuranMultiContDist::Derivative ( const double x,
int  icoord 
) const

evaluate the partial derivative for the given coordinate.

Used by UnuRan

Definition at line 92 of file TUnuranMultiContDist.cxx.

◆ GetLowerDomain()

const double * TUnuranMultiContDist::GetLowerDomain ( ) const
inline

get the distribution lower domain values.

Return a null pointer if domain is not defined

Definition at line 119 of file TUnuranMultiContDist.h.

◆ GetMode()

const double * TUnuranMultiContDist::GetMode ( ) const
inline

get the mode (vector of coordinate positions of the maxima of the distribution) If a mode has not defined return a NULL pointer

Definition at line 136 of file TUnuranMultiContDist.h.

◆ GetUpperDomain()

const double * TUnuranMultiContDist::GetUpperDomain ( ) const
inline

get the distribution upper domain values.

Return a null pointer if domain is not defined

Definition at line 126 of file TUnuranMultiContDist.h.

◆ Gradient()

void TUnuranMultiContDist::Gradient ( const double x,
double grad 
) const

evaluate the gradient vector of the Pdf.

Used by UnuRan

Definition at line 82 of file TUnuranMultiContDist.cxx.

◆ IsA()

TClass * TUnuranMultiContDist::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TUnuranBaseDist.

Definition at line 176 of file TUnuranMultiContDist.h.

◆ IsLogPdf()

bool TUnuranMultiContDist::IsLogPdf ( ) const
inline

flag to control if given function represent the log of a pdf

Definition at line 145 of file TUnuranMultiContDist.h.

◆ NDim()

unsigned int TUnuranMultiContDist::NDim ( ) const
inline

get number of dimension of the distribution

Definition at line 92 of file TUnuranMultiContDist.h.

◆ operator=()

TUnuranMultiContDist & TUnuranMultiContDist::operator= ( const TUnuranMultiContDist rhs)

Assignment operator.

Definition at line 51 of file TUnuranMultiContDist.cxx.

◆ Pdf()

double TUnuranMultiContDist::Pdf ( const double x) const

evaluate the probability density function, used by UnuRan

Definition at line 75 of file TUnuranMultiContDist.cxx.

◆ SetDomain()

void TUnuranMultiContDist::SetDomain ( const double xmin,
const double xmax 
)
inline

set the domain of the distribution giving an array of minimum and maximum values By default otherwise the domain is undefined, i.e.

is [-inf,+inf] To remove the domain do a SetDomain(0,0). There is no possibility to have a domain defined in only one coordinate. Use instead inf or DOUBLE_MAX to specify un infinite domain in that coordinate

Definition at line 103 of file TUnuranMultiContDist.h.

◆ SetMode()

void TUnuranMultiContDist::SetMode ( const double x)
inline

set the mode of the distribution (coordinates of the distribution maximum values)

Definition at line 112 of file TUnuranMultiContDist.h.

◆ Streamer()

void TUnuranMultiContDist::Streamer ( TBuffer )
overridevirtual

Reimplemented from TUnuranBaseDist.

◆ StreamerNVirtual()

void TUnuranMultiContDist::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 176 of file TUnuranMultiContDist.h.

Member Data Documentation

◆ fIsLogPdf

bool TUnuranMultiContDist::fIsLogPdf
private

flag to control if function pointer represent log of pdf

Definition at line 172 of file TUnuranMultiContDist.h.

◆ fMode

std::vector<double> TUnuranMultiContDist::fMode
private

vector representing the x coordinates of the maximum of the pdf

Definition at line 170 of file TUnuranMultiContDist.h.

◆ fOwnFunc

bool TUnuranMultiContDist::fOwnFunc
private

flag to indicate if class manages the function pointers

Definition at line 173 of file TUnuranMultiContDist.h.

◆ fPdf

const ROOT::Math::IMultiGenFunction* TUnuranMultiContDist::fPdf
private

Definition at line 166 of file TUnuranMultiContDist.h.

◆ fXmax

std::vector<double> TUnuranMultiContDist::fXmax
private

vector with upper x values of the domain

Definition at line 169 of file TUnuranMultiContDist.h.

◆ fXmin

std::vector<double> TUnuranMultiContDist::fXmin
private

vector with lower x values of the domain

Definition at line 168 of file TUnuranMultiContDist.h.

Libraries for TUnuranMultiContDist:

The documentation for this class was generated from the following files: