Exemple #1
0
def capture(w, modelConfig, dataset, cl, method, globals):
    out = {}
    if method == "pl":
        pl_plot_name = "pl_%(m0)d_%(m1/2)d" % globals
        out["limit"] = plInterval(w, modelConfig, dataset, cl)
        print out["limit"]
        for syst in utils.getAllSystematics():
            try: out["%s" % syst] = w.var("nu%s" % syst).getVal()
            except ReferenceError: out["%s" % syst] = -1
    elif method == "clsviatoys":
        out["limit"] = cls(w, modelConfig, dataset,  cl, cfg.clsToys)

    return out
Exemple #2
0
def extractHists(d):
    out = {}
    lumiString = "%d/pb;m_{0};m_{1/2}" % Muon.lumi
    hist_opts = (int(max_m0)/10, 0, max_m0, int(max_m12)/10, 0, max_m12)
    auto = AutoHist()

    for idx, p in enumerate(d["results"]):
        (x, y) = int(p["channels"][0]["m0"])/10, int(p["channels"][0]["m1/2"])/10
        auto.setcontent("hCrossSectionLO", "Cross Section (LO)", hist_opts, (x, y, p["channels"][0]["loxs"]), log=True)
        if "nloxs" in p["channels"][0]:
            auto.setcontent("hCrossSectionNLO", "Cross Section (NLO)", hist_opts, (x, y, p["channels"][0]["nloxs"]))
        for k in ["pl", "clsviatoys"]:
            if k in p["results"]:
                (x, y) = int(p["channels"][0]["m0"])/10, int(p["channels"][0]["m1/2"])/10
                if k == "pl":
                    ul = p["results"]["pl"]["limit"]["high"]
                    excluded = (ul <= 1.0)
                elif k == "clsviatoys":
                    ul = p["results"]["clsviatoys"]["limit"]["CLs"]
                    excluded = p["results"]["clsviatoys"]["limit"]["CLs"] < 0.05
                auto.setcontent("hLimit_%s" % k, "Limit %s" % lumiString, hist_opts, (x, y, ul))
                for syst in utils.getAllSystematics():
                    if syst in p["results"][k]:
                        auto.setcontent("nu%s" % syst, "Nuisance %s" % syst, hist_opts,
                                        (x, y, p["results"]["pl"][syst]))
                print ul
                if excluded:
                    auto.setcontent("hExcluded_%s" % k, "Excluded %s" % lumiString,
                                    hist_opts, (x, y, 1))

        if "quantiles" in p["results"]:
            quantiles = p["results"]["quantiles"]
            exlude_fn = lambda x : x < 1.0
        elif "clsviatoys" in p["results"]:
            quantiles = dict([(k, v) for k, v in p["results"]["clsviatoys"]["limit"].iteritems() if "Median" in k])
            exclude_fn = lambda x : x < 0.05
        else:
            quantiles = None
            continue
        for k, v in quantiles.iteritems():
            name = "quantile_%s_limit" % k
            auto.setcontent(name, name, hist_opts, (x, y, v))
            name = "quantile_%s_excluded" % k
            if exclude_fn(v):
                auto.setcontent(name, name, hist_opts, (x, y, 1))
    return auto