CMS 3D CMS Logo

List of all members | Static Public Member Functions
IncompleteGammaComplement Class Reference

#include <IncompleteGammaComplement.h>

Static Public Member Functions

static float ln (float a, float x)
 
static float value (float a, float x)
 

Detailed Description

Computes the complement Q(a,x)=1-P(a,x) of the incomplete gamma function. Computes its natural logarithm, useful for comparing very small values. source: Numerical Recipes

Definition at line 9 of file IncompleteGammaComplement.h.

Member Function Documentation

◆ ln()

float IncompleteGammaComplement::ln ( float  a,
float  x 
)
static

Definition at line 22 of file IncompleteGammaComplement.cc.

References a, JetChargeProducer_cfi::exp, GammaContinuedFraction(), GammaLn(), GammaSeries(), dqm-mbProfile::log, and x.

Referenced by LnChiSquaredProbability().

22  {
23  if (x < 0.0 || a <= 0.0)
24  edm::LogInfo("IncompleteGammaComplement") << "IncompleteGammaComplement::invalid arguments";
25  if (x < (a + 1.0))
26  // take the complement of the series representation
27  return log(1. - GammaSeries(a, x) * (exp(-x + a * log(x) - GammaLn(a))));
28  else
29  // use the continued fraction representation
30  return log(GammaContinuedFraction(a, x)) - x + a * log(x) - GammaLn(a);
31 }
float GammaLn(float z)
Definition: GammaLn.cc:4
Log< level::Info, false > LogInfo
float GammaContinuedFraction(float a, float x)
double a
Definition: hdecay.h:121
float GammaSeries(float a, float x)
Definition: GammaSeries.cc:8

◆ value()

float IncompleteGammaComplement::value ( float  a,
float  x 
)
static

Definition at line 11 of file IncompleteGammaComplement.cc.

References a, JetChargeProducer_cfi::exp, GammaContinuedFraction(), GammaLn(), GammaSeries(), dqm-mbProfile::log, and x.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), average.Average::average(), ChiSquaredProbability(), Types.string::configValue(), Types.FileInPath::configValue(), Mixins.UsingBlock::dumpPython(), Mixins.UsingBlock::insertInto(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), and Types.vstring::insertInto().

11  {
12  if (x < 0.0 || a <= 0.0)
13  edm::LogInfo("IncompleteGammaComplement") << "IncompleteGammaComplement::invalid arguments";
14  if (x < (a + 1.0))
15  // take the complement of the series representation
16  return 1. - GammaSeries(a, x) * (exp(-x + a * log(x) - GammaLn(a)));
17  else
18  // use the continued fraction representation
19  return GammaContinuedFraction(a, x) * (exp(-x + a * log(x) - GammaLn(a)));
20 }
float GammaLn(float z)
Definition: GammaLn.cc:4
Log< level::Info, false > LogInfo
float GammaContinuedFraction(float a, float x)
double a
Definition: hdecay.h:121
float GammaSeries(float a, float x)
Definition: GammaSeries.cc:8