diff options
Diffstat (limited to 'camera.py')
-rwxr-xr-x | camera.py | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -427,20 +427,25 @@ class EventViewer(Camera): self.f = ROOT.TFile(filename) self.T = self.f.Get('T') self.T.GetEntry(0) + self.nsolids = geometry.solid_id.max() + 1 def color_hit_pmts(self): self.gpu.reset_colors() - solid_ids = np.empty(len(self.T.ev.channel), np.uint32) - t = np.empty(len(self.T.ev.channel), np.float32) - q = np.empty(len(self.T.ev.channel), np.float32) + hit = np.empty(self.nsolids, np.int32) + t = np.empty(self.nsolids, np.float32) + q = np.empty(self.nsolids, np.float32) - for i, channel in enumerate(self.T.ev.channel): - solid_ids[i] = channel.channel_id - t[i] = channel.t - q[i] = channel.q + # self.nsolids has a weird data type that PyROOT doesn't understand + self.T.ev.get_channels(int(self.nsolids), hit, t, q) - self.gpu.color_solids(solid_ids, map_to_color(t, range=(t.min(),t.mean()))) + # PyROOT prints warnings when we try to pass a bool array directly + # so we convert afterward + hit = hit.astype(np.bool) + + # Important: Compute range only with HIT channels + solid_colors = map_to_color(t, range=(t[hit].min(),t[hit].mean())) + self.gpu.color_solids(hit, solid_colors) self.update() def process_event(self, event): |