diff options
| author | Stan Seibert <stan@mtrr.org> | 2011-10-05 17:25:09 -0400 | 
|---|---|---|
| committer | Stan Seibert <stan@mtrr.org> | 2011-10-05 17:25:09 -0400 | 
| commit | c309d251232c45bb497da4859eb8cf1b2ab47417 (patch) | |
| tree | c6138060b863bddb5e46363e2d9363e96d775833 | |
| parent | 6f0670961025052ccff42f3ba6c0cdbca0a546e5 (diff) | |
| download | chroma-c309d251232c45bb497da4859eb8cf1b2ab47417.tar.gz chroma-c309d251232c45bb497da4859eb8cf1b2ab47417.tar.bz2 chroma-c309d251232c45bb497da4859eb8cf1b2ab47417.zip | |
Fix floating point exception generated in PyROOT when dealing with no hit channels.
| -rw-r--r-- | chroma/io/root.py | 8 | 
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() | 
