CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GammaNumericalGenerator.h
Go to the documentation of this file.
1 #ifndef GammaNumericalGenerator_H
2 #define GammaNumericalGenerator_H
4 
5 #include <cmath>
10 class RandomEngine;
11 
13 {
14  public:
15 
18  double a=0,double b=0,double x1=0,double x2=0) :
19  BaseNumericalRandomGenerator(engine,x1,x2,1000),
20  a_(a),b_(b),valid(false) {
21 
22  if(a>0&&b>0)
23  {
24  valid=true;
25  initialize();
26  }
27  }
28 
31 
33  double gamma() const { return generate(); }
34 
35  double gamma_exp() const {return generateExp();}
36 
37  double gamma_lin() const {return generateLin();}
38 
40  virtual double function(double x) { return ersatzt(x); }
41 
42  inline bool isValid() const {return valid;}
43 
44  private:
45 
47  double ersatzt(double x) {
48  double bt=b_*x;
49  return b_*pow(bt,a_-1)*exp(-bt);
50  }
51 
52  // gamma distribution parameters
53  double a_,b_;
54  bool valid;
55 };
56 
57 #endif
double gamma() const
Random generator.
virtual ~GammaNumericalGenerator()
Default destructor.
void initialize()
The initialization (numerical integarion, inversion)
GammaNumericalGenerator(const RandomEngine *engine, double a=0, double b=0, double x1=0, double x2=0)
Constructor : initialization of the Random Generator.
double generate() const
The random generation according to function()
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
x
Definition: VDTMath.h:216
double ersatzt(double x)
Gamma Function.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40