def draw_occupancies(self): c = Draw.canvas(w=2, h=.75, divide=(2, )) self.Draw.histo_2d(self.X1, self.Y1, Bins.get_pixel(), x_tit='Column Tel', y_tit='Row Tel', canvas=c.cd(1)) self.Draw.histo_2d(self.X2, self.Y2, Bins.get_pixel(), x_tit='Column DUT', y_tit='Row DUT', canvas=c.cd(2))
def draw_cluster_occupancies(self, planes=None, cut='', show=True, **dkw): self.Run.set_estimate(self.NRocs * self.Run.NEvents) n = self.get_tree_vec('n_clusters', self.Cut(cut), dtype='i') self.Run.set_estimate(sum(n)) loc = array( self.get_tree_vec([self.XVar, self.YVar], self.Cut(cut), dtype='i2')).T c = self.Draw.canvas('Cluster Maps', w=.66 * ceil(self.NRocs / 2), h=1.1, divide=(int(ceil(self.NRocs / 2)), 2), show=show) for i, pl in enumerate( (range(self.NRocs) if planes is None else planes), 1): x, y = loc[tile(insert(zeros(self.NRocs - 1, '?'), pl, True), n.size // self.NRocs).repeat(n)].T self.Draw.histo_2d(x, y, Bins.get_pixel(), canvas=c.cd(i), **prep_kw(dkw, title='Cluster Maps', x_tit='col', y_tit='row'))
def draw_occupancy(self, plane, name=None, cluster=True, tel_coods=False, cut='', **dkw): cut_string = self.Cut(cut) + TCut( '' if cluster else 'plane == {}'.format(plane)) self.Tree.SetEstimate( sum(self.get_tree_vec('n_hits_tot', cut, dtype='u1'))) x, y = self.get_tree_vec(var=self.get_hit_vars(plane, cluster, tel_coods), cut=cut_string) bins = Bins.get_native_global() if tel_coods else Bins.get_pixel() tit = f'{"Cluster" if cluster else "Hit"} Occupancy {f"ROC {plane}" if name is None else name}' return self.Draw.histo_2d( x, y, bins, **prep_kw( dkw, title=tit, x_tit='x [mm]' if tel_coods else 'Column', y_tit='y [mm]' if tel_coods else 'Row', y_off=1.2, file_name=f'{"Cluster" if cluster else "Hit"}Map{plane}'))
def draw_raw_occupancies(): c = plot.canvas('c', w=1.2, h=1.2, divide=(2, 2)) p = get_tree_vec(t, 'plane', dtype='i2') for i in range(4): t.SetEstimate(count_nonzero(p == i)) x, y = get_tree_vec(t, ['col', 'row'], cut=f'plane == {i}', dtype='i2') plot.histo_2d(x, y, Bins.get_pixel(), canvas=c.cd(i + 1))
def draw_event(self, event, show=True, grid=True): x, y, p = self.get_tree_vec(self.get_hit_vars(0, cluster=False) + ['plane'], nentries=1, firstentry=event) c = self.Draw.canvas(w=1.5, h=1.5, divide=(int(ceil(sqrt(self.NRocs))), int(ceil(sqrt(self.NRocs)))), show=show) for i in range(self.NRocs): self.Draw.histo_2d(x[p == i], y[p == i], Bins.get_pixel(), 'Hits', draw_opt='col', x_tit='col', y_tit='row', rm=.03, stats=0, show=show, canvas=c.cd(i + 1)) self.draw_pixel_grid() if grid else do_nothing()
def draw_pixel_grid(): n, x, n, y = Bins.get_pixel() Draw.grid(x, y, color=921)
def draw_occupancies(): c = plot.canvas('c', w=1.5, h=1.5, divide=(2, 2)) for i in range(z.NPlanes): x, y = z.get_tree_vec(['cluster_col[{}]'.format(i), 'cluster_row[{}]'.format(i)]) plot.histo_2d(x, y, Bins.get_pixel(), stats=0, show=0, canvas=c.cd(i + 1))