Merged muonspin/musrfit into master

This commit is contained in:
Zaher Salman 2016-08-09 14:18:54 +02:00
commit a64d0abccd
2 changed files with 33 additions and 22 deletions

View File

@ -97,7 +97,6 @@ PStartupHandler::PStartupHandler()
Char_t *home=0;
Char_t musrpath[128];
Char_t startup_path_name[128];
Bool_t found = false;
strncpy(musrpath, "", sizeof(musrpath));
@ -106,35 +105,42 @@ PStartupHandler::PStartupHandler()
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
}
if (!fStartupFileFound) { // startup file not found in the current directory
// check if the startup file is found under $HOME/.musrfit
home = getenv("HOME");
if (home != 0) {
sprintf(musrpath, "%s/.musrfit", home);
found = true;
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
pmusrpath = getenv("MUSRFITPATH");
if (!found) {
}
}
if (!fStartupFileFound) { // startup file not found in $HOME/.musrfit
// check if the MUSRFITPATH system variable is set
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath != 0) {
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
found = true;
sprintf(startup_path_name, "%s/musrfit_startup.xml", pmusrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
}
}
if (!found) { // MUSRFITPATH not set or empty, will try default one
if (!fStartupFileFound) { // MUSRFITPATH not set or empty, will try $ROOTSYS/bin
home = getenv("ROOTSYS");
if (home != 0) {
sprintf(musrpath, "%s/bin", home);
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
}
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
fStartupFilePath = TString(startup_path_name);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
}
}
}
//--------------------------------------------------------------------------
// Destructor

View File

@ -614,10 +614,15 @@ int main(int argc, char *argv[])
}
}
}
if (startupHandler)
startupHandler->SetStartupOptions(startup_options);
// read msr-file
PMsrHandler *msrHandler = new PMsrHandler(filename, startupHandler->GetStartupOptions());
PMsrHandler *msrHandler = 0;
if (startupHandler)
msrHandler = new PMsrHandler(filename, startupHandler->GetStartupOptions());
else
msrHandler = new PMsrHandler(filename);
status = msrHandler->ReadMsrFile();
if (status != PMUSR_SUCCESS) {
switch (status) {