def mc_amount(cut, weight, lumi=12210, ref=None): histsD = dict() for samp in samples: histsD[samp.name] = samp.drawHistogram("mu_pt", str(cut), dtype="float", weight=weight, plot_range=[100, 0, 100000000]) for name, hist in histsD.items(): hist.normalize_lumi(lumi) for name, hist in histsD.items(): histsD[name] = hist.hist merge_cmd = dict() merge_cmd["t-channel incl"] = ["T_t", "Tbar_t"] merge_cmd["t-channel excl"] = ["T_t_ToLeptons", "Tbar_t_ToLeptons"] merge_cmd["t#bar{t} excl"] = ["TTJets_FullLept", "TTJets_SemiLept"] merge_cmd["QCD (MC)"] = ["QCDMu"] merge_cmd["t#bar{t} incl"] = ["TTJets_MassiveBinDECAY"] merge_cmd["WJets incl"] = ["WJets_inclusive"] merge_cmd["WJets excl"] = [ "W1Jets_exclusive", "W2Jets_exclusive", "W3Jets_exclusive", "W4Jets_exclusive" ] merged_hists = merge_hists(histsD, merge_cmd) normd = dict() for hn, h in merged_hists.items(): normd[hn] = get_hist_int_err(h) return merged_hists, normd
def mc_amount(cut, weight, lumi=12210, ref=None): histsD = dict() for samp in samples: histsD[samp.name] = samp.drawHistogram("mu_pt", str(cut), dtype="float", weight=weight, plot_range=[100, 0, 100000000]) histsD[samp.name].Scale(samp.lumiScaleFactor(lumi)) merge_cmd = dict() merge_cmd["t-channel incl"] = ["T_t", "Tbar_t"] merge_cmd["t-channel excl"] = ["T_t_ToLeptons", "Tbar_t_ToLeptons"] merge_cmd["t#bar{t} excl"] = ["TTJets_FullLept", "TTJets_SemiLept"] merge_cmd["QCD (MC)"] = ["QCDMu"] merge_cmd["t#bar{t} incl"] = ["TTJets_MassiveBinDECAY"] merge_cmd["WJets incl"] = ["WJets_inclusive"] merge_cmd["WJets excl"] = ["W1Jets_exclusive", "W2Jets_exclusive", "W3Jets_exclusive", "W4Jets_exclusive"] merged_hists = merge_hists(histsD, merge_cmd) normd = dict() for hn, h in merged_hists.items(): normd[hn] = get_hist_int_err(h) return merged_hists, normd
process_names.insert(1, "QCD") #--------------------open file ------------------------ filename = mode1 + mode1a + weight + mode2 + ".root" histograms = "Histograms/" + channel + "/" + mode1 + mode1a + "/" + filename print "Opening input file: " + histograms h = ROOT.TFile(histograms) #------------------------------------------------------ for hist_name in hist_def: hist_to_plot = hist_def[hist_name][0] print "Plotting:" + hist_to_plot from plots.common.odict import OrderedDict as dict mc_to_plot = dict() mc_to_plot["diboson"] = h.Get("diboson/" + hist_to_plot) mc_to_plot["WJets_inclusive"] = h.Get("wjets/" + hist_to_plot) mc_to_plot["DYJets"] = h.Get("zjets/" + hist_to_plot) mc_to_plot["TTJets"] = h.Get("ttjets/" + hist_to_plot) mc_to_plot["T_tW"] = h.Get("tW/" + hist_to_plot) mc_to_plot["T_s"] = h.Get("sch/" + hist_to_plot) mc_to_plot["signal"] = h.Get("signal/" + hist_to_plot) data = h.Get("data/" + hist_to_plot) if qcd_from_mc: print "Get QCD from MC" qcd = h.Get("qcd_mc/" + hist_to_plot) else:
process_names.insert(1,"QCD") #--------------------open file ------------------------ filename = mode1 + mode1a + weight + mode2 +".root" histograms = "Histograms/" + channel + "/" + mode1 + mode1a + "/" + filename print "Opening input file: " + histograms h = ROOT.TFile(histograms) #------------------------------------------------------ for hist_name in hist_def: hist_to_plot = hist_def[hist_name][0] print "Plotting:" + hist_to_plot from plots.common.odict import OrderedDict as dict mc_to_plot = dict() mc_to_plot["diboson"] = h.Get("diboson/" + hist_to_plot) mc_to_plot["WJets_inclusive"] = h.Get("wjets/" + hist_to_plot) mc_to_plot["DYJets"] = h.Get("zjets/" + hist_to_plot) mc_to_plot["TTJets"] = h.Get("ttjets/" + hist_to_plot) mc_to_plot["T_tW"] = h.Get("tW/" + hist_to_plot) mc_to_plot["T_s"] = h.Get("sch/" + hist_to_plot) mc_to_plot["signal"] = h.Get("signal/" + hist_to_plot) data = h.Get("data/" + hist_to_plot) if qcd_from_mc: print "Get QCD from MC" qcd = h.Get("qcd_mc/" + hist_to_plot) else: