Exemplo n.º 1
0
    )
    parser.add_argument(
        '-ai', '--anti_iso', required=False, action='store_true', dest='use_antiiso',
        help='Change region to anti-isolated region'
    )

    args = parser.parse_args()

    #Do both channels by default
    if not args.channels:
        args.channels = ["mu", "ele"]

    output_folder = OutputFolder(
        os.path.join(os.environ["STPOL_DIR"],"out", "plots"),
        subpath="make_all_plots",
        overwrite=False,
        unique_subdir=args.new,
        skip_png=args.cluster
    )
    logger.info("Output folder is %s" % output_folder.out_folder)

    #FIXME: factorize
    #Check if any of the provided hashtags matches any of the (optional) hashtags of the plot defs
    args.plots += [k for (k, v) in plot_defs.items() if 'tags' in v.keys() and len(set(args.tags).intersection(set(v['tags'])))>0]
    #Remove plots with disabled tags
    disabled_tags = map(lambda x: x[1:], filter(lambda x: x.startswith("."), args.tags))
    for n, plotname in plot_defs.items():
        if 'tags' in plotname.keys() and len(set(disabled_tags).intersection(set(plotname['tags'])))>0:
            args.plots = filter(lambda x: x!=n, args.plots)

    #If there are no plots defined, do all of them
Exemplo n.º 2
0
    hcomphep.SetLineColor(ROOT.kRed)
    hcomphep.SetFillColor(ROOT.kRed)
    hcomphep.SetFillStyle('/')
    hcomphep.SetLineStyle('dashed')
    hcomphep.SetMarkerSize(0)

    Styling.data_style(data_post)

    hi = [data_post, htrue, hcomphep]
    chi2 = data_post.Chi2Test(htrue, "WW CHI2/NDF")
    #htrue.SetTitle(htrue.GetTitle() + " #chi^{2}/#nu = %.1f" % chi2)
    #hi_norm = hi
    hi_norm = map(post_normalize, hi)
    for h in hi[1:]:
        h.SetMarkerSize(0)
    of = OutputFolder(subdir='unfolding/%s' % lep)
    canv = plot_hists(hi_norm, x_label="cos #theta*", draw_cmd=len(hi)*["E1"], y_label="a.u.")
    #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]
    )