diff options
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 |