CHN=chn, PER=per)  ## mass 160 therefore masscat=0
 else:
     histfile = "htt_{CHN}.input_{PER}.root".format(
         CHN=chn, PER=per
     ) if options.analysis == "sm" else "htt_{CHN}.inputs-mssm-{PER}-0_{MA}_{TANB}.00.root".format(
         CHN=chn,
         PER=per,
         MA=str(int(options.mA)),
         TANB=str(int(options.tanb)))
     if chn == "mm":
         ## there is one speciality for mm, which need special input files
         histfile.replace(".root", "-svfit.root")
 if chn == "hbb":
     process_weight, process_shape_weight, process_uncertainties, process_shape_uncertainties = parse_dcard(
         "datacards/{CHN}_{CAT}_{PER}.txt".format(CHN=chn,
                                                  CAT=cat,
                                                  PER=per),
         fitresults, "ANYBIN")
     if cat == "6":
         plots = Analysis(
             options.analysis, histfile, category_mapping[chn][cat],
             process_weight, process_shape_weight,
             process_uncertainties, process_shape_uncertainties,
             "templates/{CHN}_LEP_X_template.C".format(
                 CHN=chn.upper()),
             "{CHN}_{CAT}_{PER}.C".format(CHN=chn, CAT=cat,
                                          PER=per))
     else:
         plots = Analysis(
             options.analysis, histfile, category_mapping[chn][cat],
             process_weight, process_shape_weight,
    "et" : category_mapping_classic,
    "tt" : category_mapping_tautau,
    "hbb": category_mapping_bb
    }
for chn in channels :
    for per in periods :
        for cat in categories[chn] :
            if chn == "hbb" :
                histfile = "{CHN}.input_{PER}-0.root".format(CHN=chn, PER=per) ## mass 160 therefore masscat=0
            else :
                histfile = "htt_{CHN}.input_{PER}.root".format(CHN=chn, PER=per) if options.analysis == "sm" else "htt_{CHN}.inputs-mssm-{PER}-0.root".format(CHN=chn, PER=per)
                if chn == "mm" :
                ## there is one speciality for mm, which need special input files
                    histfile.replace(".root", "-svfit.root")
            if chn == "hbb" :
                process_weight, process_shape_weight, process_uncertainties, process_shape_uncertainties = parse_dcard("datacards/{CHN}_{CAT}_{PER}.txt".format(CHN=chn, CAT=cat, PER=per), fitresults, "ANYBIN")
                if cat=="6" :
                    plots = Analysis(options.analysis, histfile, category_mapping[chn][cat],
                                 process_weight, process_shape_weight, process_uncertainties, process_shape_uncertainties,
                                 "templates/{CHN}_LEP_X_template.C".format(CHN=chn.upper()),
                                 "{CHN}_{CAT}_{PER}.C".format(CHN=chn, CAT=cat, PER=per)
                                 )
                else :
                    plots = Analysis(options.analysis, histfile, category_mapping[chn][cat],
                                 process_weight, process_shape_weight, process_uncertainties, process_shape_uncertainties,
                                 "templates/{CHN}_HAD_X_template.C".format(CHN=chn.upper()),
                                 "{CHN}_{CAT}_{PER}.C".format(CHN=chn, CAT=cat, PER=per)
                                 )
            else :
                process_weight, process_shape_weight, process_uncertainties, process_shape_uncertainties = parse_dcard("datacards/htt_{CHN}_{CAT}_{PER}.txt".format(CHN=chn, CAT=cat, PER=per), fitresults, "ANYBIN")
                print cat
示例#3
0
        level=logging.DEBUG if args.verbose else logging.WARNING)

    import ROOT
    ROOT.gROOT.SetBatch(True)

    log.info("Loading input shape file %s", args.shapes)
    shapes = ROOT.TFile(args.shapes, "UPDATE")

    for bin in args.bins:
        # We rely that the histograms are in the "<bin name>/" directory.
        log.info("Examining bin directory %s", bin)
        bin_directory = shapes.Get(bin)
        bin_directory.cd()

        log.info("Parsing postfit results and data card.")
        p_weight, p_shape_weight, p_unc, p_shape_unc = parse_dcard(
            args.card, args.fitresults, bin)

        histogram_names = set([])
        # We have to do a first pass to get the names - can't modify
        # keys while iterating over them.
        for key in bin_directory.GetListOfKeys():
            name = key.GetName()
            histo = bin_directory.Get(name)
            if isinstance(histo, ROOT.TH1):
                histogram_names.add(name)

        for name in histogram_names:
            histo = bin_directory.Get(name)
            #log.debug("Found histogram: %s", name)
            # Start the errors from scratch
            reset_bin_errors(histo)