changed normalization of log max likelihood

This commit is contained in:
2013-11-12 08:36:30 +00:00
parent 392cd0b4b3
commit e2712ce3f7
3 changed files with 17 additions and 4 deletions

View File

@ -376,14 +376,19 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=startTimeBin; i<endTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
// calculate theory for the given parameter set
theo = N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg;
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
theo *= normalizer;
data = normalizer*fData.GetValue()->at(i);
if (theo <= 0.0) {
cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl;
continue;
}
if (data > 1.0e-9) {
mllh += (theo-data) + data*log(data/theo);
} else {
@ -391,7 +396,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
}
}
return mllh;
return 2.0*mllh;
}
//--------------------------------------------------------------------------