109 def from_lines(cls, lines):
110 info = None
111 particles = []
112 extra_lines = []
113 spurious_event_markup = False
114 event_markup = re.compile('<event>')
115
116 for i, datum in enumerate(lines):
117
118 if event_markup.match(datum):
119 LHEToolsLog.warning("Spurious <event> markup was found in the middle of an event record. Probably the result of one event being incompletely written.")
120 spurious_event_markup = True
121
122
123 if not info:
124 info = EventInfo.from_string(datum)
125 if info.invalid:
126 LHEToolsLog.warning("Could not retrieve EventInfo from input lhe file")
127 continue
128
129
130 if 1 <= i <= info.nparticles:
131 p = Particle.from_string(datum)
132 if p.invalid:
133 LHEToolsLog.warning("Could not retrieve Particle from input lhe file")
134 particles.append(p)
135 continue
136
137
138
139 extra_lines.append(datum)
140
141 return cls(info=info,
142 particles=particles,
143 extra_lines=extra_lines,
144 spurious_event_markup=spurious_event_markup)
145