summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chroma/io/root.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/chroma/io/root.py b/chroma/io/root.py
index b74a887..b135df9 100644
--- a/chroma/io/root.py
+++ b/chroma/io/root.py
@@ -208,7 +208,13 @@ class RootWriter(object):
self.ev.vertices[i].t0 = vertex.t0
if pyev.channels is not None:
- ROOT.fill_channels(self.ev, np.count_nonzero(pyev.channels.hit), np.arange(len(pyev.channels.t))[pyev.channels.hit].astype(np.int32), pyev.channels.t, pyev.channels.q, pyev.channels.flags, len(pyev.channels.hit))
+ nhit = np.count_nonzero(pyev.channels.hit)
+ if nhit > 0:
+ ROOT.fill_channels(self.ev, nhit, np.arange(len(pyev.channels.t))[pyev.channels.hit].astype(np.int32), pyev.channels.t, pyev.channels.q, pyev.channels.flags, len(pyev.channels.hit))
+ else:
+ self.ev.nhit = 0
+ self.ev.channels.resize(0)
+ self.ev.nchannels = len(pyev.channels.hit)
self.T.Fill()