Dynamic Search Path for ROOT Dictionary

Added by default the dynamic search path '/usr/local/lib' to ROOT.
This is needed to find the necessary dictionaries for musrfit,
musrview, musrt0. Furthermore, added an option '--show-dynamic-path'
to these programs which allow the user to dump the currently used
dynamic search paths. This is potentially handy for diagnostics.
This commit is contained in:
suter_a 2019-02-05 09:51:30 +01:00
parent 29d35579a7
commit 97beb80c4b
3 changed files with 35 additions and 5 deletions

View File

@ -90,12 +90,13 @@ 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] [-p, --per-run-block-chisq]";
cout << endl << " [--dump <type>] [--timeout <timeout_tag>] |";
cout << endl << " --nexus-support | --version | --help";
cout << endl << " --nexus-support | --show-dynamic-path | --version | --help";
cout << endl << " <msr-file>: msr input file";
cout << endl << " 'musrfit <msr-file>' will execute musrfit";
cout << endl << " 'musrfit' or 'musrfit --help' will show this help";
cout << endl << " 'musrfit --version' will print the musrfit version";
cout << endl << " 'musrfit --nexus-support' will print if NeXus support is available.";
cout << endl << " 'musrfit --show-dynamic-path' will print the internal dynamic library search paths.";
cout << endl << " -k, --keep-mn2-output: will rename the files MINUIT2.OUTPUT and ";
cout << endl << " MINUIT2.root to <msr-file>-mn2.output and <msr-file>-mn2.root,";
cout << endl << " respectively,";
@ -456,6 +457,11 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// add default shared library path /usr/local/lib if not already persent
const char *dsp = gSystem->GetDynamicPath();
if (strstr(dsp, "/usr/local/lib") == NULL)
gSystem->AddDynamicPath("/usr/local/lib");
if (argc == 2) {
if (!strcmp(argv[1], "--version")) {
#ifdef HAVE_CONFIG_H
@ -468,9 +474,13 @@ int main(int argc, char *argv[])
#ifdef PNEXUS_ENABLED
cout << endl << ">> musrfit: NeXus support enabled." << endl << endl;
#else
cout << endl << ">> musrfit: NeXus support NOT enabled." << endl << endl;
cout << endl << "musrfit: NeXus support NOT enabled." << endl << endl;
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[1], "--show-dynamic-path")) {
cout << endl << "musrfit: internal dynamic search paths for shared libraries/root dictionaries:";
cout << endl << " '" << gSystem->GetDynamicPath() << "'" << endl << endl;
return PMUSR_SUCCESS;
} else if (!strcmp(argv[1], "--help")) {
show_syntax = true;
}

View File

@ -57,7 +57,7 @@ using namespace std;
void musrt0_syntax()
{
cout << endl << "usage: musrt0 <msr-file> [{--getT0FromPromptPeak | -g} [<firstGoodBinOffset>]]";
cout << endl << " [--timeout <timeout>] | --version | --help";
cout << endl << " [--timeout <timeout>] | --show-dynamic-path | --version | --help";
cout << endl << " <msr-file>: msr input file";
cout << endl << " --getT0FromPromptPeak, -g with <firstGoodBinOffset>:";
cout << endl << " will, in non-interactive mode estimate the t0's from the prompt peak";
@ -72,6 +72,7 @@ void musrt0_syntax()
cout << endl << " 180 sec if not already done so.";
cout << endl << " 'musrt0' or 'musrt0 --help' will show this help";
cout << endl << " 'musrt0 --version' will print the musrt0 version";
cout << endl << " 'musrt0 --show-dynamic-path' dumps the dynamic search paths and exit.";
cout << endl << endl;
}
@ -228,6 +229,11 @@ Int_t main(Int_t argc, Char_t *argv[])
return PMUSR_SUCCESS;
}
// add default shared library path /usr/local/lib if not already persent
const char *dsp = gSystem->GetDynamicPath();
if (strstr(dsp, "/usr/local/lib") == NULL)
gSystem->AddDynamicPath("/usr/local/lib");
memset(filename, '\0', sizeof(filename));
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "--version")) {
@ -238,8 +244,12 @@ Int_t main(Int_t argc, Char_t *argv[])
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--help")) {
show_syntax = true;
break;
musrt0_syntax();
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--show-dynamic-path")) {
cout << endl << "musrt0: internal dynamic search paths for shared libraries/root dictionaries:";
cout << endl << " '" << gSystem->GetDynamicPath() << "'" << endl << endl;
return PMUSR_SUCCESS;
} else if (strstr(argv[i], ".msr")) { // check for filename
if (strlen(filename) == 0) {
strcpy(filename, argv[i]);

View File

@ -62,6 +62,7 @@ void musrview_syntax()
cout << endl << " Options:";
cout << endl << " --help : display this help and exit.";
cout << endl << " --version : output version information and exit.";
cout << endl << " --show-dynamic-path : dumps the dynamic search paths and exit.";
cout << endl << " -f, --fourier: will directly present the Fourier transform of the <msr-file>.";
cout << endl << " -a, --avg: will directly present the averaged data/Fourier of the <msr-file>.";
cout << endl << " --<graphic-format-extension>: ";
@ -111,6 +112,11 @@ int main(int argc, char *argv[])
memset(fileName, '\0', sizeof(fileName));
// add default shared library path /usr/local/lib if not already persent
const char *dsp = gSystem->GetDynamicPath();
if (strstr(dsp, "/usr/local/lib") == NULL)
gSystem->AddDynamicPath("/usr/local/lib");
// check input arguments
if (argc == 1) {
musrview_syntax();
@ -132,6 +138,10 @@ int main(int argc, char *argv[])
cout << endl << "musrview git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl;
#endif
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--show-dynamic-path")) {
cout << endl << "musrview: internal dynamic search paths for shared libraries/root dictionaries:";
cout << endl << " '" << gSystem->GetDynamicPath() << "'" << endl << endl;
return PMUSR_SUCCESS;
} else if (!strcmp(argv[i], "--help")) {
show_syntax = true;
break;