some minor changes needed for proper msr-file handling with musrt0 (see MUSR-45)

This commit is contained in:
nemu 2009-05-01 06:51:46 +00:00
parent bbf48eac60
commit e44bc91a03
3 changed files with 36 additions and 30 deletions

View File

@ -59,6 +59,7 @@ PMsrHandler::PMsrHandler(char *fileName) : fFileName(fileName)
fTitle = "";
fCopyStatisticsBlock = false;
fStatistic.fValid = false;
fStatistic.fChisq = true;
fStatistic.fMin = -1.0;
@ -830,6 +831,7 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
CheckAndWriteComment(f, ++lineNo);
}
if (!fCopyStatisticsBlock) { // write a new statistics block
// write statistic block
TDatime dt;
f << endl << "STATISTIC --- " << dt.AsSQLString();
@ -848,7 +850,7 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
line.fLine += fStatistic.fNdf;
line.fLine += ", chisq/NDF = ";
line.fLine += fStatistic.fMin / fStatistic.fNdf;
cout << endl << line.fLine.Data() << endl;
cout << line.fLine.Data() << endl;
} else {
line.fLine = " maxLH = ";
line.fLine += fStatistic.fMin;
@ -856,7 +858,7 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
line.fLine += fStatistic.fNdf;
line.fLine += ", maxLH/NDF = ";
line.fLine += fStatistic.fMin / fStatistic.fNdf;
cout << endl << line.fLine.Data() << endl;
cout << line.fLine.Data() << endl;
}
} else {
line.fLine = "*** FIT DID NOT CONVERGE ***";
@ -864,6 +866,7 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
}
fStatistic.fStatLines.push_back(line);
}
}
// write the statistics block
for (unsigned int i=0; i<fStatistic.fStatLines.size(); i++) {
f << endl << fStatistic.fStatLines[i].fLine.Data();

View File

@ -77,6 +77,7 @@ class PMsrHandler
virtual void SetMsrDataRangeEntry(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 SetMsrStatisticMin(double min) { fStatistic.fMin = min; }
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)
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 HandleTheoryEntry(PMsrLines &line);
virtual bool HandleFunctionsEntry(PMsrLines &line);

View File

@ -206,6 +206,7 @@ int main(int argc, char *argv[])
}
return status;
}
msrHandler->CopyMsrStatisticBlock(); // 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");