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
10namespace Genfun {
12_aList(aList)
13{}
14
16}
17
18double 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
unsigned int dimension() const
Definition: Argument.hh:61
virtual double operator[](const AbsFunction &function) const
EfficiencyFunctional(const ArgumentList &aList)
void f(void g())
Definition: excDblThrow.cc:38
Definition: Abs.hh:14
std::vector< Argument > ArgumentList
Definition: ArgumentList.hh:7