CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

BetaDistribution.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:
3 
5 #include <assert.h>
6 #include <cmath>
7 using namespace std;
8 
9 namespace Genfun {
10 FUNCTION_OBJECT_IMP(BetaDistribution)
11 
12 
14  _alpha("a", 1.0, 0.0, 100),
15  _beta ("beta", 1.0, 0.0, 100)
16 {}
17 
18 BetaDistribution::BetaDistribution(const BetaDistribution & right):
19 _alpha(right._alpha),
20 _beta (right._beta)
21 {
22 }
23 
25 }
26 
27 double BetaDistribution::operator() (double x) const {
28  double a = _alpha.getValue(),b=_beta.getValue();
29  return pow(x,a-1)*pow((1-x),b-1)*
30  exp(_logGamma(a+b)-_logGamma(a)-_logGamma(b));
31 
32 }
33 
35  return _alpha;
36 }
37 
38 
40  return _beta;
41 }
42 
43 
44 
45 } // namespace Genfun