CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

LikelihoodFunctional.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: LikelihoodFunctional.cc,v 1.4 2003/10/10 17:40:39 garren Exp $
6#include <iostream>
7#include <sstream>
8#include <stdexcept>
9#include <cmath> // for log()
10
11namespace Genfun {
13_aList(aList)
14{}
15
17}
18
19double LikelihoodFunctional::operator [] (const AbsFunction & function) const {
20 double logLikelihood(0);
21 for (unsigned int i=0; i<_aList.size();i++) {
22 Argument a = _aList[i];
23 double f = function(a);
24 if (f<=0.0) {
25 std::ostringstream stream;
26 stream << "Negative likelihood arg[" << i << "]=" << a;
27 throw std::runtime_error(stream.str());
28 }
29 logLikelihood -= log(f);
30 }
31 return 2.0*logLikelihood;
32}
33} // namespace Genfun
LikelihoodFunctional(const ArgumentList &aList)
virtual double operator[](const AbsFunction &function) const
void f(void g())
Definition: excDblThrow.cc:38
std::vector< Argument > ArgumentList
@ a