Definition at line 98 of file LHETools.py.
◆ __init__()
def LHETools.Event.__init__ |
( |
|
self, |
|
|
|
info, |
|
|
|
particles, |
|
|
|
extra_lines = None , |
|
|
|
spurious_event_markup = False |
|
) |
| |
Definition at line 99 of file LHETools.py.
99 def __init__(self, info, particles, extra_lines=None, spurious_event_markup=False):
101 self.particles = particles
102 self.extra_lines = extra_lines
or []
103 self.spurious_event_markup = spurious_event_markup
105 for p
in self.particles:
◆ __delitem__()
def LHETools.Event.__delitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Definition at line 168 of file LHETools.py.
168 def __delitem__(self, index):
169 if not isinstance(index, (int)):
170 LHEToolsLog.error(
"Index must be integer")
194 mo0, mo1 = p_rm.mother0, p_rm.mother1
195 for p
in self.particles:
199 if p.mother0 == i_lhe
or p.mother1 == i_lhe:
200 if p.mother0 != p.mother1:
201 LHEToolsLog.error(
"Can not delete particle whose child has also other parents")
208 del self.particles[index]
210 for p
in self.particles:
211 if p.mother0 > i_lhe:
213 if p.mother1 > i_lhe:
217 self.info.nparticles -= 1
◆ __getitem__()
def LHETools.Event.__getitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Definition at line 161 of file LHETools.py.
162 if not isinstance(index, (int)):
163 LHEToolsLog.error(
"Index must be integer")
166 return self.particles[index]
◆ __len__()
def LHETools.Event.__len__ |
( |
|
self | ) |
|
Definition at line 158 of file LHETools.py.
159 return len(self.particles)
◆ from_lines()
def LHETools.Event.from_lines |
( |
|
cls, |
|
|
|
lines |
|
) |
| |
Definition at line 109 of file LHETools.py.
109 def from_lines(cls, lines):
113 spurious_event_markup =
False
114 event_markup = re.compile(
'<event>')
116 for i, datum
in enumerate(lines):
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
124 info = EventInfo.from_string(datum)
126 LHEToolsLog.warning(
"Could not retrieve EventInfo from input lhe file")
130 if 1 <= i <= info.nparticles:
131 p = Particle.from_string(datum)
133 LHEToolsLog.warning(
"Could not retrieve Particle from input lhe file")
139 extra_lines.append(datum)
141 return cls(info=info,
143 extra_lines=extra_lines,
144 spurious_event_markup=spurious_event_markup)
◆ is_buggy()
def LHETools.Event.is_buggy |
( |
|
self | ) |
|
Definition at line 146 of file LHETools.py.
147 return self.info.invalid
or self.spurious_event_markup
or any(part.invalid
for part
in self.particles)
◆ to_string()
def LHETools.Event.to_string |
( |
|
self | ) |
|
Definition at line 150 of file LHETools.py.
152 for p
in self.particles:
153 lines.append(p.to_string() +
'\n')
154 lines.extend(self.extra_lines)
156 return ''.
join(lines)
◆ extra_lines
LHETools.Event.extra_lines |
◆ info
◆ particles
◆ spurious_event_markup
LHETools.Event.spurious_event_markup |
The documentation for this class was generated from the following file: