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

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