TUnuranContDist Class Reference

#include <TUnuranContDist.h>

Inheritance diagram for TUnuranContDist:

TUnuranBaseDist List of all members.

Public Member Functions

 TUnuranContDist (TF1 *pdf=0, TF1 *deriv=0, bool isLogPdf=false)
 TUnuranContDist (const ROOT::Math::IGenFunction &pdf, const ROOT::Math::IGenFunction *dpdf=0, bool isLogPdf=false, bool copyFunc=false)
virtual ~TUnuranContDist ()
 TUnuranContDist (const TUnuranContDist &)
TUnuranContDistoperator= (const TUnuranContDist &rhs)
virtual TUnuranContDistClone () const
void SetCdf (TF1 *cdf)
void SetCdf (const ROOT::Math::IGenFunction &cdf)
void SetDomain (double xmin, double xmax)
void SetMode (double mode)
void SetPdfArea (double area)
bool GetDomain (double &xmin, double &xmax) const
bool HasCdf () const
bool HasMode () const
bool HasPdfArea () const
double Mode () const
double PdfArea () const
bool IsLogPdf () const
double Pdf (double x) const
double DPdf (double x) const
double Cdf (double x) const

Private Attributes

const ROOT::Math::IGenFunctionfPdf
const ROOT::Math::IGenFunctionfDPdf
const ROOT::Math::IGenFunctionfCdf
double fXmin
double fXmax
double fMode
double fArea
bool fIsLogPdf
bool fHasDomain
bool fHasMode
bool fHasArea
bool fOwnFunc

Detailed Description

TUnuranContDist class describing one dimensional continous distribution. It is used by TUnuran to generate random numbers according to this distribution via TUnuran::Sample()

The class can be constructed from a function (TF1) representing the probability density function of the distribution. Optionally the derivative of the pdf can also be passed.

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), indipendently of the range set in the TF1 class used to construct the distribution.

In addition, some UNURAN methods requires extra information (cdf function, distribution mode, area of pdf, etc...). This information can as well be set. 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 48 of file TUnuranContDist.h.


Constructor & Destructor Documentation

TUnuranContDist::TUnuranContDist ( TF1 pdf = 0,
TF1 deriv = 0,
bool  isLogPdf = false 
) [explicit]

Constructor from a TF1 objects specifying the pdf and optionally from another function representing the derivative of the pdf. The flag isLogPdf can be used to pass instead of the pdf (and its derivative) the log (and the derivative of the log) of the pdf. By default the distribution has not domain set (it is defined between [-inf,+inf], no mode, no pdf area and no cdf explicity defined. UnuRan, if needed, can compute some of this quantities, but the user if he knows them can set them in order to speed up the algorithm. For example in case of the Cdf, if the user has not set it, a numerical integration algorithm is used to estimate the Cdf from the Pdf. In case an algorithm requires only the Cdf (no Pdf), an empty distribution can be constructed and then the user must set afterwards the Cdf.

Definition at line 48 of file TUnuranContDist.cxx.

Referenced by Clone().

TUnuranContDist::TUnuranContDist ( const ROOT::Math::IGenFunction pdf,
const ROOT::Math::IGenFunction dpdf = 0,
bool  isLogPdf = false,
bool  copyFunc = false 
) [explicit]

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

TUnuranContDist::~TUnuranContDist (  )  [virtual]

Destructor

Definition at line 107 of file TUnuranContDist.cxx.

References fCdf, fDPdf, fOwnFunc, and fPdf.

TUnuranContDist::TUnuranContDist ( const TUnuranContDist  ) 

Copy constructor

Definition at line 67 of file TUnuranContDist.cxx.

References operator=().


Member Function Documentation

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

Assignment operator

Definition at line 77 of file TUnuranContDist.cxx.

References ROOT::Math::IBaseFunctionOneDim::Clone(), fArea, fCdf, fDPdf, fHasArea, fHasDomain, fHasMode, fIsLogPdf, fMode, fOwnFunc, fPdf, fXmax, and fXmin.

Referenced by TUnuranContDist().

virtual TUnuranContDist* TUnuranContDist::Clone (  )  const [inline, virtual]

Clone (required by base class)

Implements TUnuranBaseDist.

Definition at line 91 of file TUnuranContDist.h.

References TUnuranContDist().

void TUnuranContDist::SetCdf ( TF1 cdf  ) 

set cdf distribution. If a method requires it and is not set it is then estimated using numerical integration from the pdf

Definition at line 122 of file TUnuranContDist.cxx.

References cdf(), ROOT::Math::IBaseFunctionOneDim::Clone(), fCdf, fDPdf, fOwnFunc, and fPdf.

void TUnuranContDist::SetCdf ( const ROOT::Math::IGenFunction cdf  ) 

set cdf distribution using a generic function interface

Definition at line 116 of file TUnuranContDist.cxx.

References cdf(), fCdf, and fOwnFunc.

void TUnuranContDist::SetDomain ( double  xmin,
double  xmax 
) [inline]

Set the distribution domain. If min < max a domain is defined otherwise is undefined

Definition at line 109 of file TUnuranContDist.h.

References fHasDomain, fXmax, and fXmin.

void TUnuranContDist::SetMode ( double  mode  )  [inline]

set the distribution mode (x position of its maximum)

Definition at line 121 of file TUnuranContDist.h.

References fHasMode, and fMode.

void TUnuranContDist::SetPdfArea ( double  area  )  [inline]

set the area below the pdf

Definition at line 126 of file TUnuranContDist.h.

References fArea, and fHasArea.

bool TUnuranContDist::GetDomain ( double xmin,
double xmax 
) const [inline]

check if distribution has a defined domain and return in case its domain

Definition at line 131 of file TUnuranContDist.h.

References fHasDomain, fXmax, and fXmin.

bool TUnuranContDist::HasCdf (  )  const [inline]

check if a cdf function is provided for the distribution

Definition at line 140 of file TUnuranContDist.h.

References fCdf.

bool TUnuranContDist::HasMode (  )  const [inline]

check if distribution has a pre-computed mode

Definition at line 145 of file TUnuranContDist.h.

References fHasMode.

bool TUnuranContDist::HasPdfArea (  )  const [inline]

check if distribution has a pre-computed area below the Pdf

Definition at line 151 of file TUnuranContDist.h.

References fHasArea.

double TUnuranContDist::Mode (  )  const [inline]

return the mode (x location of maximum of the pdf)

Definition at line 156 of file TUnuranContDist.h.

References fMode.

double TUnuranContDist::PdfArea (  )  const [inline]

return area below the pdf

Definition at line 161 of file TUnuranContDist.h.

References fArea.

bool TUnuranContDist::IsLogPdf (  )  const [inline]

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

Definition at line 167 of file TUnuranContDist.h.

References fIsLogPdf.

double TUnuranContDist::Pdf ( double  x  )  const

evaluate the Probability Density function. Used by the UnuRan algorithms

Definition at line 137 of file TUnuranContDist.cxx.

References fPdf.

double TUnuranContDist::DPdf ( double  x  )  const

evaluate the derivative of the pdf. Used by UnuRan

Definition at line 144 of file TUnuranContDist.cxx.

References ROOT::Math::RichardsonDerivator::Derivative1(), fDPdf, fPdf, and h.

double TUnuranContDist::Cdf ( double  x  )  const

evaluate the integral (cdf) on the domain. Used by Unuran algorithm

Definition at line 159 of file TUnuranContDist.cxx.

References fCdf, fPdf, fXmax, fXmin, and ROOT::Math::IntegratorOneDim::Integral().


Member Data Documentation

const ROOT::Math::IGenFunction* TUnuranContDist::fPdf [private]

Definition at line 191 of file TUnuranContDist.h.

Referenced by Cdf(), DPdf(), operator=(), Pdf(), SetCdf(), and ~TUnuranContDist().

const ROOT::Math::IGenFunction* TUnuranContDist::fDPdf [private]

Definition at line 192 of file TUnuranContDist.h.

Referenced by DPdf(), operator=(), SetCdf(), and ~TUnuranContDist().

const ROOT::Math::IGenFunction* TUnuranContDist::fCdf [private]

Definition at line 193 of file TUnuranContDist.h.

Referenced by Cdf(), HasCdf(), operator=(), SetCdf(), and ~TUnuranContDist().

double TUnuranContDist::fXmin [private]

Definition at line 195 of file TUnuranContDist.h.

Referenced by Cdf(), GetDomain(), operator=(), and SetDomain().

double TUnuranContDist::fXmax [private]

Definition at line 196 of file TUnuranContDist.h.

Referenced by Cdf(), GetDomain(), operator=(), and SetDomain().

double TUnuranContDist::fMode [private]

Definition at line 197 of file TUnuranContDist.h.

Referenced by Mode(), operator=(), and SetMode().

double TUnuranContDist::fArea [private]

Definition at line 198 of file TUnuranContDist.h.

Referenced by operator=(), PdfArea(), and SetPdfArea().

bool TUnuranContDist::fIsLogPdf [private]

Definition at line 201 of file TUnuranContDist.h.

Referenced by IsLogPdf(), and operator=().

bool TUnuranContDist::fHasDomain [private]

Definition at line 202 of file TUnuranContDist.h.

Referenced by GetDomain(), operator=(), and SetDomain().

bool TUnuranContDist::fHasMode [private]

Definition at line 203 of file TUnuranContDist.h.

Referenced by HasMode(), operator=(), and SetMode().

bool TUnuranContDist::fHasArea [private]

Definition at line 204 of file TUnuranContDist.h.

Referenced by HasPdfArea(), operator=(), and SetPdfArea().

bool TUnuranContDist::fOwnFunc [private]

Definition at line 205 of file TUnuranContDist.h.

Referenced by operator=(), SetCdf(), and ~TUnuranContDist().


The documentation for this class was generated from the following files:
Generated on Tue Jul 5 16:48:16 2011 for ROOT_528-00b_version by  doxygen 1.5.1