Merged muonspin/musrfit into master

This commit is contained in:
Zaher Salman
2016-02-22 10:23:13 +01:00
102 changed files with 5822 additions and 1673 deletions

View File

@@ -365,6 +365,10 @@ Bool_t PRunDataHandler::ReadFilesMsr()
return false;
}
char str[1024], *p_str=0;
UInt_t year=0;
TString musrRoot("musr-root");
for (UInt_t i=0; i<runList->size(); i++) {
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
fRunName = *(runList->at(i).GetRunName(j));
@@ -372,8 +376,17 @@ Bool_t PRunDataHandler::ReadFilesMsr()
if (!FileExistsCheck(runList->at(i), j))
return false;
// get year from string if LEM data file
strcpy(str, fRunName.Data());
p_str = strstr(str, "lem");
if (p_str != 0)
sscanf(p_str, "lem%d_his", &year);
// check special case for ROOT-NPP/ROOT-PPC (LEM)
if (!runList->at(i).GetFileFormat(j)->CompareTo("root-npp")) { // not post pile up corrected histos
// if LEM file header is already TMusrRoot, change the data-file-format
if (year >= 12)
runList->at(i).SetFileFormat(musrRoot, j);
// check if forward/backward histoNo are within proper bounds, i.e. < PRH_PPC_OFFSET
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
if (runList->at(i).GetForwardHistoNo(k) > PRH_PPC_OFFSET)
@@ -384,6 +397,9 @@ Bool_t PRunDataHandler::ReadFilesMsr()
runList->at(i).SetBackwardHistoNo(runList->at(i).GetBackwardHistoNo(k)-PRH_PPC_OFFSET, k);
}
} else if (!runList->at(i).GetFileFormat(j)->CompareTo("root-ppc")) { // post pile up corrected histos
// if LEM file header is already TMusrRoot, change the data-file-format
if (year >= 12)
runList->at(i).SetFileFormat(musrRoot, j);
// check if forward/backward histoNo are within proper bounds, i.e. > PRH_PPC_OFFSET
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
if (runList->at(i).GetForwardHistoNo(k) < PRH_PPC_OFFSET)

View File

@@ -93,11 +93,13 @@ PStartupHandler::PStartupHandler()
fStartupFilePath = "";
// get default path (for the moment only linux like)
Char_t *pmusrpath;
Char_t *home;
Char_t *pmusrpath=0;
Char_t *home=0;
Char_t musrpath[128];
Char_t startup_path_name[128];
Bool_t pmusrpathfound = false;
Bool_t found = false;
strncpy(musrpath, "", sizeof(musrpath));
// check if the startup file is found in the current directory
strcpy(startup_path_name, "./musrfit_startup.xml");
@@ -105,20 +107,27 @@ PStartupHandler::PStartupHandler()
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
// check if the MUSRFITPATH system variable is set
// check if the startup file is found under $HOME/.musrfit
home = getenv("HOME");
if (home != 0) {
sprintf(musrpath, "%s/.musrfit", home);
found = true;
}
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath != 0) {
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
pmusrpathfound = true;
if (!found) {
// check if the MUSRFITPATH system variable is set
if (pmusrpath != 0) {
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
found = true;
}
}
}
if (!pmusrpathfound) { // MUSRFITPATH not set or empty, will try default one
if (!found) { // MUSRFITPATH not set or empty, will try default one
home = getenv("ROOTSYS");
sprintf(musrpath, "%s/bin", home);
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
} else {
strncpy(musrpath, pmusrpath, sizeof(musrpath));
}
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
fStartupFilePath = TString(startup_path_name);
if (StartupFileExists(startup_path_name)) {