cleaned up some inconsistencies in the musrfit_startup.xml options

This commit is contained in:
suter_a 2016-12-18 10:39:43 +01:00
parent 63516fc499
commit 5d80c342e0
5 changed files with 9 additions and 77 deletions

View File

@ -178,10 +178,6 @@ void PStartupHandler::OnStartDocument()
fFourierDefaults.fPlotRange[0] = -1.0; fFourierDefaults.fPlotRange[0] = -1.0;
fFourierDefaults.fPlotRange[1] = -1.0; fFourierDefaults.fPlotRange[1] = -1.0;
fFourierDefaults.fPhaseIncrement = 1.0; fFourierDefaults.fPhaseIncrement = 1.0;
fStartupOptions.writeExpectedChisq = false;
fStartupOptions.estimateN0 = true;
fStartupOptions.alphaEstimateN0 = 0.0;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -210,12 +206,6 @@ void PStartupHandler::OnStartElement(const Char_t *str, const TList *attributes)
{ {
if (!strcmp(str, "data_path")) { if (!strcmp(str, "data_path")) {
fKey = eDataPath; fKey = eDataPath;
} else if (!strcmp(str, "write_per_run_block_chisq")) {
fKey = eWritePerRunBlockChisq;
} else if (!strcmp(str, "estimate_n0")) {
fKey = eEstimateN0;
} else if (!strcmp(str, "alpha_estimate_n0")) {
fKey = eAlphaEstimateN0;
} else if (!strcmp(str, "marker")) { } else if (!strcmp(str, "marker")) {
fKey = eMarker; fKey = eMarker;
} else if (!strcmp(str, "color")) { } else if (!strcmp(str, "color")) {
@ -270,21 +260,6 @@ void PStartupHandler::OnCharacters(const Char_t *str)
// add str to the path list // add str to the path list
fDataPathList.push_back(str); fDataPathList.push_back(str);
break; break;
case eWritePerRunBlockChisq:
tstr = TString(str);
if (tstr.BeginsWith("y") || tstr.BeginsWith("Y"))
fStartupOptions.writeExpectedChisq = true;
break;
case eEstimateN0:
tstr = TString(str);
if (tstr.BeginsWith("n") || tstr.BeginsWith("N"))
fStartupOptions.estimateN0 = false;
break;
case eAlphaEstimateN0:
tstr = TString(str);
if (tstr.IsFloat())
fStartupOptions.alphaEstimateN0 = tstr.Atof();
break;
case eMarker: case eMarker:
// check that str is a number // check that str is a number
tstr = TString(str); tstr = TString(str);

View File

@ -815,12 +815,11 @@ typedef struct {
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>Holds the informations for the any2many converter program * <p>Holds the informations
*/ */
typedef struct { typedef struct {
Bool_t writeExpectedChisq; ///< if set to true, expected chisq per block will be written Bool_t writeExpectedChisq; ///< if set to true, expected chisq per block will be written
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated
Double_t alphaEstimateN0; ///< relates the Bkg to N0, i.e. Bkg = alpha*N0
} PStartupOptions; } PStartupOptions;
//------------------------------------------------------------- //-------------------------------------------------------------

View File

@ -73,17 +73,15 @@ class PStartupHandler : public TObject, public TQObject
virtual void CheckLists(); virtual void CheckLists();
virtual PStartupOptions* GetStartupOptions() { return &fStartupOptions; } ///< returns the startup options
virtual PMsrFourierStructure GetFourierDefaults() { return fFourierDefaults; } ///< returns the Fourier defaults virtual PMsrFourierStructure GetFourierDefaults() { return fFourierDefaults; } ///< returns the Fourier defaults
virtual const PStringVector GetDataPathList() const { return fDataPathList; } ///< returns the search data path list virtual const PStringVector GetDataPathList() const { return fDataPathList; } ///< returns the search data path list
virtual const PIntVector GetMarkerList() const { return fMarkerList; } ///< returns the marker list virtual const PIntVector GetMarkerList() const { return fMarkerList; } ///< returns the marker list
virtual const PIntVector GetColorList() const { return fColorList; } ///< returns the color list virtual const PIntVector GetColorList() const { return fColorList; } ///< returns the color list
virtual void SetStartupOptions(const PStartupOptions opt) { fStartupOptions = opt; }
private: private:
enum EKeyWords {eEmpty, eComment, eDataPath, eOptions, eWritePerRunBlockChisq, eEstimateN0, eAlphaEstimateN0, enum EKeyWords {eEmpty, eComment, eDataPath, eOptions,
eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase, ePhaseIncrement, eFourierSettings, eUnits, eFourierPower,
eApodization, ePlot, ePhase, ePhaseIncrement,
eRootSettings, eMarkerList, eMarker, eRootSettings, eMarkerList, eMarker,
eColorList, eColor}; eColorList, eColor};
EKeyWords fKey; ///< xml filter key EKeyWords fKey; ///< xml filter key
@ -94,7 +92,6 @@ class PStartupHandler : public TObject, public TQObject
PStringVector fDataPathList; ///< search data path list PStringVector fDataPathList; ///< search data path list
PIntVector fMarkerList; ///< marker list PIntVector fMarkerList; ///< marker list
PIntVector fColorList; ///< color list PIntVector fColorList; ///< color list
PStartupOptions fStartupOptions; ///< collects all startup options which will be requested by PMsrFileHandler
Bool_t StartupFileExists(Char_t *fln); Bool_t StartupFileExists(Char_t *fln);

View File

@ -104,9 +104,8 @@ void musrfit_syntax()
cout << endl << " -t, --title-from-data-file: will replace the <msr-file> run title by the"; cout << endl << " -t, --title-from-data-file: will replace the <msr-file> run title by the";
cout << endl << " run title of the FIRST run of the <msr-file> run block, if a run title"; cout << endl << " run title of the FIRST run of the <msr-file> run block, if a run title";
cout << endl << " is present in the data file."; cout << endl << " is present in the data file.";
cout << endl << " -e, --estimateN0: estimate N0 for single histogram fits flag. <flag> can have the values 'yes' or 'no'."; cout << endl << " -e, --estimateN0: estimate N0 for single histogram fits.";
cout << endl << " -p, --per-run-block-chisq: will write per run block chisq to the msr-file."; cout << endl << " -p, --per-run-block-chisq: will write per run block chisq to the msr-file.";
cout << endl << " <flag> can have the values 'yes' or 'no'.";
cout << endl << " --dump <type> is writing a data file with the fit data and the theory"; cout << endl << " --dump <type> is writing a data file with the fit data and the theory";
cout << endl << " <type> can be 'ascii', 'root'"; cout << endl << " <type> can be 'ascii', 'root'";
cout << endl << " --timeout <timeout_tag>: overwrites to predefined timeout of " << timeout << " (sec)."; cout << endl << " --timeout <timeout_tag>: overwrites to predefined timeout of " << timeout << " (sec).";
@ -444,8 +443,7 @@ int main(int argc, char *argv[])
bool timeout_enabled = true; bool timeout_enabled = true;
PStartupOptions startup_options; PStartupOptions startup_options;
startup_options.writeExpectedChisq = false; startup_options.writeExpectedChisq = false;
startup_options.estimateN0 = true; startup_options.estimateN0 = false;
startup_options.alphaEstimateN0 = 0.0;
TString dump(""); TString dump("");
char filename[1024]; char filename[1024];
@ -496,39 +494,9 @@ int main(int argc, char *argv[])
break; break;
} }
} else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--estimateN0")) { } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--estimateN0")) {
if (i<argc-1) { startup_options.estimateN0 = true;
if (!strcmp(argv[i+1], "yes")) {
startup_options.estimateN0 = true;
} else if (!strcmp(argv[i+1], "no")) {
startup_options.estimateN0 = false;
} else {
cerr << endl << "musrfit: **ERROR** option --estimateN0 <flag> with unsupported <flag> = " << argv[i+1] << endl;
show_syntax = true;
break;
}
i++;
} else {
cerr << endl << "musrfit: **ERROR** found option --estimateN0 without <flag>" << endl;
show_syntax = true;
break;
}
} else if (!strcmp(argv[i], "-p") || !strcmp(argv[i], "--per-run-block-chisq")) { } else if (!strcmp(argv[i], "-p") || !strcmp(argv[i], "--per-run-block-chisq")) {
if (i<argc-1) { startup_options.writeExpectedChisq = true;
if (!strcmp(argv[i+1], "yes")) {
startup_options.writeExpectedChisq = true;
} else if (!strcmp(argv[i+1], "no")) {
startup_options.writeExpectedChisq = false;
} else {
cerr << endl << "musrfit: **ERROR** option --per-run-block-chisq <flag> with unsupported <flag> = " << argv[i+1] << endl;
show_syntax = true;
break;
}
i++;
} else {
cerr << endl << "musrfit: **ERROR** found option --per-run-block-chisq without <flag>" << endl;
show_syntax = true;
break;
}
} else if (!strcmp(argv[i], "--timeout")) { } else if (!strcmp(argv[i], "--timeout")) {
if (i<argc-1) { if (i<argc-1) {
TString str(argv[i+1]); TString str(argv[i+1]);
@ -614,13 +582,11 @@ int main(int argc, char *argv[])
} }
} }
} }
if (startupHandler)
startupHandler->SetStartupOptions(startup_options);
// read msr-file // read msr-file
PMsrHandler *msrHandler = 0; PMsrHandler *msrHandler = 0;
if (startupHandler) if (startupHandler)
msrHandler = new PMsrHandler(filename, startupHandler->GetStartupOptions()); msrHandler = new PMsrHandler(filename, &startup_options);
else else
msrHandler = new PMsrHandler(filename); msrHandler = new PMsrHandler(filename);
status = msrHandler->ReadMsrFile(); status = msrHandler->ReadMsrFile();

View File

@ -14,11 +14,6 @@
<data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path> <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>
<data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path> <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>
<data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path> <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>
<options>
<write_per_run_block_chisq>n</write_per_run_block_chisq>
<estimate_n0>yes</estimate_n0>
<alpha_estimate_n0>0.0</alpha_estimate_n0>
</options>
<fourier_settings> <fourier_settings>
<units>Gauss</units> <units>Gauss</units>
<fourier_power>0</fourier_power> <fourier_power>0</fourier_power>