ignore leading empty lines in nemu files
This commit is contained in:
@ -478,9 +478,17 @@ bool PRunDataHandler::ReadNemuFile()
|
|||||||
bool ok;
|
bool ok;
|
||||||
int groups = 0, channels = 0;
|
int groups = 0, channels = 0;
|
||||||
|
|
||||||
Ssiz_t idx;
|
// skip leading empty lines
|
||||||
do {
|
do {
|
||||||
f.getline(instr, sizeof(instr));
|
f.getline(instr, sizeof(instr));
|
||||||
|
line = TString(instr);
|
||||||
|
if (!line.IsWhitespace())
|
||||||
|
break;
|
||||||
|
} while (!f.eof());
|
||||||
|
|
||||||
|
// real header data should start here
|
||||||
|
Ssiz_t idx;
|
||||||
|
do {
|
||||||
line = TString(instr);
|
line = TString(instr);
|
||||||
if (line.IsWhitespace()) { // end of header reached
|
if (line.IsWhitespace()) { // end of header reached
|
||||||
headerInfo = false;
|
headerInfo = false;
|
||||||
@ -532,7 +540,8 @@ bool PRunDataHandler::ReadNemuFile()
|
|||||||
runData.fTimeResolution = dval * 1000.0;
|
runData.fTimeResolution = dval * 1000.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (headerInfo);
|
f.getline(instr, sizeof(instr));
|
||||||
|
} while (headerInfo && !f.eof());
|
||||||
|
|
||||||
if ((groups == 0) || (channels == 0) || isnan(runData.fTimeResolution)) {
|
if ((groups == 0) || (channels == 0) || isnan(runData.fTimeResolution)) {
|
||||||
cout << endl << "PRunDataHandler::ReadNemuFile(): essential header informations are missing!";
|
cout << endl << "PRunDataHandler::ReadNemuFile(): essential header informations are missing!";
|
||||||
@ -554,7 +563,6 @@ cout << endl << ">> time resolution : " << runData.fTimeResolution;
|
|||||||
unsigned int group_counter = 0;
|
unsigned int group_counter = 0;
|
||||||
int val[10];
|
int val[10];
|
||||||
while (!f.eof()) {
|
while (!f.eof()) {
|
||||||
f.getline(instr, sizeof(instr));
|
|
||||||
// check if empty line, i.e. new group
|
// check if empty line, i.e. new group
|
||||||
if (IsWhitespace(instr)) {
|
if (IsWhitespace(instr)) {
|
||||||
runData.fDataBin.push_back(histoData);
|
runData.fDataBin.push_back(histoData);
|
||||||
@ -577,6 +585,8 @@ cout << endl << ">> time resolution : " << runData.fTimeResolution;
|
|||||||
// feed data
|
// feed data
|
||||||
for (int i=0; i<status; i++)
|
for (int i=0; i<status; i++)
|
||||||
histoData.push_back(val[i]);
|
histoData.push_back(val[i]);
|
||||||
|
|
||||||
|
f.getline(instr, sizeof(instr));
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the last histo if not empty
|
// save the last histo if not empty
|
||||||
|
Reference in New Issue
Block a user