Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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.. */
i
int i
Definition:
DBlmapReader.cc:9
EPS
#define EPS
Definition:
GammaContinuedFraction.cc:6
EnergyCorrector.c
tuple c
Definition:
EnergyCorrector.py:43
ecal_dqm_sourceclient-live_cfg.cerr
tuple cerr
Definition:
ecal_dqm_sourceclient-live_cfg.py:90
ztail.d
tuple d
Definition:
ztail.py:151
x
T x() const
Cartesian x coordinate.
Definition:
Basic3DVectorLD.h:127
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition:
Activities.doc:4
FPMIN
#define FPMIN
Definition:
GammaContinuedFraction.cc:7
GammaContinuedFraction.h
b
double b
Definition:
hdecay.h:120
GammaContinuedFraction
float GammaContinuedFraction(float a, float x)
Definition:
GammaContinuedFraction.cc:10
a
double a
Definition:
hdecay.h:121
ITMAX
#define ITMAX
Definition:
GammaContinuedFraction.cc:5
Generated for CMSSW Reference Manual by
1.8.5