added msr-file-directory-path-handling. Rigorous tests still due
This commit is contained in:
parent
c196c66b4e
commit
28c9ff7784
@ -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;
|
||||
|
@ -271,6 +271,15 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
pathName = str;
|
||||
}
|
||||
|
||||
// check if the file is found in the <msr-file-directory>
|
||||
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<fDataPath.size(); i++) {
|
||||
|
@ -63,6 +63,8 @@ class PMsrHandler
|
||||
virtual PMsrPlotList* GetMsrPlotList() { return &fPlots; }
|
||||
virtual PMsrStatisticStructure* GetMsrStatistic() { return &fStatistic; }
|
||||
|
||||
virtual TString* GetMsrFileDirectoryPath() { return &fMsrFileDirectoryPath; }
|
||||
|
||||
virtual unsigned int GetNoOfParams() { return fParam.size(); }
|
||||
virtual const TString& GetFileName() const { return fFileName; }
|
||||
|
||||
@ -95,6 +97,7 @@ class PMsrHandler
|
||||
private:
|
||||
PMsrLines fComments; ///< holds the comments of the msr-file
|
||||
TString fFileName; ///< file name of the msr-file
|
||||
TString fMsrFileDirectoryPath; ///< msr-file directory path
|
||||
TString fTitle; ///< holds the title string of the msr-file
|
||||
PMsrParamList fParam; ///< holds a list of the fit parameters
|
||||
PMsrLines fTheory; ///< holds the theory definition
|
||||
|
Loading…
x
Reference in New Issue
Block a user