Introduced another safeguard in msr2data against the first one who tries to call her/his beamline PIE1083, the institute TRIUMF10000 or the data format NEXUS2011
This commit is contained in:
parent
21b1421cfe
commit
6aa2d61c35
@ -157,9 +157,11 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo) const
|
|||||||
strLine.str(line);
|
strLine.str(line);
|
||||||
strLine >> firstOnLine;
|
strLine >> firstOnLine;
|
||||||
if (!to_lower_copy(firstOnLine).compare("run")) {
|
if (!to_lower_copy(firstOnLine).compare("run")) {
|
||||||
string::size_type loc = line.rfind(tempRunNumber.str());
|
firstOnLine.clear();
|
||||||
if ( loc != string::npos ) {
|
strLine >> firstOnLine;
|
||||||
while ( --loc >= 0 ) {
|
string::size_type loc = firstOnLine.rfind(tempRunNumber.str());
|
||||||
|
if ( loc != string::npos ) {
|
||||||
|
while ( --loc >= 0 ) {
|
||||||
if(isdigit(line.at(loc))) {
|
if(isdigit(line.at(loc))) {
|
||||||
++fRunNumberDigits;
|
++fRunNumberDigits;
|
||||||
} else {
|
} else {
|
||||||
@ -528,16 +530,22 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun) const
|
|||||||
strLine.str(line);
|
strLine.str(line);
|
||||||
strLine >> firstOnLine;
|
strLine >> firstOnLine;
|
||||||
if (!to_lower_copy(firstOnLine).compare("run")) {
|
if (!to_lower_copy(firstOnLine).compare("run")) {
|
||||||
string::size_type loc = line.rfind(tempRunNumber.str());
|
strLine >> firstOnLine;
|
||||||
if ( loc != string::npos ) {
|
string::size_type loc = firstOnLine.rfind(tempRunNumber.str());
|
||||||
line.replace(loc, fRunNumberDigits, newRunNumber.str());
|
if ( loc != string::npos ) {
|
||||||
} else {
|
firstOnLine.replace(loc, fRunNumberDigits, newRunNumber.str());
|
||||||
cerr << endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\"";
|
} else {
|
||||||
cerr << endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)";
|
cerr << endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\"";
|
||||||
cerr << endl;
|
cerr << endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)";
|
||||||
}
|
cerr << endl;
|
||||||
|
}
|
||||||
|
out << "RUN " << firstOnLine;
|
||||||
|
while (strLine >> firstOnLine)
|
||||||
|
out << " " << firstOnLine;
|
||||||
|
out << endl;
|
||||||
|
} else {
|
||||||
|
out << line << endl;
|
||||||
}
|
}
|
||||||
out << line << endl;
|
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user