changed normalization of log max likelihood

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

View File

@ -53,6 +53,9 @@ FIXED 2012-09-23 fixed wrong chisq output in musrview if expected chisq is
present. present.
FIXED 2012-05-30 fixed RRF bug in single histo plotting. FIXED 2012-05-30 fixed RRF bug in single histo plotting.
FIXED 2012-05-18 fixed wrong forward/backward tag for ROOT-PPC (MUSR-215) FIXED 2012-05-18 fixed wrong forward/backward tag for ROOT-PPC (MUSR-215)
CHANGED 2013-11-12 changed normalization of log max likelihood according to S.
Backer and R.D. Cousins NIM 221, 437 (1984), in order to have a
"goodness-of-fit" criteria.
CHANGED 2012-12-11 if multiple SAVE are present in the COMMAND block, append CHANGED 2012-12-11 if multiple SAVE are present in the COMMAND block, append
MINUIT2.OUTPUT file. Added docu for PRINT_LEVEL (MUSR-244). MINUIT2.OUTPUT file. Added docu for PRINT_LEVEL (MUSR-244).
CHANGED 2012-11-19 replaced hard coded gyromagnetic ratio of the muon in the CHANGED 2012-11-19 replaced hard coded gyromagnetic ratio of the muon in the

View File

@ -261,6 +261,11 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
data = fData.GetValue()->at(i); data = fData.GetValue()->at(i);
if (theo <= 0.0) {
cerr << ">> PRunMuMinus::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl;
continue;
}
if (data > 1.0e-9) { if (data > 1.0e-9) {
mllh += (theo-data) + data*log(data/theo); mllh += (theo-data) + data*log(data/theo);
} else { } else {
@ -268,7 +273,7 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
} }
} }
return mllh; return 2.0*mllh;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

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