(1) changed normalization of maximum likelihood. (2) ascii export from canvas adds initial space for empty column for easier parsing. (3) fix of some typos

This commit is contained in:
suter_a 2013-11-08 11:55:43 +00:00
parent 258a0ce336
commit 392cd0b4b3
5 changed files with 24 additions and 21 deletions

View File

@ -492,6 +492,7 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
if (denominator == 0.0) {
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: division by 0.0";
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: requested operation: " << EvalNode(node.children[0]) << "/" << EvalNode(node.children[1]);
cerr << endl << ">> " << fFuncString.Data() << endl;
cerr << endl;
assert(0);
}

View File

@ -5328,9 +5328,9 @@ void PMusrCanvas::SaveDataAscii()
fout << dumpVector[j].dataErr[i] << ", ";
} else {
if (dumpVector[j].dataErr.size() > 0)
fout << ", , , ";
fout << " , , , ";
else
fout << ", , ";
fout << " , , ";
}
}
// write theory
@ -5339,7 +5339,7 @@ void PMusrCanvas::SaveDataAscii()
fout << dumpVector[j].theoryX[i] << ", ";
fout << dumpVector[j].theory[i] << ", ";
} else {
fout << ", , ";
fout << " , , ";
}
}
// write last theory entry
@ -5347,7 +5347,7 @@ void PMusrCanvas::SaveDataAscii()
fout << dumpVector[dumpVector.size()-1].theoryX[i] << ", ";
fout << dumpVector[dumpVector.size()-1].theory[i];
} else {
fout << ", ";
fout << " , ";
}
fout << endl;
}

View File

@ -211,7 +211,7 @@ Double_t PRunMuMinus::CalcChiSquareExpected(const std::vector<Double_t>& par)
// CalcMaxLikelihood
//--------------------------------------------------------------------------
/**
* <p>Calculate log max-likelihood.
* <p>Calculate log max-likelihood. See http://pdg.lbl.gov/index.html
*
* <b>return:</b>
* - log max-likelihood value
@ -258,13 +258,14 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
// calculate theory for the given parameter set
theo = fTheory->Func(time, par, fFuncValues);
// check if data value is not too small
if (fData.GetValue()->at(i) > 1.0e-9)
data = fData.GetValue()->at(i);
else
data = 1.0e-9;
// add maximum log likelihood contribution of bin i
mllh -= data*TMath::Log(theo) - theo - TMath::LnGamma(data+1);
if (data > 1.0e-9) {
mllh += (theo-data) + data*log(data/theo);
} else {
mllh += (theo-data);
}
}
return mllh;

View File

@ -144,7 +144,7 @@ Double_t PRunNonMusr::CalcChiSquareExpected(const std::vector<Double_t>& par)
*/
Double_t PRunNonMusr::CalcMaxLikelihood(const std::vector<Double_t>& par)
{
cout << endl << "PRunSingleHisto::CalcMaxLikelihood(): not implemented yet ..." << endl;
cout << endl << "PRunNonMusr::CalcMaxLikelihood(): not implemented yet ..." << endl;
return 1.0;
}

View File

@ -296,7 +296,7 @@ Double_t PRunSingleHisto::CalcChiSquareExpected(const std::vector<Double_t>& par
// CalcMaxLikelihood (public)
//--------------------------------------------------------------------------
/**
* <p>Calculate log maximum-likelihood.
* <p>Calculate log maximum-likelihood. See http://pdg.lbl.gov/index.html
*
* <b>return:</b>
* - log maximum-likelihood value
@ -381,13 +381,14 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
// calculate theory for the given parameter set
theo = N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg;
theo *= normalizer;
// check if data value is not too small
if (fData.GetValue()->at(i) > 1.0e-9)
data = normalizer*fData.GetValue()->at(i);
else
data = 1.0e-9;
// add maximum log likelihood contribution of bin i
mllh -= data*TMath::Log(theo) - theo - TMath::LnGamma(data+1);
if (data > 1.0e-9) {
mllh += (theo-data) + data*log(data/theo);
} else {
mllh += (theo-data);
}
}
return mllh;