Ejemplo n.º 1
0
            subpath = ""
            if "dir" in plot_def.keys():
                subpath = plot_def["dir"]

            #Set the plot metadata
            comments = ""
            comments = " chi2=%.2f" % htot_data.Chi2Test(htot_mc, "UW CHI2/NDF")
            if "fitpars" in plot_def.keys():
                comments += " fitpars=" + str(plot_def["fitpars"])
            pinfo = PlotMetaInfo(
                plotname + "_" + _lepton_channel,
                plot_def[lepton_channel + "cut"],
                str(weight),
                flist,
                subpath,
                comments
            )

            output_folder.savePlot(canv, pinfo)
            save_yield_table(merged_hists, htot_data, output_folder.get("yields/%s" % _lepton_channel), plotname)

            canv.Close() #Need to Close to prevent hang from ROOT because of multiple TPads etc
            del canv

            nplot += 1
            if pbar: pbar.update(nplot)

    if pbar: pbar.finish()

Ejemplo n.º 2
0
    #leg = legend(hi, styles=['p', 'f'], legend_pos='bottom-right', nudge_x=-0.29, nudge_y=-0.08)
    leg = legend(hi, styles=['p', 'f'], legend_pos='top-left', nudge_y=-0.14)
    lb = lumi_textbox(lumi,
        pos='top-center',
        line2="#scale[1.5]{A = %.2f #pm %.2f (stat.) #pm %.2f (syst.)}" % (
            measured_asym, measured_asym_errs[lep][0],  measured_asym_errs[lep][1]
        ), nudge_y=0.03
    )
    pmi = PlotMetaInfo(
        'costheta_unfolded',
        '2j1t_mva_loose {0}'.format(channel),
        'weighted to lumi={0}, sf(tchan)={1}'.format(lumi, fitpars[lep]),
        [args.infileMC, args.infileD]
    )

    of.savePlot(canv, pmi)

    ######################
    # Plot the asymmetry #
    ######################
    hi = [pe_asym]
    Styling.mc_style(pe_asym, 'T_t')
    #Styling.data_style(data_asym)
    pe_asym.SetTitle("exp. asymmetry")

    # from plots.common.histogram import norm
    # norm(pe_asym)
    # norm(data_asym)

    #data_asym.SetMarkerSize(1)