def compare_versions(bMulti = None, jMulti = None):
	
	# comparison is: [num, denom]
	versions = ["15", "9"]

	print bMulti, jMulti

	eff_maps = {}

	for v in versions:

		if settings['compare'] == "eff":
			centralRootFile100 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_100.0_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
			centralRootFile87 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_86.7_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
			# if v=="9":
			# 	centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.7_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
			# elif v=="15":
			# 	centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
			centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
			nocuts = sutils.GetHist(File=centralRootFile100, folder=["smsScan_before", ], hist="m0_m12_mChi_weight", Norm=None, rebinY=1)
			nocuts = sutils.threeToTwo(nocuts)

			cutsHist = sutils.GetHist(File=centralRootFile73, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[0:2], hist="m0_m12_mChi_weight", Norm=None, rebinY=1).Clone()
			cutsHist.Add(sutils.GetHist(File=centralRootFile87, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[2:3], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
			cutsHist.Add(sutils.GetHist(File=centralRootFile100, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[3:], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
			cutsHist = sutils.threeToTwo(cutsHist)
			eff_maps[v] = pCla.effMap(cutsHist, nocuts)

		elif settings['compare'] == "syst":
			rootfile = r.TFile.Open("./rootfiles/%s_v%s/syst.root" % (settings["model"], v))
			syst_hist = rootfile.Get("total_T2cc_%s_%s_incl" % (bMulti, jMulti))
			eff_maps[v] = pCla.effMap(syst_hist)

	compare_map = pCla.effMap(eff_maps[versions[0]]._hist, eff_maps[versions[1]]._hist)

	c1 = r.TCanvas()

	r.gStyle.SetOptStat(0)

	compare_map._hist.Draw("colztext")
	compare_map._hist.GetZaxis().SetRangeUser(0.7, 1.3)
	compare_map._hist.SetTitle("%s_%s" % (bMulti, jMulti))
	c1.Print("out/version_compare_%s_%s_%s_%s.pdf" % (settings["model"], "_vs_".join(versions), bMulti, jMulti))

	r.gStyle.SetOptStat("neMRou")
	compare_1d = r.TH1D("compare", "compare",80, 0.6, 1.4)
	for i in range(compare_map._hist.GetNbinsX()*compare_map._hist.GetNbinsY()+500):
		val = compare_map._hist.GetBinContent(i)
		if val: compare_1d.Fill(val)
	compare_1d.Draw("hist")
	r.gStyle.SetOptStat("neMRou")
	compare_1d.SetTitle("%s_%s" % (bMulti, jMulti))
	c1.Print("out/version_compare_1d_%s_%s_%s_%s.pdf" % (settings["model"], "_vs_".join(versions), bMulti, jMulti))	
Пример #2
0
def get_eff_map(files={}, bMulti="", jMulti="", aT_ = [0.55, None]):

    nocuts = sutils.GetHist(File = files["hi"],folder = ["smsScan_before",],hist = "m0_m12_mChi_weight", Norm = None, rebinY=1)
    nocuts = sutils.threeToTwo(nocuts)

    cutsJESPlusHist = sutils.GetHist(File=files["lo"], folder=sutils.getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, htbins = settings['HTBins'], sitv_ = settings["SITV"])[0:2], hist="m0_m12_mChi_weight", Norm=None, rebinY=1).Clone()
    cutsJESPlusHist.Add(sutils.GetHist(File=files["mid"], folder=sutils.getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, htbins = settings['HTBins'], sitv_ = settings["SITV"])[2:3], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
    cutsJESPlusHist.Add(sutils.GetHist(File=files["hi"], folder=sutils.getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, htbins = settings['HTBins'], sitv_ = settings["SITV"])[3:], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
    # cutsJESPlusHist = sutils.GetHist(File=files["hi"], folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, htbins = settings['HTBins'], sitv_ = settings["SITV"], aT = aT_)[3:], hist="m0_m12_mChi_weight", Norm=None, rebinY=1)
    cutsJESPlusHist = sutils.threeToTwo(cutsJESPlusHist)

    return pcla.effMap(cutsJESPlusHist, nocuts)
Пример #3
0
def get_eff_map(files={}, bMulti="", jMulti="", aT_=[0.55, None]):

    nocuts = sutils.GetHist(File=files["hi"],
                            folder=[
                                "smsScan_before",
                            ],
                            hist="m0_m12_mChi_weight",
                            Norm=None,
                            rebinY=1)
    nocuts = sutils.threeToTwo(nocuts)

    cutsJESPlusHist = sutils.GetHist(File=files["lo"],
                                     folder=sutils.getRootDirs(
                                         bMulti_=bMulti,
                                         jMulti_=jMulti,
                                         htbins=settings['HTBins'],
                                         sitv_=settings["SITV"])[0:2],
                                     hist="m0_m12_mChi_weight",
                                     Norm=None,
                                     rebinY=1).Clone()
    cutsJESPlusHist.Add(
        sutils.GetHist(File=files["mid"],
                       folder=sutils.getRootDirs(bMulti_=bMulti,
                                                 jMulti_=jMulti,
                                                 htbins=settings['HTBins'],
                                                 sitv_=settings["SITV"])[2:3],
                       hist="m0_m12_mChi_weight",
                       Norm=None,
                       rebinY=1))
    cutsJESPlusHist.Add(
        sutils.GetHist(File=files["hi"],
                       folder=sutils.getRootDirs(bMulti_=bMulti,
                                                 jMulti_=jMulti,
                                                 htbins=settings['HTBins'],
                                                 sitv_=settings["SITV"])[3:],
                       hist="m0_m12_mChi_weight",
                       Norm=None,
                       rebinY=1))
    # cutsJESPlusHist = sutils.GetHist(File=files["hi"], folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, htbins = settings['HTBins'], sitv_ = settings["SITV"], aT = aT_)[3:], hist="m0_m12_mChi_weight", Norm=None, rebinY=1)
    cutsJESPlusHist = sutils.threeToTwo(cutsJESPlusHist)

    return pcla.effMap(cutsJESPlusHist, nocuts)
def compare_versions(bMulti = None, jMulti = None):
    models = ["T2cc", "T2_4body"]

    print bMulti, jMulti

    eff_maps = {}

    cballs = r.TCanvas()
    cballs.SetGridy(1)

    for v in models:

        centralRootFile100 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_100.0_bt0.0_MChi-1.0.root"%(v, version_dict[v], v, "had"))
        centralRootFile87 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_86.7_bt0.0_MChi-1.0.root"%(v, version_dict[v], v, "had"))
        centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root"%(v, version_dict[v], v, "had"))
        nocuts = GetHist(File=centralRootFile100, folder=["smsScan_before", ], hist="m0_m12_mChi_weight", Norm=None, rebinY=1)
        nocuts = threeToTwo(nocuts)

        cutsHist = GetHist(File=centralRootFile73, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[0:2], hist="m0_m12_mChi_weight", Norm=None, rebinY=1).Clone()
        cutsHist.Add(GetHist(File=centralRootFile87, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[2:3], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
        cutsHist.Add(GetHist(File=centralRootFile100, folder=getRootDirs(bMulti_ = bMulti, jMulti_ = jMulti, sitv_ = True)[3:], hist="m0_m12_mChi_weight", Norm=None, rebinY=1))
        cutsHist = threeToTwo(cutsHist)

        if v == "T2_4body":
            nocuts = cut_off_end_bin(nocuts)
            cutsHist = cut_off_end_bin(cutsHist)

        if v == "T2cc":
            # nocuts.RebinY(2)
            # cutsHist.RebinY(2)
            pass

        # print v, nocuts.GetNbinsX(), nocuts.GetXaxis().GetBinLowEdge(1), nocuts.GetXaxis().GetBinUpEdge(nocuts.GetNbinsX()), nocuts.GetNbinsY(), nocuts.GetYaxis().GetBinLowEdge(1), nocuts.GetYaxis().GetBinUpEdge(nocuts.GetNbinsY())

        eff_maps[v] = pCla.effMap(cutsHist, nocuts)

        # nocuts.Draw("colztext")
        # cballs.Print("out/nocuts_%s_%s_%s.pdf" % (v, bMulti, jMulti))
        # cutsHist.Draw("colztext")
        # cballs.Print("out/cutsHist_%s_%s_%s.pdf" % (v, bMulti, jMulti))
        # eff_maps[v]._hist.Draw("colztext")
        # cballs.Print("out/effHist_%s_%s_%s.pdf" % (v, bMulti, jMulti))


    compare_map = pCla.effMap(eff_maps[models[0]]._hist, eff_maps[models[1]]._hist)

    c1 = r.TCanvas()

    r.gStyle.SetOptStat(0)

    compare_map._hist.Draw("colztext")
    compare_map._hist.GetZaxis().SetRangeUser(0., 3.)
    compare_map._hist.SetTitle("Eff compare (%s/%s) - %s %s" % (models[0], models[1], bMulti, jMulti))
    c1.Print("out/model_compare_%s_%s_%s.pdf" % ("_vs_".join(models), bMulti, jMulti))

    r.gStyle.SetOptStat("neMRou")
    compare_1d_dm10 = r.TH1D("compare_dm10", "compare dM=10 (%s/%s)- %s %s" % (models[0], models[1], bMulti, jMulti),300, 0., 3.)
    compare_1d_dm20 = r.TH1D("compare_dm20", "compare dM=20 (%s/%s)- %s %s" % (models[0], models[1], bMulti, jMulti),300, 0., 3.)
    
    for i in range(compare_map._hist.GetNbinsX()*compare_map._hist.GetNbinsY()+500):
        xbin, ybin, zbin = r.Long(0.), r.Long(0.), r.Long(0.)
        compare_map._hist.GetBinXYZ(i, xbin, ybin, zbin)
        xbinval = compare_map._hist.GetXaxis().GetBinLowEdge(xbin)
        ybinval = compare_map._hist.GetYaxis().GetBinLowEdge(ybin)

        val = compare_map._hist.GetBinContent(i)
        dmass = xbinval-ybinval
        if val:
            # if xbinval == 250: print xbinval, ybinval, xbinval-ybinval
            if dmass <12:
                # print xbinval, ybinval, dmass
                compare_1d_dm10.Fill(val)
            # if dmass > 10 and dmass <= 20:
            #     print "20split:", xbinval, ybinval, dmass
            #     compare_1d_dm20.Fill(val)



    compare_1d_dm10.Draw("hist")
    r.gStyle.SetOptStat("neMRou")
    c1.Print("out/model_compare_1d_%s_%s_%s.pdf(" % ("_vs_".join(models), bMulti, jMulti)) 

    compare_1d_dm20.Draw("hist")
    c1.Print("out/model_compare_1d_%s_%s_%s.pdf)" % ("_vs_".join(models), bMulti, jMulti))     
def compare_versions(bMulti=None, jMulti=None):
    models = ["T2cc", "T2_4body"]

    print bMulti, jMulti

    eff_maps = {}

    cballs = r.TCanvas()
    cballs.SetGridy(1)

    for v in models:

        centralRootFile100 = r.TFile.Open(
            "./rootFiles/%s_v%s/sigScan_%s_%s_2012_100.0_bt0.0_MChi-1.0.root" %
            (v, version_dict[v], v, "had"))
        centralRootFile87 = r.TFile.Open(
            "./rootFiles/%s_v%s/sigScan_%s_%s_2012_86.7_bt0.0_MChi-1.0.root" %
            (v, version_dict[v], v, "had"))
        centralRootFile73 = r.TFile.Open(
            "./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root" %
            (v, version_dict[v], v, "had"))
        nocuts = GetHist(File=centralRootFile100,
                         folder=[
                             "smsScan_before",
                         ],
                         hist="m0_m12_mChi_weight",
                         Norm=None,
                         rebinY=1)
        nocuts = threeToTwo(nocuts)

        cutsHist = GetHist(File=centralRootFile73,
                           folder=getRootDirs(bMulti_=bMulti,
                                              jMulti_=jMulti,
                                              sitv_=True)[0:2],
                           hist="m0_m12_mChi_weight",
                           Norm=None,
                           rebinY=1).Clone()
        cutsHist.Add(
            GetHist(File=centralRootFile87,
                    folder=getRootDirs(bMulti_=bMulti,
                                       jMulti_=jMulti,
                                       sitv_=True)[2:3],
                    hist="m0_m12_mChi_weight",
                    Norm=None,
                    rebinY=1))
        cutsHist.Add(
            GetHist(File=centralRootFile100,
                    folder=getRootDirs(bMulti_=bMulti,
                                       jMulti_=jMulti,
                                       sitv_=True)[3:],
                    hist="m0_m12_mChi_weight",
                    Norm=None,
                    rebinY=1))
        cutsHist = threeToTwo(cutsHist)

        if v == "T2_4body":
            nocuts = cut_off_end_bin(nocuts)
            cutsHist = cut_off_end_bin(cutsHist)

        if v == "T2cc":
            # nocuts.RebinY(2)
            # cutsHist.RebinY(2)
            pass

        # print v, nocuts.GetNbinsX(), nocuts.GetXaxis().GetBinLowEdge(1), nocuts.GetXaxis().GetBinUpEdge(nocuts.GetNbinsX()), nocuts.GetNbinsY(), nocuts.GetYaxis().GetBinLowEdge(1), nocuts.GetYaxis().GetBinUpEdge(nocuts.GetNbinsY())

        eff_maps[v] = pCla.effMap(cutsHist, nocuts)

        # nocuts.Draw("colztext")
        # cballs.Print("out/nocuts_%s_%s_%s.pdf" % (v, bMulti, jMulti))
        # cutsHist.Draw("colztext")
        # cballs.Print("out/cutsHist_%s_%s_%s.pdf" % (v, bMulti, jMulti))
        # eff_maps[v]._hist.Draw("colztext")
        # cballs.Print("out/effHist_%s_%s_%s.pdf" % (v, bMulti, jMulti))

    compare_map = pCla.effMap(eff_maps[models[0]]._hist,
                              eff_maps[models[1]]._hist)

    c1 = r.TCanvas()

    r.gStyle.SetOptStat(0)

    compare_map._hist.Draw("colztext")
    compare_map._hist.GetZaxis().SetRangeUser(0., 3.)
    compare_map._hist.SetTitle("Eff compare (%s/%s) - %s %s" %
                               (models[0], models[1], bMulti, jMulti))
    c1.Print("out/model_compare_%s_%s_%s.pdf" %
             ("_vs_".join(models), bMulti, jMulti))

    r.gStyle.SetOptStat("neMRou")
    compare_1d_dm10 = r.TH1D(
        "compare_dm10", "compare dM=10 (%s/%s)- %s %s" %
        (models[0], models[1], bMulti, jMulti), 300, 0., 3.)
    compare_1d_dm20 = r.TH1D(
        "compare_dm20", "compare dM=20 (%s/%s)- %s %s" %
        (models[0], models[1], bMulti, jMulti), 300, 0., 3.)

    for i in range(compare_map._hist.GetNbinsX() *
                   compare_map._hist.GetNbinsY() + 500):
        xbin, ybin, zbin = r.Long(0.), r.Long(0.), r.Long(0.)
        compare_map._hist.GetBinXYZ(i, xbin, ybin, zbin)
        xbinval = compare_map._hist.GetXaxis().GetBinLowEdge(xbin)
        ybinval = compare_map._hist.GetYaxis().GetBinLowEdge(ybin)

        val = compare_map._hist.GetBinContent(i)
        dmass = xbinval - ybinval
        if val:
            # if xbinval == 250: print xbinval, ybinval, xbinval-ybinval
            if dmass < 12:
                # print xbinval, ybinval, dmass
                compare_1d_dm10.Fill(val)
            # if dmass > 10 and dmass <= 20:
            #     print "20split:", xbinval, ybinval, dmass
            #     compare_1d_dm20.Fill(val)

    compare_1d_dm10.Draw("hist")
    r.gStyle.SetOptStat("neMRou")
    c1.Print("out/model_compare_1d_%s_%s_%s.pdf(" %
             ("_vs_".join(models), bMulti, jMulti))

    compare_1d_dm20.Draw("hist")
    c1.Print("out/model_compare_1d_%s_%s_%s.pdf)" %
             ("_vs_".join(models), bMulti, jMulti))
def compare_versions(bMulti=None, jMulti=None):

    # comparison is: [num, denom]
    versions = ["15", "9"]

    print bMulti, jMulti

    eff_maps = {}

    for v in versions:

        if settings['compare'] == "eff":
            centralRootFile100 = r.TFile.Open(
                "./rootFiles/%s_v%s/sigScan_%s_%s_2012_100.0_bt0.0_MChi-1.0.root"
                % (settings["model"], v, settings["model"], "had"))
            centralRootFile87 = r.TFile.Open(
                "./rootFiles/%s_v%s/sigScan_%s_%s_2012_86.7_bt0.0_MChi-1.0.root"
                % (settings["model"], v, settings["model"], "had"))
            # if v=="9":
            # 	centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.7_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
            # elif v=="15":
            # 	centralRootFile73 = r.TFile.Open("./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root"%(settings["model"], v, settings["model"], "had"))
            centralRootFile73 = r.TFile.Open(
                "./rootFiles/%s_v%s/sigScan_%s_%s_2012_73.3_bt0.0_MChi-1.0.root"
                % (settings["model"], v, settings["model"], "had"))
            nocuts = sutils.GetHist(File=centralRootFile100,
                                    folder=[
                                        "smsScan_before",
                                    ],
                                    hist="m0_m12_mChi_weight",
                                    Norm=None,
                                    rebinY=1)
            nocuts = sutils.threeToTwo(nocuts)

            cutsHist = sutils.GetHist(File=centralRootFile73,
                                      folder=getRootDirs(bMulti_=bMulti,
                                                         jMulti_=jMulti,
                                                         sitv_=True)[0:2],
                                      hist="m0_m12_mChi_weight",
                                      Norm=None,
                                      rebinY=1).Clone()
            cutsHist.Add(
                sutils.GetHist(File=centralRootFile87,
                               folder=getRootDirs(bMulti_=bMulti,
                                                  jMulti_=jMulti,
                                                  sitv_=True)[2:3],
                               hist="m0_m12_mChi_weight",
                               Norm=None,
                               rebinY=1))
            cutsHist.Add(
                sutils.GetHist(File=centralRootFile100,
                               folder=getRootDirs(bMulti_=bMulti,
                                                  jMulti_=jMulti,
                                                  sitv_=True)[3:],
                               hist="m0_m12_mChi_weight",
                               Norm=None,
                               rebinY=1))
            cutsHist = sutils.threeToTwo(cutsHist)
            eff_maps[v] = pCla.effMap(cutsHist, nocuts)

        elif settings['compare'] == "syst":
            rootfile = r.TFile.Open("./rootfiles/%s_v%s/syst.root" %
                                    (settings["model"], v))
            syst_hist = rootfile.Get("total_T2cc_%s_%s_incl" %
                                     (bMulti, jMulti))
            eff_maps[v] = pCla.effMap(syst_hist)

    compare_map = pCla.effMap(eff_maps[versions[0]]._hist,
                              eff_maps[versions[1]]._hist)

    c1 = r.TCanvas()

    r.gStyle.SetOptStat(0)

    compare_map._hist.Draw("colztext")
    compare_map._hist.GetZaxis().SetRangeUser(0.7, 1.3)
    compare_map._hist.SetTitle("%s_%s" % (bMulti, jMulti))
    c1.Print("out/version_compare_%s_%s_%s_%s.pdf" %
             (settings["model"], "_vs_".join(versions), bMulti, jMulti))

    r.gStyle.SetOptStat("neMRou")
    compare_1d = r.TH1D("compare", "compare", 80, 0.6, 1.4)
    for i in range(compare_map._hist.GetNbinsX() *
                   compare_map._hist.GetNbinsY() + 500):
        val = compare_map._hist.GetBinContent(i)
        if val: compare_1d.Fill(val)
    compare_1d.Draw("hist")
    r.gStyle.SetOptStat("neMRou")
    compare_1d.SetTitle("%s_%s" % (bMulti, jMulti))
    c1.Print("out/version_compare_1d_%s_%s_%s_%s.pdf" %
             (settings["model"], "_vs_".join(versions), bMulti, jMulti))