CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
CumulativeChiSquare.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: CumulativeChiSquare.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3
// ---------------------------------------------------------------------------
4
5
#include "
CLHEP/GenericFunctions/CumulativeChiSquare.hh
"
6
#include "
CLHEP/GenericFunctions/IncompleteGamma.hh
"
7
#include "
CLHEP/GenericFunctions/Variable.hh
"
8
9
namespace
Genfun {
10
FUNCTION_OBJECT_IMP
(CumulativeChiSquare)
11
12
//---------------------------------------------------------------------------------//
13
// Implementation notes: The Cumulative Chi Square function is implemented in //
14
// terms of the incomplete gamma function. //
15
//---------------------------------------------------------------------------------//
16
17
CumulativeChiSquare
::
CumulativeChiSquare
(
unsigned
int
nDof):
18
_nDof(nDof)
19
{
20
create();
21
}
22
23
CumulativeChiSquare::~CumulativeChiSquare
() {
24
delete
_function;
25
}
26
27
CumulativeChiSquare::CumulativeChiSquare
(
const
CumulativeChiSquare
& right):
28
_nDof(right._nDof)
29
{
30
create();
31
}
32
33
double
CumulativeChiSquare::operator()
(
double
x)
const
{
34
return
(*_function)(x);
35
}
36
37
unsigned
int
CumulativeChiSquare::nDof
()
const
{
38
return
_nDof;
39
}
40
41
void
CumulativeChiSquare::create() {
42
Variable
x;
43
IncompleteGamma
incompleteGamma;
44
incompleteGamma.
a
().
setValue
(_nDof/2.0);
45
_function = (incompleteGamma(x/2.0)).
clone
();
46
}
47
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1