fixed mangled chisq/maxLH issue (MUSR-148)

This commit is contained in:
nemu
2010-10-07 05:42:21 +00:00
parent 4d56897d13
commit c41fe09422
2 changed files with 17 additions and 27 deletions

View File

@ -247,6 +247,13 @@ Int_t PMsrHandler::ReadMsrFile()
if (!HandleStatisticEntry(statistic))
result = PMUSR_MSR_SYNTAX_ERROR;
// check if chisq or max.log likelihood
fStatistic.fChisq = true;
for (UInt_t i=0; i<fCommands.size(); i++) {
if (fCommands[i].fLine.Contains("MAX_LIKELIHOOD"))
fStatistic.fChisq = false; // max.log likelihood
}
// fill parameter-in-use vector
if (result == PMUSR_SUCCESS)
FillParameterInUse(theory, functions, run);
@ -945,31 +952,20 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
if (sstr.BeginsWith("STATISTIC")) {
TDatime dt;
fout << "STATISTIC --- " << dt.AsSQLString() << endl;
} else if (sstr.BeginsWith("chisq")) {
} else if (sstr.BeginsWith("chisq") || sstr.BeginsWith("maxLH")) {
partialStatisticBlockFound = false;
if (fStatistic.fValid) { // valid fit result
str = " chisq = ";
if (fStatistic.fChisq)
str = " chisq = ";
else
str = " maxLH = ";
str += fStatistic.fMin;
str += ", NDF = ";
str += fStatistic.fNdf;
str += ", chisq/NDF = ";
str += fStatistic.fMin / fStatistic.fNdf;
fout << str.Data() << endl;
if (messages)
cout << endl << str.Data() << endl;
} else {
fout << "*** FIT DID NOT CONVERGE ***" << endl;
if (messages)
cout << endl << "*** FIT DID NOT CONVERGE ***" << endl;
}
} else if (sstr.BeginsWith("maxLH")) {
partialStatisticBlockFound = false;
if (fStatistic.fValid) { // valid fit result
str = " maxLH = ";
str += fStatistic.fMin;
str += ", NDF = ";
str += fStatistic.fNdf;
str += ", maxLH/NDF = ";
if (fStatistic.fChisq)
str += ", chisq/NDF = ";
else
str += ", maxLH/NDF = ";
str += fStatistic.fMin / fStatistic.fNdf;
fout << str.Data() << endl;
if (messages)
@ -3718,13 +3714,6 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
return true;
}
// check if chisq or max.log likelihood
fStatistic.fChisq = true;
for (UInt_t i=0; i<fCommands.size(); i++) {
if (fCommands[i].fLine.Contains("MAX_LIKELIHOOD"))
fStatistic.fChisq = false; // max.log likelihood
}
Char_t str[128];
Char_t date[128];
Char_t time[128];