14#ifndef ROOT_Math_TUnuranDiscrDist
15#define ROOT_Math_TUnuranDiscrDist
68 template<
class Iterator>
189 double Pmf (
int x)
const;
194 double Cdf(
int x)
const;
#define ClassDef(name, id)
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
TUnuranBaseDist, base class for Unuran distribution classees such as TUnuranContDist (for one-dimensi...
TUnuranDiscrDist class for one dimensional discrete distribution.
bool HasCdf() const
flag to control if distribution provides also a Cdf
double Cdf(int x) const
evaluate the integral (cdf) on the given domain
virtual TUnuranDiscrDist * Clone() const
Clone (required by base class)
std::vector< double > fPVecSum
virtual ~TUnuranDiscrDist()
Destructor.
void SetMode(int mode)
set the mode of the distribution (location of maximum probability)
double ProbSum() const
return area of the pdf
void SetCdf(const ROOT::Math::IGenFunction &cdf)
set cdf distribution from a generic function interface.
const ROOT::Math::IGenFunction * fCdf
bool HasProbSum() const
flag to control if distribution provides the total area of the probability function
int Mode() const
get the mode (x location of function maximum)
bool GetDomain(int &xmin, int &xmax) const
check if distribution has domain and return in case its domain
void SetProbSum(double sum)
set the value of the sum of the probabilities in the given domain
bool HasMode() const
flag to control if distribution provides the mode
const std::vector< double > & ProbVec() const
retrieve a reference to the vector of the probabilities : Prob(i) If the distribution is defined from...
double Pmf(int x) const
evaluate the distribution (probability mesh function) at the integer value x.
std::vector< double > fPVec
const ROOT::Math::IGenFunction * fPmf
TUnuranDiscrDist(const ROOT::Math::IGenFunction &func, bool copyFunc=false)
Constructor from a generic function object specifying the pdf.
TUnuranDiscrDist & operator=(const TUnuranDiscrDist &rhs)
Assignment operator.
void SetDomain(int xmin, int xmax)
Set the distribution domain, by default the domain is [0,INT_MAX] If xmin >= xmax a domain is removed...
TUnuranDiscrDist(Iterator *begin, Iterator *end)
Constructor from a vector of probability.
static long int sum(long int i)