Skip to content

Commit b49e6a4

Browse files
authored
LHEReader readline fixes (#1837)
1 parent 05b388d commit b49e6a4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SimCore/src/SimCore/LHE/LHEReader.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ std::unique_ptr<LHEEvent> LHEReader::readNextEvent() {
1616
std::string line;
1717
bool found_event_element = false;
1818
while (getline(ifs_, line)) {
19+
auto back =
20+
std::find_if_not(line.rbegin(), line.rend(), [](unsigned char c) {
21+
return std::isspace(c);
22+
}).base();
23+
line.erase(back, line.end());
1924
if (line == "<event>") {
2025
found_event_element = true;
2126
break;
@@ -33,6 +38,11 @@ std::unique_ptr<LHEEvent> LHEReader::readNextEvent() {
3338
auto next_event = std::make_unique<LHEEvent>(line);
3439

3540
while (getline(ifs_, line)) {
41+
auto back =
42+
std::find_if_not(line.rbegin(), line.rend(), [](unsigned char c) {
43+
return std::isspace(c);
44+
}).base();
45+
line.erase(back, line.end());
3646
if (line == "</event>" || line == "<mgrwt>") {
3747
// break if the event ended or in LHE 3.0 if we reach the mgrwt block
3848
break;

0 commit comments

Comments
 (0)