From e44bc91a03be1191d22c0c7f4cda029c942aa45c Mon Sep 17 00:00:00 2001 From: nemu Date: Fri, 1 May 2009 06:51:46 +0000 Subject: [PATCH] some minor changes needed for proper msr-file handling with musrt0 (see MUSR-45) --- src/classes/PMsrHandler.cpp | 61 +++++++++++++++++++------------------ src/include/PMsrHandler.h | 3 ++ src/musrt0.cpp | 2 +- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index f6d56e4e..a61003ee 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -59,6 +59,7 @@ PMsrHandler::PMsrHandler(char *fileName) : fFileName(fileName) fTitle = ""; + fCopyStatisticsBlock = false; fStatistic.fValid = false; fStatistic.fChisq = true; fStatistic.fMin = -1.0; @@ -830,39 +831,41 @@ int PMsrHandler::WriteMsrLogFile(TString ext) CheckAndWriteComment(f, ++lineNo); } - // write statistic block - TDatime dt; - f << endl << "STATISTIC --- " << dt.AsSQLString(); - CheckAndWriteComment(f, ++lineNo); - // if fMin and fNdf are given, make new statistic block - if ((fStatistic.fMin != -1.0) && (fStatistic.fNdf != 0)) { - // throw away the old statistics block - fStatistic.fStatLines.clear(); - // create the new statistics block - PMsrLineStructure line; - if (fStatistic.fValid) { // valid fit result - if (fStatistic.fChisq) { // chi^2 - line.fLine = " chisq = "; - line.fLine += fStatistic.fMin; - line.fLine += ", NDF = "; - line.fLine += fStatistic.fNdf; - line.fLine += ", chisq/NDF = "; - line.fLine += fStatistic.fMin / fStatistic.fNdf; - cout << endl << line.fLine.Data() << endl; + if (!fCopyStatisticsBlock) { // write a new statistics block + // write statistic block + TDatime dt; + f << endl << "STATISTIC --- " << dt.AsSQLString(); + CheckAndWriteComment(f, ++lineNo); + // if fMin and fNdf are given, make new statistic block + if ((fStatistic.fMin != -1.0) && (fStatistic.fNdf != 0)) { + // throw away the old statistics block + fStatistic.fStatLines.clear(); + // create the new statistics block + PMsrLineStructure line; + if (fStatistic.fValid) { // valid fit result + if (fStatistic.fChisq) { // chi^2 + line.fLine = " chisq = "; + line.fLine += fStatistic.fMin; + line.fLine += ", NDF = "; + line.fLine += fStatistic.fNdf; + line.fLine += ", chisq/NDF = "; + 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 { - line.fLine = " maxLH = "; - line.fLine += fStatistic.fMin; - line.fLine += ", NDF = "; - line.fLine += fStatistic.fNdf; - line.fLine += ", maxLH/NDF = "; - line.fLine += fStatistic.fMin / fStatistic.fNdf; + line.fLine = "*** FIT DID NOT CONVERGE ***"; cout << endl << line.fLine.Data() << endl; } - } else { - line.fLine = "*** FIT DID NOT CONVERGE ***"; - cout << endl << line.fLine.Data() << endl; + fStatistic.fStatLines.push_back(line); } - fStatistic.fStatLines.push_back(line); } // write the statistics block for (unsigned int i=0; iCopyMsrStatisticBlock(); // just copy the statistics block since no fit is preformed // check if the fittype is not NonMusr PMsrRunList *runList = msrHandler->GetMsrRunList(); @@ -284,7 +285,6 @@ int main(int argc, char *argv[]) } } } -cout << endl; // write msr-file msrHandler->WriteMsrLogFile("msr");