Classes | Functions | Variables
mcscore Namespace Reference

Classes

class  MCParticle
 
class  MCVertex
 

Functions

def read_next_vertex (stream)
 
def test ()
 

Variables

list __all__ = [ 'MCParticle', 'MCVertex', 'read_next_vertex' ]
 

Detailed Description

Python module

This module provides classes and functions for scoring reactions

  [C] MCVertex:
  [C] MCParticle:
  [f] read_next_vertex(stream):

                                          Q, 2006
Python module (Python3)

This module provides classes and functions for scoring reactions

  [C] MCVertex:
  [C] MCParticle:
  [f] read_next_vertex(stream):

                                          Q, 2006

Function Documentation

def mcscore.read_next_vertex (   stream)

Definition at line 82 of file mcscore.py.

References PandAna.Demos.demo1.range, and split().

Referenced by mcscore.MCVertex.__del__(), and test().

82 def read_next_vertex(stream):
83  "read next vertex from a file stream"
84  line= stream.readline()
85  if line == "": # EOF
86  return 0
87 
88  # reading vertex
89  data = line.split()
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])
94 
95  vertex = MCVertex(x,y,z)
96 
97  # reading particles
98  for p in range(0, nsec):
99  data = stream.readline().split()
100  pname = data[0]
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
107 
108  particle = MCParticle(pname, Z, A, kE, px, py, pz)
109  vertex.append_particle(particle)
110 
111  return vertex
112 
113 
114 # ==================================================================
115 # test
116 # ==================================================================
void split(double tt, double *fr)
def read_next_vertex(stream)
Definition: mcscore.py:82
def mcscore.test ( )

Definition at line 117 of file mcscore.py.

References open(), read_next_vertex(), and while().

Referenced by mcscore.MCVertex.__del__().

117 def test():
118  f = open("reaction.dat")
119  f.seek(0)
120 
121  while(1):
122  vertex = read_next_vertex(f)
123  if vertex == 0:
124  break
125  vertex.printout()
126  del vertex
127  f.close()
128  print ">>> EOF"
129 
130 
131 # ==================================================================
132 # main
133 # ==================================================================
def read_next_vertex(stream)
Definition: mcscore.py:82
procfile open("FD_BRL_v0.txt")
def test()
Definition: mcscore.py:117
while(!feof(fp))

Variable Documentation

list mcscore.__all__ = [ 'MCParticle', 'MCVertex', 'read_next_vertex' ]
private

Definition at line 18 of file mcscore.py.