add an option to musrfit which allows to replace to musrfit_startup.xml by the default one.

This commit is contained in:
2023-11-11 18:26:25 +01:00
parent f72a213bd8
commit df926a4d66
3 changed files with 53 additions and 27 deletions

View File

@@ -122,6 +122,12 @@ void musrfit_syntax()
std::cout << std::endl << " -u, --use-no-of-threads <number>:";
std::cout << std::endl << " <number>: number of threads to be used (OpenMP). Needs to be <= max. number of cores.";
std::cout << std::endl << " If OpenMP is enable, the maximal number of cores is used, if it is not limited by this option.";
std::cout << std::endl << " -r, --reset: reset startup musrfit_startup.xml, i.e. rewrite a default, and quit.";
std::cout << std::endl << " The order of which musrfit_startup.xml is reset is:";
std::cout << std::endl << " (i) if present in the current dir.";
std::cout << std::endl << " (ii) if present under $HOME/.musrfit/";
std::cout << std::endl << " (iii) if present under $MUSRFITPATH/";
std::cout << std::endl << " (iv) if present under $ROOTSYS/";
std::cout << std::endl << " --dump <type> is writing a data file with the fit data and the theory";
std::cout << std::endl << " <type> can be 'ascii', 'root'";
std::cout << std::endl << " --timeout <timeout_tag>: overwrites to predefined timeout of " << timeout << " (sec).";
@@ -443,6 +449,7 @@ int main(int argc, char *argv[])
bool chisq_only = false;
bool title_from_data_file = false;
bool timeout_enabled = true;
bool reset_startup_file = false;
PStartupOptions startup_options;
startup_options.writeExpectedChisq = false;
startup_options.estimateN0 = false;
@@ -569,6 +576,8 @@ int main(int argc, char *argv[])
show_syntax = true;
break;
}
} else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--reset")) {
reset_startup_file = true;
} else if (!strcmp(argv[i], "--timeout")) {
if (i<argc-1) {
TString str(argv[i+1]);
@@ -596,7 +605,7 @@ int main(int argc, char *argv[])
}
// check if a filename is present
if (strlen(filename) == 0) {
if ((strlen(filename) == 0) && !reset_startup_file) {
show_syntax = true;
std::cout << std::endl << ">> musrfit **ERROR** no msr-file present!" << std::endl;
}
@@ -619,7 +628,9 @@ int main(int argc, char *argv[])
// read startup file
char startup_path_name[128];
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>();
std::unique_ptr<PStartupHandler> startupHandler = std::make_unique<PStartupHandler>(reset_startup_file);
if (reset_startup_file) // only rewrite musrfit_startup.xml has been requested
return PMUSR_SUCCESS;
if (!startupHandler->StartupFileFound()) {
std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
std::cerr << std::endl;