some minor changes needed for proper msr-file handling with musrt0 (see MUSR-45)
This commit is contained in:
parent
bbf48eac60
commit
e44bc91a03
@ -59,6 +59,7 @@ PMsrHandler::PMsrHandler(char *fileName) : fFileName(fileName)
|
|||||||
|
|
||||||
fTitle = "";
|
fTitle = "";
|
||||||
|
|
||||||
|
fCopyStatisticsBlock = false;
|
||||||
fStatistic.fValid = false;
|
fStatistic.fValid = false;
|
||||||
fStatistic.fChisq = true;
|
fStatistic.fChisq = true;
|
||||||
fStatistic.fMin = -1.0;
|
fStatistic.fMin = -1.0;
|
||||||
@ -830,39 +831,41 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
|
|||||||
CheckAndWriteComment(f, ++lineNo);
|
CheckAndWriteComment(f, ++lineNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write statistic block
|
if (!fCopyStatisticsBlock) { // write a new statistics block
|
||||||
TDatime dt;
|
// write statistic block
|
||||||
f << endl << "STATISTIC --- " << dt.AsSQLString();
|
TDatime dt;
|
||||||
CheckAndWriteComment(f, ++lineNo);
|
f << endl << "STATISTIC --- " << dt.AsSQLString();
|
||||||
// if fMin and fNdf are given, make new statistic block
|
CheckAndWriteComment(f, ++lineNo);
|
||||||
if ((fStatistic.fMin != -1.0) && (fStatistic.fNdf != 0)) {
|
// if fMin and fNdf are given, make new statistic block
|
||||||
// throw away the old statistics block
|
if ((fStatistic.fMin != -1.0) && (fStatistic.fNdf != 0)) {
|
||||||
fStatistic.fStatLines.clear();
|
// throw away the old statistics block
|
||||||
// create the new statistics block
|
fStatistic.fStatLines.clear();
|
||||||
PMsrLineStructure line;
|
// create the new statistics block
|
||||||
if (fStatistic.fValid) { // valid fit result
|
PMsrLineStructure line;
|
||||||
if (fStatistic.fChisq) { // chi^2
|
if (fStatistic.fValid) { // valid fit result
|
||||||
line.fLine = " chisq = ";
|
if (fStatistic.fChisq) { // chi^2
|
||||||
line.fLine += fStatistic.fMin;
|
line.fLine = " chisq = ";
|
||||||
line.fLine += ", NDF = ";
|
line.fLine += fStatistic.fMin;
|
||||||
line.fLine += fStatistic.fNdf;
|
line.fLine += ", NDF = ";
|
||||||
line.fLine += ", chisq/NDF = ";
|
line.fLine += fStatistic.fNdf;
|
||||||
line.fLine += fStatistic.fMin / fStatistic.fNdf;
|
line.fLine += ", chisq/NDF = ";
|
||||||
cout << endl << line.fLine.Data() << endl;
|
line.fLine += fStatistic.fMin / fStatistic.fNdf;
|
||||||
|
cout << line.fLine.Data() << endl;
|
||||||
|
} else {
|
||||||
|
line.fLine = " maxLH = ";
|
||||||
|
line.fLine += fStatistic.fMin;
|
||||||
|
line.fLine += ", NDF = ";
|
||||||
|
line.fLine += fStatistic.fNdf;
|
||||||
|
line.fLine += ", maxLH/NDF = ";
|
||||||
|
line.fLine += fStatistic.fMin / fStatistic.fNdf;
|
||||||
|
cout << line.fLine.Data() << endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
line.fLine = " maxLH = ";
|
line.fLine = "*** FIT DID NOT CONVERGE ***";
|
||||||
line.fLine += fStatistic.fMin;
|
|
||||||
line.fLine += ", NDF = ";
|
|
||||||
line.fLine += fStatistic.fNdf;
|
|
||||||
line.fLine += ", maxLH/NDF = ";
|
|
||||||
line.fLine += fStatistic.fMin / fStatistic.fNdf;
|
|
||||||
cout << endl << line.fLine.Data() << endl;
|
cout << endl << line.fLine.Data() << endl;
|
||||||
}
|
}
|
||||||
} else {
|
fStatistic.fStatLines.push_back(line);
|
||||||
line.fLine = "*** FIT DID NOT CONVERGE ***";
|
|
||||||
cout << endl << line.fLine.Data() << endl;
|
|
||||||
}
|
}
|
||||||
fStatistic.fStatLines.push_back(line);
|
|
||||||
}
|
}
|
||||||
// write the statistics block
|
// write the statistics block
|
||||||
for (unsigned int i=0; i<fStatistic.fStatLines.size(); i++) {
|
for (unsigned int i=0; i<fStatistic.fStatLines.size(); i++) {
|
||||||
|
@ -77,6 +77,7 @@ class PMsrHandler
|
|||||||
virtual void SetMsrDataRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
virtual void SetMsrDataRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
||||||
virtual void SetMsrBkgRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
virtual void SetMsrBkgRangeEntry(unsigned int runNo, unsigned int idx, int bin);
|
||||||
|
|
||||||
|
virtual void CopyMsrStatisticBlock() { fCopyStatisticsBlock = true; }
|
||||||
virtual void SetMsrStatisticConverged(bool converged) { fStatistic.fValid = converged; }
|
virtual void SetMsrStatisticConverged(bool converged) { fStatistic.fValid = converged; }
|
||||||
virtual void SetMsrStatisticMin(double min) { fStatistic.fMin = min; }
|
virtual void SetMsrStatisticMin(double min) { fStatistic.fMin = min; }
|
||||||
virtual void SetMsrStatisticNdf(unsigned int ndf) { fStatistic.fNdf = ndf; }
|
virtual void SetMsrStatisticNdf(unsigned int ndf) { fStatistic.fNdf = ndf; }
|
||||||
@ -114,6 +115,8 @@ class PMsrHandler
|
|||||||
|
|
||||||
PIntVector fParamInUse; ///< array holding the information if a particular parameter is used at all, i.e. if the theory is using it (perhaps via maps or functions)
|
PIntVector fParamInUse; ///< array holding the information if a particular parameter is used at all, i.e. if the theory is using it (perhaps via maps or functions)
|
||||||
|
|
||||||
|
bool fCopyStatisticsBlock; ///< flag, if true: just copy to old statistics block (musrt0), otherwise write a new one (musrfit)
|
||||||
|
|
||||||
virtual bool HandleFitParameterEntry(PMsrLines &line);
|
virtual bool HandleFitParameterEntry(PMsrLines &line);
|
||||||
virtual bool HandleTheoryEntry(PMsrLines &line);
|
virtual bool HandleTheoryEntry(PMsrLines &line);
|
||||||
virtual bool HandleFunctionsEntry(PMsrLines &line);
|
virtual bool HandleFunctionsEntry(PMsrLines &line);
|
||||||
|
@ -206,6 +206,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
msrHandler->CopyMsrStatisticBlock(); // just copy the statistics block since no fit is preformed
|
||||||
|
|
||||||
// check if the fittype is not NonMusr
|
// check if the fittype is not NonMusr
|
||||||
PMsrRunList *runList = msrHandler->GetMsrRunList();
|
PMsrRunList *runList = msrHandler->GetMsrRunList();
|
||||||
@ -284,7 +285,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
// write msr-file
|
// write msr-file
|
||||||
msrHandler->WriteMsrLogFile("msr");
|
msrHandler->WriteMsrLogFile("msr");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user