PhysicsTools
Utilities
interface
CombinedChiSquaredLikelihood.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_Utilities_CombinedChiSquaredLikelihood_h
2
#define PhysicsTools_Utilities_CombinedChiSquaredLikelihood_h
3
#include "
PhysicsTools/Utilities/interface/RootMinuitResultPrinter.h
"
4
#include "
PhysicsTools/Utilities/interface/RootMinuitFuncEvaluator.h
"
5
6
namespace
fit
{
7
template
<
typename
ChiSquared,
typename
Likelihood>
8
class
CombinedChiSquaredLikelihood
{
9
public
:
10
CombinedChiSquaredLikelihood
() {}
11
CombinedChiSquaredLikelihood
(
const
ChiSquared
&
chi2
,
const
Likelihood
&
like
) :
chi2_
(
chi2
),
like_
(
like
) {}
12
// return chi-square value
13
double
operator()
()
const
{
return
-2 *
like_
() +
chi2_
(); }
14
ChiSquared
&
chi2
() {
return
chi2_
; }
15
const
ChiSquared
&
chi2
()
const
{
return
chi2_
; }
16
Likelihood
&
like
() {
return
like_
; }
17
const
Likelihood
&
like
()
const
{
return
like_
; }
18
size_t
numberOfBins
()
const
{
return
chi2_
.numberOfBins(); }
19
20
private
:
21
ChiSquared
chi2_
;
22
Likelihood
like_
;
23
};
24
25
template
<
typename
ChiSquared,
typename
Likelihood>
26
struct
RootMinuitResultPrinter
<
CombinedChiSquaredLikelihood
<
ChiSquared
,
Likelihood
> > {
27
static
void
print
(
double
amin,
28
unsigned
int
numberOfFreeParameters,
29
const
CombinedChiSquaredLikelihood<ChiSquared, Likelihood>
&
f
) {
30
unsigned
int
ndof
=
f
.numberOfBins() - numberOfFreeParameters;
31
std::cout
<<
"-2 log(maximum-likelihood) = "
<< amin <<
", n.d.o.f = "
<<
ndof
32
<<
", free parameters = "
<< numberOfFreeParameters << std::endl;
33
std::cout
<<
"chi-2 contibution: "
<<
f
.chi2()() <<
"(n. bins: "
<<
f
.chi2().numberOfBins() <<
")"
<< std::endl
34
<<
"likelihood contriution: "
<< -2. *
f
.like()() << std::endl;
35
}
36
};
37
38
}
// namespace fit
39
40
#endif
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
fit::CombinedChiSquaredLikelihood::CombinedChiSquaredLikelihood
CombinedChiSquaredLikelihood()
Definition:
CombinedChiSquaredLikelihood.h:10
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
fit::CombinedChiSquaredLikelihood::CombinedChiSquaredLikelihood
CombinedChiSquaredLikelihood(const ChiSquared &chi2, const Likelihood &like)
Definition:
CombinedChiSquaredLikelihood.h:11
fit::CombinedChiSquaredLikelihood::numberOfBins
size_t numberOfBins() const
Definition:
CombinedChiSquaredLikelihood.h:18
fit::CombinedChiSquaredLikelihood::chi2
ChiSquared & chi2()
Definition:
CombinedChiSquaredLikelihood.h:14
ndof
Definition:
HIMultiTrackSelector.h:49
fit::Likelihood
Definition:
Likelihood.h:23
RootMinuitFuncEvaluator.h
fit::CombinedChiSquaredLikelihood::like
Likelihood & like()
Definition:
CombinedChiSquaredLikelihood.h:16
fit::CombinedChiSquaredLikelihood::like
const Likelihood & like() const
Definition:
CombinedChiSquaredLikelihood.h:17
ChiSquared
Definition:
ChiSquared.h:19
fit::CombinedChiSquaredLikelihood::operator()
double operator()() const
Definition:
CombinedChiSquaredLikelihood.h:13
fit::CombinedChiSquaredLikelihood
Definition:
CombinedChiSquaredLikelihood.h:8
fit::CombinedChiSquaredLikelihood::chi2_
ChiSquared chi2_
Definition:
CombinedChiSquaredLikelihood.h:21
RootMinuitResultPrinter.h
fit::CombinedChiSquaredLikelihood::like_
Likelihood like_
Definition:
CombinedChiSquaredLikelihood.h:22
fit::CombinedChiSquaredLikelihood::chi2
const ChiSquared & chi2() const
Definition:
CombinedChiSquaredLikelihood.h:15
fit::RootMinuitResultPrinter
Definition:
RootMinuitResultPrinter.h:8
fit::RootMinuitResultPrinter< CombinedChiSquaredLikelihood< ChiSquared, Likelihood > >::print
static void print(double amin, unsigned int numberOfFreeParameters, const CombinedChiSquaredLikelihood< ChiSquared, Likelihood > &f)
Definition:
CombinedChiSquaredLikelihood.h:27
fit
Definition:
CombinedChiSquaredLikelihood.h:6
Generated for CMSSW Reference Manual by
1.8.16