path-run-name in RUN block of the msr-file can now handle spaces.

This commit is contained in:
2025-01-18 13:35:08 +01:00
parent e67d92fc05
commit ebdb0feb7f
4 changed files with 61 additions and 33 deletions

View File

@@ -3244,7 +3244,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
while ((iter != lines.end()) && !error) {
// remove potential comment at the end of lines
str = iter->fLine;
Ssiz_t idx = str.Index("#");
Ssiz_t idx = str.Index("(");
if (idx != -1)
str.Remove(idx);
@@ -3274,23 +3274,29 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
}
// get run name, beamline, institute, and file-format
// the path/filename could potentially contain spaces! Hence the run name needs to be reconstructed from the parsing
if (tokens->GetEntries() < 5) {
error = true;
} else {
// run name
ostr = dynamic_cast<TObjString*>(tokens->At(1));
str = ostr->GetString();
str = TString("");
for (Int_t i=1; i<tokens->GetEntries()-3; i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i));
str += ostr->GetString();
if (i<tokens->GetEntries()-4)
str += TString(" ");
}
param.SetRunName(str);
// beamline
ostr = dynamic_cast<TObjString*>(tokens->At(2));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-3));
str = ostr->GetString();
param.SetBeamline(str);
// institute
ostr = dynamic_cast<TObjString*>(tokens->At(3));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-2));
str = ostr->GetString();
param.SetInstitute(str);
// data file format
ostr = dynamic_cast<TObjString*>(tokens->At(4));
ostr = dynamic_cast<TObjString*>(tokens->At(tokens->GetEntries()-1));
str = ostr->GetString();
param.SetFileFormat(str);
}