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 AbsFunction(right),
00020 _alpha(right._alpha),
00021 _beta (right._beta) 
00022 {
00023 }
00024 
00025 GammaDistribution::~GammaDistribution() {
00026 }
00027 
00028 double GammaDistribution::operator() (double x) const {
00029   return std::pow(x,_alpha.getValue()-1)*
00030     exp(-x/_beta.getValue())/std::pow(_beta.getValue(),(_alpha.getValue()))/
00031     exp(_logGamma(_alpha.getValue()));
00032 
00033 }
00034 
00035 Parameter & GammaDistribution::alpha() {
00036   return _alpha;
00037 }
00038 
00039 
00040 Parameter & GammaDistribution::beta() {
00041   return _beta;
00042 }
00043 
00044 
00045 
00046 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7