made writting mlog-file BMW tighter (MUSR-82), and moved the all parameter == 0 to the appropriate place (MUSR-83)
This commit is contained in:
parent
6f12a0e6c8
commit
8ec9c10a24
@ -337,6 +337,8 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
|
||||
TObjArray *tokens;
|
||||
TObjString *ostr;
|
||||
bool found = false;
|
||||
bool statisticBlockFound = false;
|
||||
bool partialStatisticBlockFound = true;
|
||||
|
||||
// construct log file name
|
||||
// first find the last '.' in the filename
|
||||
@ -807,12 +809,14 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
|
||||
}
|
||||
break;
|
||||
case MSR_TAG_STATISTIC:
|
||||
statisticBlockFound = true;
|
||||
sstr = str;
|
||||
sstr.Remove(TString::kLeading, ' ');
|
||||
if (sstr.BeginsWith("STATISTIC")) {
|
||||
TDatime dt;
|
||||
fout << "STATISTIC --- " << dt.AsSQLString() << endl;
|
||||
} else if (sstr.BeginsWith("chisq")) {
|
||||
partialStatisticBlockFound = false;
|
||||
if (fStatistic.fValid) { // valid fit result
|
||||
str = " chisq = ";
|
||||
str += fStatistic.fMin;
|
||||
@ -829,6 +833,7 @@ int PMsrHandler::WriteMsrLogFile(const bool 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;
|
||||
@ -845,6 +850,7 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
|
||||
cout << endl << "*** FIT DID NOT CONVERGE ***" << endl;
|
||||
}
|
||||
} else if (sstr.BeginsWith("*** FIT DID NOT CONVERGE ***")) {
|
||||
partialStatisticBlockFound = false;
|
||||
if (fStatistic.fValid) { // valid fit result
|
||||
if (fStatistic.fChisq) { // chisq
|
||||
str = " chisq = ";
|
||||
@ -881,6 +887,76 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
|
||||
}
|
||||
}
|
||||
|
||||
// there was no statistic block present in the msr-input-file
|
||||
if (!statisticBlockFound) {
|
||||
cout << endl << "PMsrHandler::WriteMsrLogFile: **WARNING** no STATISTIC block present, will write a default one" << endl;
|
||||
fout << "###############################################################" << endl;
|
||||
TDatime dt;
|
||||
fout << "STATISTIC --- " << dt.AsSQLString() << endl;
|
||||
if (fStatistic.fValid) { // valid fit result
|
||||
if (fStatistic.fChisq) { // chisq
|
||||
str = " chisq = ";
|
||||
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 { // max. log. liklihood
|
||||
str = " maxLH = ";
|
||||
str += fStatistic.fMin;
|
||||
str += ", NDF = ";
|
||||
str += fStatistic.fNdf;
|
||||
str += ", maxLH/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;
|
||||
}
|
||||
}
|
||||
|
||||
// there was only a partial statistic block present in the msr-input-file
|
||||
if (partialStatisticBlockFound) {
|
||||
cout << endl << "PMsrHandler::WriteMsrLogFile: **WARNING** garbage STATISTIC block present in the msr-input file.";
|
||||
cout << endl << "** WILL ADD SOME SENSIBLE STUFF, BUT YOU HAVE TO CHECK IT SINCE I AM **NOT** REMOVING THE GARBAGE! **" << endl;
|
||||
TDatime dt;
|
||||
fout << "STATISTIC --- " << dt.AsSQLString() << endl;
|
||||
if (fStatistic.fValid) { // valid fit result
|
||||
if (fStatistic.fChisq) { // chisq
|
||||
str = " chisq = ";
|
||||
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 { // max. log. liklihood
|
||||
str = " maxLH = ";
|
||||
str += fStatistic.fMin;
|
||||
str += ", NDF = ";
|
||||
str += fStatistic.fNdf;
|
||||
str += ", maxLH/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;
|
||||
}
|
||||
}
|
||||
|
||||
// close files
|
||||
fout.close();
|
||||
fin.close();
|
||||
@ -2593,7 +2669,7 @@ bool PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
|
||||
if (lines.empty()) {
|
||||
cout << endl << ">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?";
|
||||
cout << endl;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if chisq or max.log likelihood
|
||||
|
@ -1094,6 +1094,10 @@ double PTheory::StaticGaussKTLF(register double t, const PDoubleVector& paramVal
|
||||
}
|
||||
}
|
||||
|
||||
// check if all parameters == 0
|
||||
if ((val[0] == 0.0) && (val[1] == 0.0))
|
||||
return 1.0;
|
||||
|
||||
// check if the parameter values have changed, and if yes recalculate the non-analytic integral
|
||||
bool newParam = false;
|
||||
for (unsigned int i=0; i<3; i++) {
|
||||
@ -1159,6 +1163,10 @@ double PTheory::DynamicGaussKTLF(register double t, const PDoubleVector& paramVa
|
||||
}
|
||||
}
|
||||
|
||||
// check if all parameters == 0
|
||||
if ((val[0] == 0.0) && (val[1] == 0.0) && (val[2] == 0.0))
|
||||
return 1.0;
|
||||
|
||||
// check that Delta != 0, if not (i.e. stupid parameter) return 1, which is the correct limit
|
||||
if (fabs(val[1]) < 1.0e-6) {
|
||||
return 1.0;
|
||||
@ -1269,6 +1277,10 @@ double PTheory::StaticLorentzKTLF(register double t, const PDoubleVector& paramV
|
||||
}
|
||||
}
|
||||
|
||||
// check if all parameters == 0
|
||||
if ((val[0] == 0.0) && (val[1] == 0.0))
|
||||
return 1.0;
|
||||
|
||||
// check if the parameter values have changed, and if yes recalculate the non-analytic integral
|
||||
bool newParam = false;
|
||||
for (unsigned int i=0; i<3; i++) {
|
||||
@ -1334,10 +1346,6 @@ double PTheory::DynamicLorentzKTLF(register double t, const PDoubleVector& param
|
||||
|
||||
assert(fParamNo.size() <= 4);
|
||||
|
||||
// check if all parameters == 0
|
||||
if ((val[0] == 0.0) && (val[1] == 0.0) && (val[2] == 0.0))
|
||||
return 1.0;
|
||||
|
||||
// check if FUNCTIONS are used
|
||||
for (unsigned int i=0; i<fParamNo.size(); i++) {
|
||||
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
|
||||
@ -1347,6 +1355,10 @@ double PTheory::DynamicLorentzKTLF(register double t, const PDoubleVector& param
|
||||
}
|
||||
}
|
||||
|
||||
// check if all parameters == 0
|
||||
if ((val[0] == 0.0) && (val[1] == 0.0) && (val[2] == 0.0))
|
||||
return 1.0;
|
||||
|
||||
double tt;
|
||||
if (fParamNo.size() == 3) // no tshift
|
||||
tt = t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user