Main Page
Namespaces
Classes
Package Documentation
src
CommonTools
Statistics
src
GammaContinuedFraction.cc
Go to the documentation of this file.
1
#include "
CommonTools/Statistics/src/GammaContinuedFraction.h
"
2
#include <cmath>
3
#include <iostream>
4
5
#define ITMAX 100 // maximum allowed number of iterations
6
#define EPS 3.0e-7 // relative accuracy
7
#define FPMIN 1.0e-30 // number near the smallest representable floating-point number
8
9
float
10
GammaContinuedFraction
(
float
a
,
float
x
)
11
{
12
int
i
;
13
float
an,del;
14
15
/* Set up for evaluating continued fraction by modified Lentz's method (par.5.2
16
in Numerical Recipes in C) with b_0 = 0 */
17
double
b
= x+1.0-
a
;
18
double
c
= 1.0/
FPMIN
;
19
double
d
= 1.0/
b
;
20
double
h
=
d
;
21
for
(i=1;i<=
ITMAX
;i++) {
22
an = -i*(i-
a
);
23
b += 2.0;
24
d=an*d+
b
;
25
if
(fabs(d) <
FPMIN
) d=
FPMIN
;
26
c=b+an/
c
;
27
if
(fabs(c) <
FPMIN
) c=
FPMIN
;
28
d=1.0/
d
;
29
del=d*
c
;
30
h *= del;
31
if
(fabs(del-1.0) <
EPS
)
break
;
32
}
33
if
( i >
ITMAX
)
std::cerr
<<
"GammaContinuedFraction::a too large, "
34
<<
"ITMAX too small"
<< std::endl;
35
return
h
;
36
}
37
#undef ITMAX
38
#undef EPS
39
#undef FPMIN
40
/* (C) Copr. 1986-92 Numerical Recipes Software B2.. */
mps_fire.i
i
Definition:
mps_fire.py:338
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition:
L1TUtmAlgorithmRcd.h:4
EPS
#define EPS
Definition:
GammaContinuedFraction.cc:6
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:44
MessageLogger_cfi.cerr
cerr
Definition:
MessageLogger_cfi.py:547
FPMIN
#define FPMIN
Definition:
GammaContinuedFraction.cc:7
GammaContinuedFraction.h
edmIntegrityCheck.d
d
Definition:
edmIntegrityCheck.py:66
b
double b
Definition:
hdecay.h:120
GammaContinuedFraction
float GammaContinuedFraction(float a, float x)
Definition:
GammaContinuedFraction.cc:10
genVertex_cff.x
x
Definition:
genVertex_cff.py:12
a
double a
Definition:
hdecay.h:121
ITMAX
#define ITMAX
Definition:
GammaContinuedFraction.cc:5
Generated for CMSSW Reference Manual by
1.8.11