From b53276419f50b25c27ac97df25addb87e585a53d Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 1 Sep 2008 06:59:01 +0000 Subject: [PATCH] added keep-mn2-output flag --- src/ToDo.txt | 11 ++++++ src/musrfit.cpp | 94 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 82 insertions(+), 23 deletions(-) diff --git a/src/ToDo.txt b/src/ToDo.txt index 840f2c1d..24446324 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -81,6 +81,17 @@ short term: * Minuit2: name length is now unlimited and hence the 10 char restriction can be lifted. **DONE** 08-08-08 +* musrfit: switch "--keep-output-mn2" and "-k" needed. It will rename the MINUIT2.OUTPUT and + MINUIT2.root files to fln-mn2.output and fln-mn2.root. + This is sometimes nice to have. + **DONE** 08-09-01 + +* PFitter.cpp: the value of the parabolic error in the MINUIT2.OUTPUT is wrong (only MIGRAD is + called and neither HESSE nor MINOS). Suspect the problem in the ExecuteSave() routine. + Needs to be checked. + +* PFitter.cpp: implement HESSE + * implement FFT with msr-interface --------------------- diff --git a/src/musrfit.cpp b/src/musrfit.cpp index becbdc4e..6d66ca9a 100644 --- a/src/musrfit.cpp +++ b/src/musrfit.cpp @@ -57,14 +57,17 @@ using namespace std; */ void musrfit_syntax() { - cout << endl << "usage: musrfit [ [--debug] | [--dump ]] | --version | --help"; + cout << endl << "usage: musrfit [ [-k, --keep-mn2-ouput] [--debug] [--dump ]] | --version | --help"; cout << endl << " : msr input file"; cout << endl << " 'musrfit ' will execute msrfit"; cout << endl << " 'musrfit' or 'musrfit --help' will show this help"; cout << endl << " 'musrfit --version' will print the msrfit version"; + cout << endl << " -k, --keep-mn2-output: will rename the files MINUIT2.OUTPUT and "; + cout << endl << " MINUIT2.root to -mn2.output and -mn2.root, repectively,"; + cout << endl << " e.g. = 147.msr -> 147-mn2.output, 147-mn2.root"; cout << endl << " --debug is used to print additional infos"; cout << endl << " --dump is writing a data file with the fit data and the theory"; - cout << endl << " can be 'ascii', 'root'"; + cout << endl << " can be 'ascii', 'root'"; cout << endl << endl; } @@ -469,37 +472,25 @@ int main(int argc, char *argv[]) bool show_syntax = false; int status; bool debug = false; + bool keep_mn2_output = false; TString dump(""); // check syntax + if (argc < 2) { + musrfit_syntax(); + return PMUSR_WRONG_STARTUP_SYNTAX; + } + if (argc == 2) { if (!strcmp(argv[1], "--version")) { cout << endl << "musrfit version: $Id$"; cout << endl << endl; return PMUSR_SUCCESS; - } else if (!strcmp(argv[1], "--help")) { - show_syntax = true; - } else { // assume file name - // check if filename has extension msr - if (!strstr(argv[1], ".msr")) { - cout << endl << "ERROR: " << argv[1] << " is not a msr-file!" << endl; - show_syntax = true; - } else { - show_syntax = false; - } } - } else if (argc == 3) { - if (!strcmp(argv[2], "--debug")) - debug = true; - else + + if (!strcmp(argv[1], "--help")) { show_syntax = true; - } else if (argc == 4) { - if (!strcmp(argv[2], "--dump")) - dump = TString(argv[3]); - else - show_syntax = true; - } else { - show_syntax = true; + } } if (show_syntax) { @@ -507,6 +498,47 @@ int main(int argc, char *argv[]) return PMUSR_WRONG_STARTUP_SYNTAX; } + // check file name + if (!strstr(argv[1], ".msr")) { + cout << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl; + musrfit_syntax(); + return PMUSR_WRONG_STARTUP_SYNTAX; + } + + for (int i=2; iCopyFile("MINUIT2.OUTPUT", fln.Data(), kTRUE); + + // 2nd rename MINUIT2.ROOT + fln = TString(argv[1]); + strcpy(ext, "-mn2.root"); + fln.ReplaceAll(".msr", 4, ext, strlen(ext)); + gSystem->CopyFile("MINUIT2.root", fln.Data(), kTRUE); + } + // clean up if (startupHandler) { delete startupHandler;