From 07f702167eba4597ea52088edd2b62d19c7eda7f Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 4 Feb 2008 13:46:45 +0000 Subject: [PATCH] some minor changes to improve the robustness for various msr-file dialects --- src/classes/PFunctionHandler.cpp | 2 +- src/classes/PMsrHandler.cpp | 12 ++++++------ src/classes/PRunDataHandler.cpp | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/classes/PFunctionHandler.cpp b/src/classes/PFunctionHandler.cpp index 18163474..529518a3 100644 --- a/src/classes/PFunctionHandler.cpp +++ b/src/classes/PFunctionHandler.cpp @@ -92,7 +92,7 @@ cout << endl << "fLines[" << i << "] = '" << fLines[i].fLine.Data() << "'"; tree_parse_info<> info = ast_parse(line.Data(), function, space_p); if (info.full) { - cout << endl << "parse successfull ..." << endl; + cout << endl << "parse successful ..." << endl; PFunction func(info); fFuncs.push_back(func); } else { diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 069cf6bb..fd758c8e 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -736,7 +736,7 @@ bool PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) iter = lines.begin(); while ((iter != lines.end()) && !error) { - tokens = iter->fLine.Tokenize(" "); + tokens = iter->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo; cout << endl << endl; @@ -965,7 +965,7 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines) iter->fLine.ToLower(); // tokenize line - tokens = iter->fLine.Tokenize(" "); + tokens = iter->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize Parameters in line " << iter->fLineNo; cout << endl << endl; @@ -1537,7 +1537,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines) while ((iter1 != iter2) && !error) { if (iter1->fLine.Contains("PLOT")) { // handle plot header - tokens = iter1->fLine.Tokenize(" "); + tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << endl; @@ -1569,7 +1569,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines) case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13 case MSR_PLOT_ASYM: case MSR_PLOT_NO_MUSR: - tokens = iter1->fLine.Tokenize(" "); + tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << endl; @@ -1596,7 +1596,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines) } break; case MSR_PLOT_ASYM_RRF: // like: runs 1,1 1,2 - tokens = iter1->fLine.Tokenize(" "); + tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << endl; @@ -1642,7 +1642,7 @@ bool PMsrHandler::HandlePlotEntry(PMsrLines &lines) } if (iter1->fLine.Contains("range")) { // handle plot range - tokens = iter1->fLine.Tokenize(" "); + tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { cout << endl << "SEVERE ERROR: Couldn't tokenize PLOT in line " << iter1->fLineNo; cout << endl << endl; diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index 54a0a4b2..f90fa9b5 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -443,7 +443,7 @@ bool PRunDataHandler::ReadNemuFile() // read header bool headerInfo = true; - char instr[128]; + char instr[512]; TString line; double dval; int ival; @@ -551,9 +551,11 @@ cout << endl << ">> time resolution : " << runData.fTimeResolution; histoData.push_back(val[i]); } - // save the last histo - runData.fDataBin.push_back(histoData); - histoData.clear(); + // save the last histo if not empty + if (histoData.size() > 0) { + runData.fDataBin.push_back(histoData); + histoData.clear(); + } // close file f.close();