TUnuranEmpDist Class Reference

#include <TUnuranEmpDist.h>

Inheritance diagram for TUnuranEmpDist:

TUnuranBaseDist List of all members.

Public Member Functions

 TUnuranEmpDist (const TH1 *h1=0, bool useBuffer=true)
template<class Iterator>
 TUnuranEmpDist (Iterator begin, Iterator end, unsigned int dim=1)
 TUnuranEmpDist (unsigned int n, double *x)
 TUnuranEmpDist (unsigned int n, double *x, double *y)
 TUnuranEmpDist (unsigned int n, double *x, double *y, double *z)
virtual ~TUnuranEmpDist ()
 TUnuranEmpDist (const TUnuranEmpDist &)
TUnuranEmpDistoperator= (const TUnuranEmpDist &rhs)
TUnuranEmpDistClone () const
const std::vector< double > & Data () const
bool IsBinned () const
double LowerBin () const
double UpperBin () const
unsigned int NDim () const

Private Attributes

std::vector< doublefData
unsigned int fDim
double fMin
double fMax
bool fBinned

Detailed Description

TUnuranEmpDist class for describing empiral distributions. It is used by TUnuran to generate double random number according to this distribution via TUnuran::Sample() or TUnuran::Sample(double *) in case of multi-dimensional empirical distributions.

An empirical distribution can be one or multi-dimension constructed from a set of unbinned data, (the class can be constructed from an iterator to a vector of data) or by using an histogram (with apointer to the TH1 class). If the histogram contains a buffer with the original data they are used by default to estimate the empirical distribution, othewise the bins information is used. In this binned case only one dimension is now supported.

In the case of unbinned data the density distribution is estimated by UNURAN using kernel smoothing and then random numbers are generated. In the case of bin data (which can only be one dimension) the probability density is estimated directly from the histograms and the random numbers are generated according to the histogram (like in TH1::GetRandom). This method requires some initialization time but it is faster in generating the random numbers than TH1::GetRandom and it becomes convenient to use when generating a large amount of data.

Definition at line 48 of file TUnuranEmpDist.h.


Constructor & Destructor Documentation

TUnuranEmpDist::TUnuranEmpDist ( const TH1 h1 = 0,
bool  useBuffer = true 
)

Constructor from a TH1 objects. If the histogram has a buffer by default the unbinned data are used

Definition at line 20 of file TUnuranEmpDist.cxx.

References fBinned, fData, fDim, fMax, fMin, TH2D::GetBinContent(), TH1::GetBuffer(), TH1::GetBufferLength(), TH1::GetDimension(), TH1::GetNbinsX(), TH1::GetXaxis(), TAxis::GetXmax(), TAxis::GetXmin(), h1, i, n, and nbins.

Referenced by Clone().

template<class Iterator>
TUnuranEmpDist::TUnuranEmpDist ( Iterator  begin,
Iterator  end,
unsigned int  dim = 1 
) [inline]

Constructor from a set of data using an iterator to specify begin/end of the data In the case of multi-dimension the data are assumed to be passed in this order x0,y0,...x1,y1,..x2,y2,...

Definition at line 65 of file TUnuranEmpDist.h.

TUnuranEmpDist::TUnuranEmpDist ( unsigned int  n,
double x 
)

Constructor from a set of 1D data

Definition at line 58 of file TUnuranEmpDist.cxx.

TUnuranEmpDist::TUnuranEmpDist ( unsigned int  n,
double x,
double y 
)

Constructor from a set of 2D data

Definition at line 67 of file TUnuranEmpDist.cxx.

References fData, and i.

TUnuranEmpDist::TUnuranEmpDist ( unsigned int  n,
double x,
double y,
double z 
)

Constructor from a set of 3D data

Definition at line 80 of file TUnuranEmpDist.cxx.

References fData, and i.

virtual TUnuranEmpDist::~TUnuranEmpDist (  )  [inline, virtual]

Destructor (no operations)

Definition at line 90 of file TUnuranEmpDist.h.

TUnuranEmpDist::TUnuranEmpDist ( const TUnuranEmpDist  ) 

Copy constructor

Definition at line 96 of file TUnuranEmpDist.cxx.

References operator=().


Member Function Documentation

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

Assignment operator

Definition at line 103 of file TUnuranEmpDist.cxx.

References fBinned, fData, fDim, fMax, and fMin.

Referenced by TUnuranEmpDist().

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

Clone (required by base class)

Implements TUnuranBaseDist.

Definition at line 107 of file TUnuranEmpDist.h.

References TUnuranEmpDist().

const std::vector<double>& TUnuranEmpDist::Data (  )  const [inline]

Return reference to data vector (unbinned or binned data)

Definition at line 113 of file TUnuranEmpDist.h.

References fData.

bool TUnuranEmpDist::IsBinned (  )  const [inline]

Flag to control if data are binned

Definition at line 118 of file TUnuranEmpDist.h.

References fBinned.

double TUnuranEmpDist::LowerBin (  )  const [inline]

Min value of binned data (return 0 for unbinned data)

Definition at line 124 of file TUnuranEmpDist.h.

References fMin.

double TUnuranEmpDist::UpperBin (  )  const [inline]

upper value of binned data (return 0 for unbinned data)

Definition at line 130 of file TUnuranEmpDist.h.

References fMax.

unsigned int TUnuranEmpDist::NDim (  )  const [inline]

Number of data dimensions

Definition at line 135 of file TUnuranEmpDist.h.

References fDim.


Member Data Documentation

std::vector<double> TUnuranEmpDist::fData [private]

Definition at line 140 of file TUnuranEmpDist.h.

Referenced by Data(), operator=(), and TUnuranEmpDist().

unsigned int TUnuranEmpDist::fDim [private]

Definition at line 141 of file TUnuranEmpDist.h.

Referenced by NDim(), operator=(), and TUnuranEmpDist().

double TUnuranEmpDist::fMin [private]

Definition at line 142 of file TUnuranEmpDist.h.

Referenced by LowerBin(), operator=(), and TUnuranEmpDist().

double TUnuranEmpDist::fMax [private]

Definition at line 143 of file TUnuranEmpDist.h.

Referenced by operator=(), TUnuranEmpDist(), and UpperBin().

bool TUnuranEmpDist::fBinned [private]

Definition at line 144 of file TUnuranEmpDist.h.

Referenced by IsBinned(), operator=(), and TUnuranEmpDist().


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