diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 8dd29d59..ec3a2b71 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -52,10 +52,9 @@ using namespace std; * * \param fileName */ -PMsrHandler::PMsrHandler(char *fileName) +PMsrHandler::PMsrHandler(char *fileName) : fFileName(fileName) { // init variables - fFileName = fileName; fMsrBlockCounter = 0; fTitle = ""; @@ -66,6 +65,17 @@ PMsrHandler::PMsrHandler(char *fileName) fStatistic.fNdf = 0; fFuncHandler = 0; + + if (fFileName.Contains("/")) { + Int_t idx = -1; + while (fFileName.Index("/", idx+1) != -1) { + idx = fFileName.Index("/", idx); + } + fMsrFileDirectoryPath = fFileName; + fMsrFileDirectoryPath.Remove(idx+1); + } else { + fMsrFileDirectoryPath = "./"; + } } //-------------------------------------------------------------------------- @@ -337,6 +347,8 @@ int PMsrHandler::WriteMsrLogFile(TString ext) else str += "mlog"; + str = fMsrFileDirectoryPath + str; + // clean up if (tokens) { delete tokens; diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index 070b31fa..075ff27f 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -271,6 +271,15 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned pathName = str; } + // check if the file is found in the + if (pathName.CompareTo("???") == 0) { // not found in local directory search + str = *fMsrInfo->GetMsrFileDirectoryPath(); + str += runInfo.fRunName[idx] + TString(".") + ext; + if (gSystem->AccessPathName(str.Data())!=true) { // found + pathName = str; + } + } + // check if the file is found in the directory given in the startup file if (pathName.CompareTo("???") == 0) { // not found in local directory search for (unsigned int i=0; i