2 Python module (Python3)
4 This module provides classes and functions for scoring reactions
8 [f] read_next_vertex(stream):
18 __all__ = [
'MCParticle',
'MCVertex',
'read_next_vertex' ]
30 def __init__(self, aname, aZ, aA, akE, apx, apy, apz):
40 print(
"--- particle: %s, Z=%2d, A=%2d, kE=%g" % \
56 self.particle_list.append(aparticle)
60 print(
"@@@ vertex: x=(%g,%g,%g) Nsec=%3d" % \
66 aline =
"%g %g %g %d\n" % \
70 aline =
" %s %d %d %g %g %g %g\n" % \
71 (p.name, p.Z, p.A, p.kineticE/MeV, p.px/MeV, p.py/MeV, p.pz/MeV)
83 "read next vertex from a file stream"
84 line= stream.readline()
90 x = string.atof(data[0]) * m
91 y = string.atof(data[1]) * m
92 z = string.atof(data[2]) * m
93 nsec = string.atoi(data[3])
98 for p
in range(0, nsec):
99 data = stream.readline().
split()
101 Z = string.atoi(data[1])
102 A = string.atoi(data[2])
103 kE = string.atof(data[3]) * MeV
104 px = string.atof(data[4]) * MeV
105 py = string.atof(data[5]) * MeV
106 pz = string.atof(data[6]) * MeV
108 particle =
MCParticle(pname, Z, A, kE, px, py, pz)
109 vertex.append_particle(particle)
118 f =
open(
"reaction.dat")
134 if __name__ ==
"__main__":