CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GammaNumericalGenerator Class Reference

#include <GammaNumericalGenerator.h>

Inheritance diagram for GammaNumericalGenerator:
BaseNumericalRandomGenerator

Public Member Functions

double function (double x) override
 The probability density function implementation. More...
 
double gamma (RandomEngineAndDistribution const *random) const
 Random generator. More...
 
double gamma_exp (RandomEngineAndDistribution const *random) const
 
double gamma_lin (RandomEngineAndDistribution const *random) const
 
 GammaNumericalGenerator (double a=0, double b=0, double x1=0, double x2=0)
 Constructor : initialization of the Random Generator. More...
 
bool isValid () const
 
 ~GammaNumericalGenerator () override
 Default destructor. More...
 
- Public Member Functions inherited from BaseNumericalRandomGenerator
 BaseNumericalRandomGenerator (double xmin=0., double xmax=1., int n=1000, int iter=6)
 
double generate (RandomEngineAndDistribution const *) const
 The random generation according to function() More...
 
double generateExp (RandomEngineAndDistribution const *) const
 
double generateLin (RandomEngineAndDistribution const *) const
 
void initialize ()
 The initialization (numerical integarion, inversion) More...
 
bool setSubInterval (double x1, double x2)
 To shoot in a given interval. More...
 
virtual ~BaseNumericalRandomGenerator ()
 Default destructor. More...
 

Private Member Functions

double ersatzt (double x)
 Gamma Function. More...
 

Private Attributes

double a_
 
double b_
 
bool valid
 

Additional Inherited Members

- Protected Attributes inherited from BaseNumericalRandomGenerator
double deltar
 
std::vector< double > f
 
int iter
 
int n
 
double rmin
 
std::vector< double > sampling
 
double xmax
 
double xmin
 

Detailed Description

Definition at line 12 of file GammaNumericalGenerator.h.

Constructor & Destructor Documentation

◆ GammaNumericalGenerator()

GammaNumericalGenerator::GammaNumericalGenerator ( double  a = 0,
double  b = 0,
double  x1 = 0,
double  x2 = 0 
)
inline

Constructor : initialization of the Random Generator.

Definition at line 15 of file GammaNumericalGenerator.h.

16  : BaseNumericalRandomGenerator(x1, x2, 1000), a_(a), b_(b), valid(false) {
17  if (a > 0 && b > 0) {
18  valid = true;
19  initialize();
20  }
21  }

References a, b, BaseNumericalRandomGenerator::initialize(), and valid.

◆ ~GammaNumericalGenerator()

GammaNumericalGenerator::~GammaNumericalGenerator ( )
inlineoverride

Default destructor.

Definition at line 24 of file GammaNumericalGenerator.h.

24 {}

Member Function Documentation

◆ ersatzt()

double GammaNumericalGenerator::ersatzt ( double  x)
inlineprivate

Gamma Function.

Definition at line 40 of file GammaNumericalGenerator.h.

40  {
41  double bt = b_ * x;
42  return b_ * pow(bt, a_ - 1) * exp(-bt);
43  }

References a_, b_, JetChargeProducer_cfi::exp, funct::pow(), and x.

Referenced by function().

◆ function()

double GammaNumericalGenerator::function ( double  x)
inlineoverridevirtual

The probability density function implementation.

Implements BaseNumericalRandomGenerator.

Definition at line 34 of file GammaNumericalGenerator.h.

34 { return ersatzt(x); }

References ersatzt(), and x.

◆ gamma()

double GammaNumericalGenerator::gamma ( RandomEngineAndDistribution const *  random) const
inline

Random generator.

Definition at line 27 of file GammaNumericalGenerator.h.

27 { return generate(random); }

References BaseNumericalRandomGenerator::generate().

◆ gamma_exp()

double GammaNumericalGenerator::gamma_exp ( RandomEngineAndDistribution const *  random) const
inline

Definition at line 29 of file GammaNumericalGenerator.h.

29 { return generateExp(random); }

References BaseNumericalRandomGenerator::generateExp().

◆ gamma_lin()

double GammaNumericalGenerator::gamma_lin ( RandomEngineAndDistribution const *  random) const
inline

Definition at line 31 of file GammaNumericalGenerator.h.

31 { return generateLin(random); }

References BaseNumericalRandomGenerator::generateLin().

◆ isValid()

bool GammaNumericalGenerator::isValid ( void  ) const
inline

Definition at line 36 of file GammaNumericalGenerator.h.

36 { return valid; }

References valid.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

Member Data Documentation

◆ a_

double GammaNumericalGenerator::a_
private

Definition at line 46 of file GammaNumericalGenerator.h.

Referenced by ersatzt().

◆ b_

double GammaNumericalGenerator::b_
private

Definition at line 46 of file GammaNumericalGenerator.h.

Referenced by ersatzt().

◆ valid

bool GammaNumericalGenerator::valid
private

Definition at line 47 of file GammaNumericalGenerator.h.

Referenced by GammaNumericalGenerator(), and isValid().

BaseNumericalRandomGenerator::generateExp
double generateExp(RandomEngineAndDistribution const *) const
Definition: BaseNumericalRandomGenerator.cc:83
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
BaseNumericalRandomGenerator::generateLin
double generateLin(RandomEngineAndDistribution const *) const
Definition: BaseNumericalRandomGenerator.cc:98
GammaNumericalGenerator::a_
double a_
Definition: GammaNumericalGenerator.h:46
DDAxes::x
GammaNumericalGenerator::b_
double b_
Definition: GammaNumericalGenerator.h:46
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
BaseNumericalRandomGenerator::initialize
void initialize()
The initialization (numerical integarion, inversion)
Definition: BaseNumericalRandomGenerator.cc:13
BaseNumericalRandomGenerator::generate
double generate(RandomEngineAndDistribution const *) const
The random generation according to function()
Definition: BaseNumericalRandomGenerator.cc:75
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
BaseNumericalRandomGenerator::BaseNumericalRandomGenerator
BaseNumericalRandomGenerator(double xmin=0., double xmax=1., int n=1000, int iter=6)
Definition: BaseNumericalRandomGenerator.cc:7
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
GammaNumericalGenerator::ersatzt
double ersatzt(double x)
Gamma Function.
Definition: GammaNumericalGenerator.h:40
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
GammaNumericalGenerator::valid
bool valid
Definition: GammaNumericalGenerator.h:47