示例#1
0
    # histogram order: signal, background (repeat for diff transforms)
    distributions = get_hists(transforms, rfileconf, pathtool, robj_t=ROOT.TH1)

    ROOT.gStyle.SetHatchesLineWidth(1)
    ROOT.gStyle.SetHatchesSpacing(2.5)
    for transform in transforms:
        def _style(l):
            # l.reverse()
            l[0].SetFillStyle(3345)
            l[1].SetFillStyle(3354)
        distributions[transform] = arrange(distributions[transform], 2,
                                           predicate=_style)

    plotter = Rplot(3, 3, 2000, 1200)
    plotter.alpha = 0.2
    canvas = plotter.prep_canvas()
    if options.doprint:
        canvas.Print('{}_transforms.pdf['.format(prefix))

    def _plot_n_print(hlist, plotter=plotter, canvas=canvas):
        plotter.draw_hist(hlist, 'hist')
        canvas.Update()
        if options.doprint:
            canvas.Print('{}_transforms.pdf'.format(prefix))

    for transform in transforms:
        if len(distributions[transform]) > plotter.nplots:
            for hists in partition(distributions[transform], plotter.nplots):
                _plot_n_print(hists)
        else:
            _plot_n_print(distributions[transform])
示例#2
0
distribs = get_hists(classifiers, rfileconf, rpath_tool,
                     robj_t = ROOT.TH1, robj_p = _filter2('', '_Train'))
if rarity:
    rarity = get_hists(classifiers, rfileconf, rpath_tool,
                       robj_t = ROOT.TH1, robj_p = _filter1('_Rarity'))
if probab:
    probab = get_hists(classifiers, rfileconf, rpath_tool,
                       robj_t = ROOT.TH1, robj_p = _filter1('_Proba'))

plotter = Rplot(1, 1, 800, 600)
plotter.alpha = 0.2
plotter.fill_colours = (ROOT.kAzure,   ROOT.kRed,   ROOT.kAzure,   ROOT.kRed)
plotter.line_colours = (ROOT.kAzure-6, ROOT.kRed+2, ROOT.kAzure-6, ROOT.kRed+2)
plotter.markers = (ROOT.kPlus, ROOT.kPlus, ROOT.kPlus, ROOT.kPlus)
canvas = plotter.prep_canvas()
if doprint: canvas.Print('overtraining.pdf[')

ROOT.gStyle.SetHatchesLineWidth(1)
ROOT.gStyle.SetHatchesSpacing(1)
def _style(l):
    l[0].SetFillStyle(3345)
    l[1].SetFillStyle(3354)

def _plot(plots, opts):
    plotter.draw_hist(plots, opts)
    canvas.Update()
    if doprint: canvas.Print('overtraining.pdf')

for classifier in classifiers:
    # TODO: KS test b/w train & test
示例#3
0
    hist_m5: (blabel, ylabel),
    hist_m6: (blabel, ylabel),
}

from rplot.tselect import Tselect
selector = Tselect(tree)
selector.exprs = [
    ('lab0_MM>>hist_m4', '5310<lab0_MM && lab0_MM<5430'),
    ('lab0_MM>>hist_m5', 'sw*(5310<lab0_MM && lab0_MM<5430)'),
    ('lab0_MM>>hist_m6', '(sw-0.113)*(5310<lab0_MM && lab0_MM<5430)'),
]
hists = selector.fill_hists()
map(
    lambda h:
    (h.GetXaxis().SetTitle(titles[h][0]), h.GetYaxis().SetTitle(titles[h][1])),
    hists)

from rplot.rplot import Rplot
plotter = Rplot(1, 1, 800, 500)

legend = ROOT.TLegend(0.65, 0.5, 0.9, 0.9)
legend.SetFillStyle(0)
legend.SetLineWidth(0)
plotter.add_legend(legend, 'lep')

canvas = plotter.prep_canvas()
canvas.Print('sw-B-mass.pdf[')
plotter.draw_hist([hists], 'e1')
canvas.Print('sw-B-mass.pdf')
canvas.Print('sw-B-mass.pdf]')