Fixes for new LHE parsing
@@ -534,7 +534,6 @@ def _parse_events_text(filename, sampling_benchmark):
do_tag = False
do_momenta = False
do_reweight = False
- do_wait_for_reweight = False
# Event
n_events = 0
@@ -543,6 +542,16 @@ def _parse_events_text(filename, sampling_benchmark):
with open(filename, "r") as file:
for line in file.readlines():
+ if reset_event:
+ # Initialize weights and momenta
+ weights = OrderedDict()
+ particles = []
+
+ # Some tags so that we know where in the event we are
+ do_tag = True
+ do_momenta = False
+ do_reweight = False
+
# Clean up line
try:
line = line.split("#")[0]
@@ -561,15 +570,7 @@ def _parse_events_text(filename, sampling_benchmark):
# Beginning of event
elif line == "<event>":
- # Initialize weights and momenta
- weights = OrderedDict()
- particles = []
-
- # Some tags so that we know where in the event we are
- do_tag = True
- do_momenta = False
- do_reweight = False
- do_wait_for_reweight = False
+ reset_event = True
# End of event
elif line == "</event>":
@@ -578,6 +579,7 @@ def _parse_events_text(filename, sampling_benchmark):
logger.debug("%s events parsed", n_events)
yield particles, weights
+ reset_event = True
# Beginning of unimportant block
elif line == "<mgrwt>":
