CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
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
9
namespace
Genfun {
10
EfficiencyFunctional::EfficiencyFunctional
(
const
ArgumentList
& aList):
11
_aList(aList)
12
{}
13
14
EfficiencyFunctional::~EfficiencyFunctional
() {
15
}
16
17
double
EfficiencyFunctional::operator []
(
const
AbsFunction
&
function
)
const
{
18
double
logEfficiency(0);
19
for
(
unsigned
int
i=0; i<_aList.size()-1;i++) {
20
Argument
a
= _aList[i];
21
Argument
b
(a.
dimension
()-1);
22
for
(
unsigned
int
j=0;j<
b
.dimension();j++)
b
[j]=a[j];
23
double
f
=
function
(
b
);
24
if
(f<0 || f>1) {
25
std::cerr
26
<<
"Warning.. negative likelihood arg["
<< i <<
"]="
<< a <<
"f="
<< f << std::endl;
27
}
28
logEfficiency -= (a[a.
dimension
()-1]>0.5) ? log(f):log(1-f);
29
}
30
return
2.0*logEfficiency;
31
}
32
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1