diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-12 16:41:17 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-12 16:41:17 -0400 |
commit | 6f0703602270d03f4025221f13fee21aa842a863 (patch) | |
tree | 2d227fbc236e647e3d6c96113f1d6b93a4113793 /fileio/root.py | |
parent | 4b5d9c633bd01ce8b2819d92eaf3e01d881fb996 (diff) | |
download | chroma-6f0703602270d03f4025221f13fee21aa842a863.tar.gz chroma-6f0703602270d03f4025221f13fee21aa842a863.tar.bz2 chroma-6f0703602270d03f4025221f13fee21aa842a863.zip |
add chroma-sim script. get rid of GPU class; contexts should now be created with create_cuda_context().
Diffstat (limited to 'fileio/root.py')
-rw-r--r-- | fileio/root.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/fileio/root.py b/fileio/root.py index 507c249..af86deb 100644 --- a/fileio/root.py +++ b/fileio/root.py @@ -25,11 +25,11 @@ def make_photon_with_arrays(size): def root_vertex_to_python_vertex(vertex): "Returns a chroma.event.Vertex object from a root Vertex object." return event.Vertex(str(vertex.particle_name), - tvector3_to_ndarray(vertex.pos), - tvector3_to_ndarray(vertex.dir), - tvector3_to_ndarray(vertex.pol), - vertex.ke, - vertex.t0) + pos=tvector3_to_ndarray(vertex.pos), + dir=tvector3_to_ndarray(vertex.dir), + ke=vertex.ke, + t0=vertex.t0, + pol=tvector3_to_ndarray(vertex.pol)) def root_event_to_python_event(ev): '''Returns a new chroma.event.Event object created from the @@ -148,12 +148,14 @@ class RootWriter(object): "Write an event.Event object to the ROOT tree as a ROOT.Event object." self.ev.id = pyev.id - self.ev.primary_vertex.particle_name = pyev.primary_vertex.particle_name - self.ev.primary_vertex.pos.SetXYZ(*pyev.primary_vertex.pos) - self.ev.primary_vertex.dir.SetXYZ(*pyev.primary_vertex.dir) - if pyev.primary_vertex.pol is not None: - self.ev.primary_vertex.pol.SetXYZ(*pyev.primary_vertex.pol) - self.ev.primary_vertex.ke = pyev.primary_vertex.ke + if pyev.primary_vertex is not None: + self.ev.primary_vertex.particle_name = \ + pyev.primary_vertex.particle_name + self.ev.primary_vertex.pos.SetXYZ(*pyev.primary_vertex.pos) + self.ev.primary_vertex.dir.SetXYZ(*pyev.primary_vertex.dir) + if pyev.primary_vertex.pol is not None: + self.ev.primary_vertex.pol.SetXYZ(*pyev.primary_vertex.pol) + self.ev.primary_vertex.ke = pyev.primary_vertex.ke if pyev.photons_beg is not None: photons = pyev.photons_beg |