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

BetaDistribution.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: 
00003 
00004 #include "CLHEP/GenericFunctions/BetaDistribution.hh"
00005 #include <assert.h>
00006 #include <cmath>
00007 using namespace std;
00008 
00009 namespace Genfun {
00010 FUNCTION_OBJECT_IMP(BetaDistribution)
00011 
00012 
00013 BetaDistribution::BetaDistribution():
00014   _alpha("a",    1.0, 0.0, 100),
00015   _beta ("beta", 1.0, 0.0, 100)
00016 {}
00017 
00018 BetaDistribution::BetaDistribution(const BetaDistribution & right):
00019 AbsFunction( right ),
00020 _alpha(right._alpha),
00021 _beta (right._beta) 
00022 {
00023 }
00024 
00025 BetaDistribution::~BetaDistribution() {
00026 }
00027 
00028 double BetaDistribution::operator() (double x) const {
00029   double a = _alpha.getValue(),b=_beta.getValue();
00030   return pow(x,a-1)*pow((1-x),b-1)*
00031     exp(_logGamma(a+b)-_logGamma(a)-_logGamma(b));
00032   
00033 }
00034 
00035 Parameter & BetaDistribution::alpha() {
00036   return _alpha;
00037 }
00038 
00039 
00040 Parameter & BetaDistribution::beta() {
00041   return _beta;
00042 }
00043 
00044 
00045 
00046 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7