22 Factory class for line by line reads of OPAL output files
24 def __init__(self, pid, probes, ignore_probes, filehandle):
25 super(LineFactoryBase.__init__(self))
26 if pid
not in Common.pdg_pid_to_mass
or \
27 pid
not in Common.pdg_pid_to_charge:
38 Read a new hit from filehandle
39 - filehandle = file handle object
40 Returns a new hit object
42 Raises an EOFError if end of file is hit
47 line = self.filehandle.next()
49 raise EOFError(
"End of file reached")
52 raise BadEventError(
"Failed to parse event")
53 if not len(words) == 10:
54 raise BadEventError(
"Failed to parse event")
55 if words[0]
not in probes.keys():
56 probes[words[0]] = len(probes.keys())
57 hit_dict = dict( (key, float(words[i+1]) )
for i, key
in enumerate([
'x',
'y',
'z',
'px',
'py',
'pz',
'event_number',
'station',
't']))
59 hit_dict[
'mass'] = Common.pdg_pid_to_mass[abs(pid)]
60 hit_dict[
'charge'] = Common.pdg_pid_to_charge[pid]
61 hit_dict[
'station'] = probes[words[0]]+len(probes)*(int(words[8])-1)
62 for item
in [
'px',
'py',
'pz']:
63 hit_dict[item] *= hit_dict[
'mass']
64 hit = Hit.new_from_dict(hit_dict)
65 hit.mass_shell_condition(
'energy')
The hit factory module defines a number of factory classes used for generating hit objects...
def make_hit
Read a new hit from filehandle.
Factory class for line by line reads of OPAL output files.