add N0 estimate to single histogram fit. Some improvements in musredit (see ChangLog)

This commit is contained in:
2013-02-14 09:16:27 +00:00
parent 4e554aaf84
commit 310eedf190
24 changed files with 1089 additions and 163 deletions

View File

@ -89,6 +89,7 @@ void* musrfit_timeout(void *args)
void musrfit_syntax()
{
cout << endl << "usage: musrfit [<msr-file> [-k, --keep-mn2-ouput] [-c, --chisq-only] [-t, --title-from-data-file]";
cout << endl << " [-e, --estimateN0 <flag>] [-p, --per-run-block-chisq <flag>]";
cout << endl << " [--dump <type>] [--timeout <timeout_tag>] | --version | --help";
cout << endl << " <msr-file>: msr input file";
cout << endl << " 'musrfit <msr-file>' will execute musrfit";
@ -104,6 +105,9 @@ void musrfit_syntax()
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 << " 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 << " -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 << " <type> can be 'ascii', 'root'";
cout << endl << " --timeout <timeout_tag>: overwrites to predefined timeout of " << timeout << " (sec).";
@ -387,6 +391,10 @@ int main(int argc, char *argv[])
bool chisq_only = false;
bool title_from_data_file = false;
bool timeout_enabled = true;
PStartupOptions startup_options;
startup_options.writeExpectedChisq = false;
startup_options.estimateN0 = true;
startup_options.alphaEstimateN0 = 0.0;
TString dump("");
char filename[1024];
@ -432,6 +440,41 @@ int main(int argc, char *argv[])
dump = TString(argv[i+1]);
i++;
} else {
cerr << endl << "musrfit: **ERROR** found option --dump without <type>" << endl;
show_syntax = true;
break;
}
} else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--estimateN0")) {
if (i<argc-1) {
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")) {
if (i<argc-1) {
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;
}
@ -445,11 +488,13 @@ int main(int argc, char *argv[])
cout << endl << ">> musrfit: timeout disabled." << endl;
}
} else {
cerr << endl << "musrfit: **ERROR** found option --timeout with unsupported <timeout_tag> = " << argv[i+1] << endl;
show_syntax = true;
break;
}
i++;
} else {
cerr << endl << "musrfit: **ERROR** found option --timeout without <timeout_tag>" << endl;
show_syntax = true;
break;
}
@ -474,6 +519,7 @@ int main(int argc, char *argv[])
if (!dump.IsNull()) {
dump.ToLower();
if (!dump.Contains("ascii") && !dump.Contains("root")) {
cerr << endl << "musrfit: **ERROR** found option --dump with unsupported <type> = " << dump << endl;
musrfit_syntax();
return PMUSR_WRONG_STARTUP_SYNTAX;
}
@ -517,9 +563,10 @@ int main(int argc, char *argv[])
}
}
}
startupHandler->SetStartupOptions(startup_options);
// read msr-file
PMsrHandler *msrHandler = new PMsrHandler(filename, startupHandler->GetWritePerRunBlockChisq());
PMsrHandler *msrHandler = new PMsrHandler(filename, startupHandler->GetStartupOptions());
status = msrHandler->ReadMsrFile();
if (status != PMUSR_SUCCESS) {
switch (status) {