CLHEP
2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
EfficiencyFunctional.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id:
3
#include "CLHEP/GenericFunctions/EfficiencyFunctional.hh"
4
#include "CLHEP/GenericFunctions/Argument.hh"
5
#include "CLHEP/GenericFunctions/AbsFunction.hh"
6
#include <iostream>
7
#include <cmath>
// for log()
8
#include <vector>
9
10
namespace
Genfun
{
11
EfficiencyFunctional::EfficiencyFunctional
(
const
ArgumentList
& aList):
12
_aList(aList)
13
{}
14
15
EfficiencyFunctional::~EfficiencyFunctional
() {
16
}
17
18
double
EfficiencyFunctional::operator []
(
const
AbsFunction
& function)
const
{
19
double
logEfficiency(0);
20
for
(
unsigned
int
i=0; i<_aList.size()-1;i++) {
21
Argument
a = _aList[i];
22
Argument
b(a.
dimension
()-1);
23
for
(
unsigned
int
j=0;j<b.
dimension
();j++) b[j]=a[j];
24
double
f
= function(b);
25
if
(f<0 || f>1) {
26
std::cerr
27
<<
"Warning.. negative likelihood arg["
<< i <<
"]="
<< a <<
"f="
<<
f
<< std::endl;
28
}
29
logEfficiency -= (a[a.
dimension
()-1]>0.5) ? log(
f
):log(1-
f
);
30
}
31
return
2.0*logEfficiency;
32
}
33
}
// namespace Genfun
Genfun::AbsFunction
Definition:
AbsFunction.hh:48
Genfun::Argument
Definition:
Argument.hh:17
Genfun::Argument::dimension
unsigned int dimension() const
Definition:
Argument.hh:61
Genfun::EfficiencyFunctional::~EfficiencyFunctional
~EfficiencyFunctional()
Definition:
EfficiencyFunctional.cc:15
Genfun::EfficiencyFunctional::operator[]
virtual double operator[](const AbsFunction &function) const
Definition:
EfficiencyFunctional.cc:18
Genfun::EfficiencyFunctional::EfficiencyFunctional
EfficiencyFunctional(const ArgumentList &aList)
Definition:
EfficiencyFunctional.cc:11
f
void f(void g())
Definition:
excDblThrow.cc:38
Genfun
Definition:
Abs.hh:14
Genfun::ArgumentList
std::vector< Argument > ArgumentList
Definition:
ArgumentList.hh:7
CLHEP-CLHEP_2_4_6_4
GenericFunctions
src
EfficiencyFunctional.cc
Generated by
1.9.6