14 #ifndef ROOT_Math_TUnuranDiscrDist
15 #define ROOT_Math_TUnuranDiscrDist
51 class TUnuranDiscrDist :
public TUnuranBaseDist {
58 TUnuranDiscrDist (
const ROOT::Math::IGenFunction & func,
bool copyFunc =
false );
63 TUnuranDiscrDist (TF1 * func );
68 template<
class Iterator>
69 TUnuranDiscrDist (Iterator * begin, Iterator * end) :
86 virtual ~TUnuranDiscrDist ();
91 TUnuranDiscrDist(
const TUnuranDiscrDist &);
96 TUnuranDiscrDist & operator = (
const TUnuranDiscrDist & rhs);
101 virtual TUnuranDiscrDist * Clone()
const {
return new TUnuranDiscrDist(*
this); }
107 void SetCdf(
const ROOT::Math::IGenFunction & cdf);
113 void SetCdf(TF1 * cdf);
120 void SetDomain(
int xmin,
int xmax) {
133 void SetMode(
int mode) { fMode = mode; fHasMode=
true;}
138 void SetProbSum(
double sum) { fSum = sum; fHasSum=
true; }
143 bool GetDomain(
int & xmin,
int & xmax)
const {
152 int Mode()
const {
return fMode; }
157 double ProbSum()
const {
return fSum; }
163 bool HasMode()
const {
return fHasMode; }
169 bool HasProbSum()
const {
return fHasSum; }
174 bool HasCdf()
const {
return fCdf != 0; }
182 const std::vector<double> & ProbVec()
const {
return fPVec; }
189 double Pmf (
int x)
const;
194 double Cdf(
int x)
const;
202 std::vector<double> fPVec;
203 mutable std::vector<double> fPVecSum;
204 const ROOT::Math::IGenFunction *fPmf;
205 const ROOT::Math::IGenFunction *fCdf;
216 ClassDef(TUnuranDiscrDist,1)