Esempio n. 1
0
     'helframe_prodcosth_lep'),
]

defcol = 'black'  # default color
yaxis = 'a.u.'  # yaxis title
lpos = 'NE'  #legend position
types = ['dtype', 'utype']  #variable is down- or up-type jet
colors = ['red', 'blue']  #plot legend colors (down is red, up is blue)
labels = ['down', 'up']  #legend variable labels

for var, xaxis, title in variables:  #variable name in histogram, xaxis title, saved title of png
    j = 0
    to_draw = []
    for i in types:
        hist = asrootpy(myfile.Get(var % i)).Clone()
        plotter.set_histo_style(hist, title=labels[j], color=colors[j])
        to_draw.append(hist)
        j = j + 1
    plotter.overlay(to_draw,
                    legend_def=LegendDefinition(position=lpos),
                    xtitle=xaxis,
                    ytitle=yaxis)
    plotter.save(title)

#delta plots
deltvars = [
    ('delta_helframe_costheta_hist', 'Helframe cos #theta*', 'blue'),
    ('delta_labframe_cosdeltaphi_hist', 'Labframe cos #Delta#varphi(l, q)',
     'cyan'),
    ('delta_labframe_deltaphi_hist', 'Labframe #Delta#varphi(l, q)', 'red'),
    ('delta_helframe_cosdelta_hist', 'Helframe cos #delta(l,q)', 'violet'),
Esempio n. 2
0
            add = ['wrongu', 'wrongd'] if tdir == 'matched' else []
            base_path = '%s/%s' % (path_dir, var)
            for ptype in types + add:
                if ptype.startswith('wrong'):
                    path = base_path % ('dtype'
                                        if ptype.endswith('d') else 'utype')
                    path = path.replace(tdir, 'wrong')
                else:
                    path = base_path % ptype
                histo = asrootpy(tfile.Get(path).ProjectionX()).Clone()
                if histo.Integral():
                    histo.Scale(1. / histo.Integral())
                else:
                    print '%s has not integral!' % path
                histo.Rebin(rbin)
                plotter.set_histo_style(histo, **styles[ptype])
                to_draw.append(histo)
            legend = LegendDefinition(position=lpos)
            plotter.overlay(to_draw,
                            legend_def=legend,
                            xtitle=xaxis,
                            ytitle='a.u.',
                            y_range='shape')
            plotter.save(var.replace('_%s', ''))


def make_view(inview, title, color):
    return views.TitleView(
        views.StyleView(inview,
                        linecolor=color,
                        drawstyle='hist',