def plot_hits_per_event(tree, label, printer): """ Call hist_hits_per_event and make plots from the results. <label> is a short filesystem-compatible string describing the tree. <printer> is some callable taking one argument, <name> which is a short, filesystem-compatible string describing the currently drawn canvas. The canvas must be available as a <.canvas> attribute. Return a flat list of filenames printed to file. """ printed = [] h_ds, h_us, h_dsus = hist_hits_per_event(tree, label) h_ds.SetLineColor(2) h_us.SetLineColor(4) printer.canvas.SetLogy(True) h_ds.Draw() printed += printer("downstream") h_us.Draw() printed += printer("upstream") ustat = move_stats(h_us) ustat.SetLineColor(4) dstat = move_stats(h_ds, y=-0.25) dstat.SetLineColor(2) h_ds.Draw() h_us.Draw("same") ustat.Draw("same") dstat.Draw("same") printed += printer("dsandus") printer.canvas.SetLogy(False) h_dsus.Draw("COLZ") printed += printer("dsvus") return printed