Slightly changed the behavior of msr2data (see ChangeLog for details)

This commit is contained in:
Bastian M. Wojek 2011-07-13 13:37:28 +00:00
parent fa02394364
commit 1e115c7bd3
4 changed files with 30 additions and 15 deletions

View File

@ -25,6 +25,10 @@ FIXED bug reported in MUSR-183: missing background for 2nd histo in asymmetry fi
FIXED Makefiles so that the NeXus support will not be built if it has not been enabled during the configure stage
FIXED ASCII export from musrview in case of a Fourier-Power- or Fourier-Phase-difference plot
FIXED bug in asymmetry fit with fixed background
CHANGED the behavior of msr2data so that
* it proceeds to the next run if a fit did not converge (and does not stop as before)
* it always tries to read the data files if the nosummary option is not present
(before this was switched off for the next runs when the data file of the present run could not be read)
CHANGED in case first good bin (fgb) is not given, it is now fgb=t0+(10ns/time resolution) (MUSR-190)
CHANGED improved handling of 'old' ROOT LEM data files (2006 and earlier) for any2many (MUSR-178)
CHANGED improved handling of WKM/ASCII in PRunDataHandler for any2many (MUSR-172)

View File

@ -513,10 +513,10 @@ PMsrHandler* PMsr2Data::GetSingleRunMsrFile() const
* <p> Read in a run data-file
*
* <p><b>return:</b>
* - true if everything is OK
* - false otherwise
* - 0 if everything is OK
* - 1 otherwise
*/
bool PMsr2Data::ReadRunDataFile()
int PMsr2Data::ReadRunDataFile()
{
if (fStartupHandler)
fDataHandler = new PRunDataHandler(fMsrHandler, fStartupHandler->GetDataPathList());
@ -528,13 +528,14 @@ bool PMsr2Data::ReadRunDataFile()
cerr << endl << ">> msr2data: **WARNING** Could not read all data files, will continue without the data file information..." << endl;
delete fDataHandler;
fDataHandler = 0;
return 1;
}
return success;
return 0;
}
//-------------------------------------------------------------
/**
* <p> Generate a new single run msr-file from a template
* <p> Generate a new single-run msr file from a template
*
* <p><b>return:</b>
* - true if everything is OK
@ -623,6 +624,9 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun, bool calledFromGlobalM
while (strLine >> firstOnLine)
out << " " << firstOnLine;
out << endl;
} else if (!to_lower_copy(firstOnLine).compare("chisq") || !to_lower_copy(firstOnLine).compare("maxlh")) {
out << "*** FIT DID NOT CONVERGE ***" << endl;
break;
} else {
out << line << endl;
}
@ -1525,6 +1529,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
++fRunVectorIter;
}
// set the convergence flag to false because no fit has been performed using the newly generated file
fMsrHandler->GetMsrStatistic()->fValid = false;
// write the global msr-file
status = fMsrHandler->WriteMsrFile(msrOutFile.c_str(), &commentsP, 0, 0, &commentsR);
@ -1619,6 +1626,9 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const
}
}
// set the convergence flag to false because no fit has been performed using the newly generated file
fMsrHandler->GetMsrStatistic()->fValid = false;
// write the msr-file
int status = fMsrHandler->WriteMsrFile(msrOutFile.str().c_str());
@ -1632,7 +1642,7 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const
titleCopy.Clear();
if (status != PMUSR_SUCCESS) {
cerr << endl << ">> msr2data: **ERROR** Writing the new msr-file has not been successful!";
cerr << endl << ">> msr2data: **ERROR** Writing the new msr file has not been successful!";
cerr << endl;
return false;
}
@ -1643,11 +1653,12 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const
//-------------------------------------------------------------
/**
* <p> Append fit parameters of a msr-file to the DB or ASCII file
* <p> Append fit parameters of a msr file to the DB or ASCII file
*
* <p><b>return:</b>
* - PMUSR_SUCCESS if everything is OK
* - -1 in case of an error
* - -1 in case of a fatal error
* - -2 if a fit has not converged (and the data is not appended to the output file)
*
* \param outfile name of the DB/ASCII output file
* \param db DB or plain ASCII output
@ -1944,7 +1955,7 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
dataParamErr.clear();
indVarValues.clear();
return -1;
return -2;
}
// open the DB or dat file and write the data

View File

@ -68,7 +68,7 @@ class PMsr2Data
int ParseXmlStartupFile();
int ReadMsrFile(const string&) const;
bool ReadRunDataFile();
int ReadRunDataFile();
bool PrepareNewInputFile(unsigned int, bool) const; // template
bool PrepareGlobalInputFile(unsigned int, const string&, unsigned int) const; // generate msr-input file for a global fit

View File

@ -725,14 +725,14 @@ int main(int argc, char *argv[])
// read data files
if (writeSummary)
writeSummary = msr2dataHandler->ReadRunDataFile();
status = msr2dataHandler->ReadRunDataFile();
unsigned int counter(0);
while (msr2dataHandler->GetPresentRun()) {
// write DB or dat file
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader, !setNormalMode, counter);
if (status != PMUSR_SUCCESS) {
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
}
@ -805,7 +805,7 @@ int main(int argc, char *argv[])
if (status != PMUSR_SUCCESS) {
// if the msr-file cannot be read, write no output but proceed to the next run
status = msr2dataHandler->WriteOutput("none", db, writeHeader);
if (status != PMUSR_SUCCESS) {
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
} else {
@ -816,11 +816,11 @@ int main(int argc, char *argv[])
// read data files
if (writeSummary)
writeSummary = msr2dataHandler->ReadRunDataFile();
status = msr2dataHandler->ReadRunDataFile();
// write DB or dat file
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader);
if (status != PMUSR_SUCCESS) {
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
}