コード例 #1
0
ファイル: an_plots.py プロジェクト: HEP-KBFI/stpol
 def plot(varname, cutname, **kwargs):
     for channel in ["mu", "ele"]:
         _kwargs = copy.deepcopy(kwargs)
         do_save_yields = _kwargs.pop("save_yields", False)
         lb_comments = _kwargs.pop("lb_comments", "")
         lb_comments = lb_comments.format(bdt_cut=Cuts.mva_wps['bdt'][channel]['loose'])
         save_name = _kwargs.pop("save_name", outdir + '/{cutname}_{varname}.pdf')
         
         #Inconsistency between code and AN/PAS
         channel_an = channel
         if channel=="ele":
             channel_an = "el"
         
         save_name = save_name.format(channel=channel_an, varname=varname, cutname=cutname)
         _kwargs["save_name"] = save_name
         h = pd(varname, cutname, channel,
             lb_comments = lb_comments,
             #rebin=rbf(varname), legend_pos=lgp(varname), lb_comments=lb_comments(cutname, channel),
             #subdir_AN=subdir, cutname_AN=cutname_AN,
             **_kwargs
         )
         canv, hists = data_mc_plot(h)
         save_canv(canv, h.save_name)
         canv.Close()
         if do_save_yields:
             save_yields(
                 hists,
                 "results/yields/{0}_{1}.txt".format(cutname, channel),
                 {"tchan": h.process_scale_factor[0][1:],
                 "top": h.process_scale_factor[1][1:],
                 "qcd": h.process_scale_factor[2][1:],
                 "wzjets": h.process_scale_factor[3][1:]}
             )
コード例 #2
0
ファイル: an_plots.py プロジェクト: HEP-KBFI/stpol
            def plot(varname, **kwargs):
                h = pd(
                    varname,
                    cutname,
                    channel,
                    rebin=rbf(varname),
                    legend_pos=lgp(varname),
                    lb_comments=lb_comments(cutname, channel),
                    subdir_AN=subdir,
                    cutname_AN=cutname_AN,
                    **kwargs
                )
                if "baseline" in cutname and "eta_lj" in varname:

                    def _new_minmax():
                        return (-0.2, 0.2)

                    h.get_ratio_minmax = _new_minmax
                canv, hists = data_mc_plot(h)
                save_canv(canv, h.save_name)
                canv.Close()

                if varname == "cos_theta" and ("cutbased_final" in cutname or "mva_loose" in cutname):
                    save_yields(hists, "out/yields/%s_%s.txt" % (cutname, channel))