def makeplot(sigregion, cregion, basedir, estdir, outputdir, MConly=True):
    inputfile_data = basedir + "/summary/rzrBoostMC_data.root" # data histograms
    inputfile_totalbg = basedir + "/rzrBoostMC_bg.root" # data histograms
    inputfile_estimate = estdir + "/BGestimate_simple_"+sigregion+"_from_"+cregion+".root" # bg estimate histograms

    if not os.path.isdir(outputdir):
        os.mkdir(outputdir)

    outfile = TFile.Open(outputdir+"/BGplotsSimple_"+sigregion+"_from_"+cregion+".root","RECREATE")
    infile_bg = TFile.Open(inputfile_totalbg)
    infile_data = TFile.Open(inputfile_data)
    infile_estimate = TFile.Open(inputfile_estimate)

    # Integrated luminosity in fb-1s
    intlumi = 19.789 # ABCD
    
    vars = ["MR","R2"]

    # get the 1D projections for the estimate
    hname = "h_MR_R2_"+cregion
    h_2D = infile_estimate.Get(hname)
    h_1D = {}
    h_1D["MR"] = h_2D.ProjectionX("h_1D_MR")
    h_1D["MR"].Sumw2()
    h_1D["R2"] = h_2D.ProjectionY("h_1D_R2")
    h_1D["R2"].Sumw2()
 
    # build legend dictionary
    leg = plotTools.ConstructLDict(0.5,0.87,0.6,0.87)
    
    # build hdictlists
    for var in vars:
        htitle = "Comparison Data vs BG estimate for region "+sigregion+" from region "+cregion
        hdict_data = plotTools.ConstructHDict(infile_data.Get("h_"+var+"_"+sigregion),
                                              name="Data", color=rt.kBlack,
                                              title=htitle, drawoption="E1X0 P", markerstyle=20,
                                              appear_in_ratio="Ref", xtitle=var)
        hdict_estimate = plotTools.ConstructHDict(h_1D[var],
                                                  name="Data-driven BG estimate", color=rt.kCyan+2,
                                                  title=htitle, drawoption="E2", fillstyle=3002,
                                                  appear_in_ratio="Yes", xtitle=var)
        hdict_bg = plotTools.ConstructHDict(infile_bg.Get("h_"+var+"_"+sigregion),
                                            name="Full MC BG estimate", color=rt.kRed+2,
                                            title=htitle, drawoption="E0", fillstyle=3002,
                                            appear_in_ratio="Yes", xtitle=var)
        hdictlist=[hdict_estimate,hdict_data]
        if MConly:
            hdictlist=[hdict_estimate,hdict_bg,hdict_data]
        canvasname = var+"_comparison_data_estimate_"+sigregion+"_from_"+cregion+"_log"
        rtitle = "#frac{BG estimate}{Data}"
        plotTools.Plot1DWithRatio(hdictlist,outputdir,outfile,cname=canvasname,
                                  ratiotitle=rtitle,scale=False,legdict=leg,
                                  cdim=[696,550],ratiodim=0.3,logscale=True)
        
    
    outfile.Close()
예제 #2
0
    #h_2D.Add(h_2D_QCD_toadd)
    h_1D = {}
    h_1D["MR"] = h_2D.ProjectionX("h_1D_MR")
    h_1D["R2"] = h_2D.ProjectionY("h_1D_R2")

    # build legend dictionary
    leg = plotTools.ConstructLDict(0.5, 0.87, 0.6, 0.87)

    # build hdictlists
    for var in vars:
        htitle = "Comparison Data vs BG estimate for region " + region
        hdict_data = plotTools.ConstructHDict(infile_data.Get("h_" + var +
                                                              "_" + region),
                                              name="Data",
                                              color=rt.kBlack,
                                              title=htitle,
                                              drawoption="E1X0 P",
                                              markerstyle=20,
                                              appear_in_ratio="Ref",
                                              xtitle=var)
        hdict_estimate = plotTools.ConstructHDict(
            h_1D[var],
            name="Data-driven BG estimate",
            color=rt.kCyan + 2,
            title=htitle,
            drawoption="E2",
            fillstyle=3002,
            appear_in_ratio="Yes",
            xtitle=var)
        hdict_estimate_WJ = plotTools.ConstructHDict(h_1D_WJ[var],
                                                     name="WJets estimate",
예제 #3
0
    infile_sig = TFile.Open(inputfile_sig)

    # Integrated luminosity in fb-1s
    intlumi = 19.7 # ABCD

    # set root styles
    plotTools.SetBoostStyle()
    
    #############################################################
    ## compare bg with signal
    #############################################################

    # total BG
    hdict_bg = plotTools.ConstructHDict(infile_bg.Get("h_MR_R2_jet1ptg200"), 
                                        name="Background", 
                                        title="",
                                        xtitle="M_{R} (GeV)", ytitle="R^{2}",
                                        drawoption="colz", palette="SMS") 
    canvasname = "MR_R2_jet1ptg200_bg"
    plotTools.Plot2DPAS(hdict_bg,outputdir,outfile,cname=canvasname,scale="Yes",logscale=True,lumitext="Simulation")
            
    # total BG
    hdict_sig = plotTools.ConstructHDict(infile_sig.Get("h_MR_R2_jet1ptg200"), 
                                        name="Signal", 
                                        title="",
                                        xtitle="M_{R} (GeV)", ytitle="R^{2}",
                                        drawoption="colz", palette="SMS") 
    canvasname = "MR_R2_jet1ptg200_sig"
    plotTools.Plot2DPAS(hdict_sig,outputdir,outfile,cname=canvasname,scale="Yes",logscale=True,lumitext="Simulation")
            
    
예제 #4
0
    #    * QCD
    #    * TTJets
    #    * WJets
    #    * ZJets
    # 2. comparison between different control regions
    #    * different QCD regions
    #    * different TTjets regions

    leg = plotTools.ConstructLDict(0.7, 0.85, 0.65, 0.87)

    # build hdictlist for TTJ:
    for var in vars:
        hdict_TTJ = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W1Ll"),
            name="TTJets CR, no mT cut",
            color=rt.kCyan + 3,
            title=
            "Shape comparison for TTJets in the various TTJets Contol regions",
            appear_in_ratio="Ref",
            xtitle=var)
        hdict_TTJmtwindow = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W1LlmT"),
            name="TTJets CR, 30 < mT < 100",
            color=rt.kCyan,
            title=
            "Shape comparison for TTJets in the various TTJets Contol regions",
            appear_in_ratio="Yes",
            xtitle=var)
        hdict_TTJmt = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W1LlmT100"),
            name="TTJets CR, mT < 100",
            color=rt.kCyan + 2,
def runA():
    outputdir = "/afs/cern.ch/work/n/nstrobbe/RazorBoost/GIT/Results/results_20140214_signal_comparison/"
    basedir = "/afs/cern.ch/work/n/nstrobbe/RazorBoost/GIT/Results/results_20140214_signal_comparison/"
    inputfile_1000_325_300_old = basedir + "rzrBoostMC_T1ttcc_325_300.root"
    inputfile_1000_325_300_new = basedir + "rzrBoostMC_T1ttcc_1000_325_300.root"
    inputfile_1000_510_500_old = basedir + "rzrBoostMC_T1ttcc_510_500.root"
    inputfile_1000_510_500_new = basedir + "rzrBoostMC_T1ttcc_1000_510_500.root"

    if not os.path.isdir(outputdir):
        os.mkdir(outputdir)

    outfile = TFile.Open(outputdir + "/shapeplots2.root", "RECREATE")
    infile_1000_325_300_old = TFile.Open(inputfile_1000_325_300_old)
    infile_1000_325_300_new = TFile.Open(inputfile_1000_325_300_new)
    infile_1000_510_500_old = TFile.Open(inputfile_1000_510_500_old)
    infile_1000_510_500_new = TFile.Open(inputfile_1000_510_500_new)

    # Integrated luminosity in fb-1s
    intlumi = 19.789  # ABCD

    vars = ["MR", "R2"]
    yt = ["Events/(100 GeV)", "Events/(0.01)"]
    sf = [100, 0.01]
    cuts = ["g1Mbg1W0Ll", "g1Mbg1W1LlmT100"]
    # leg = plotTools.ConstructLDict(0.7,0.88,0.7,0.88,"")

    for cut in cuts:
        for var in vars:
            hdict_old = plotTools.ConstructHDict(
                infile_1000_325_300_old.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_325_300 OLD",
                color=rt.kRed,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Ref",
                xtitle=var,
                ytitle=yt[vars.index(var)])
            hdict_new = plotTools.ConstructHDict(
                infile_1000_325_300_new.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_325_300 NEW",
                color=rt.kBlue,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Yes",
                xtitle=var,
                ytitle=yt[vars.index(var)])

            hdictlist = [hdict_old, hdict_new]
            canvasname = "Signal_comparison_oldvsnew_1000_325_300__" + var + "__" + cut
            rtitle = "#frac{NEW}{OLD}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="Width",
                                      scalefactor=sf[vars.index(var)])

    for cut in cuts:
        for var in vars:
            hdict_old = plotTools.ConstructHDict(
                infile_1000_510_500_old.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_510_500 OLD",
                color=rt.kRed,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Ref",
                xtitle=var,
                ytitle=yt[vars.index(var)])
            hdict_new = plotTools.ConstructHDict(
                infile_1000_510_500_new.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_510_500 NEW",
                color=rt.kBlue,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Yes",
                xtitle=var,
                ytitle=yt[vars.index(var)])

            hdictlist = [hdict_old, hdict_new]
            canvasname = "Signal_comparison_oldvsnew_1000_510_500__" + var + "__" + cut
            rtitle = "#frac{NEW}{OLD}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="Width",
                                      scalefactor=sf[vars.index(var)])

    vars = ["met", "njets", "nbjets", "jet1pt", "jet2pt", "jet3pt"]
    cuts = ["g1Mbg1W0Ll", "g1Mbg1W1LlmT100"]
    # leg = plotTools.ConstructLDict(0.7,0.88,0.7,0.88,"")

    for cut in cuts:
        for var in vars:
            hdict_old = plotTools.ConstructHDict(
                infile_1000_325_300_old.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_325_300 OLD",
                color=rt.kRed,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Ref",
                xtitle=var)
            hdict_new = plotTools.ConstructHDict(
                infile_1000_325_300_new.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_325_300 NEW",
                color=rt.kBlue,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Yes",
                xtitle=var)

            hdictlist = [hdict_old, hdict_new]
            canvasname = "Signal_comparison_oldvsnew_1000_325_300__" + var + "__" + cut
            rtitle = "#frac{NEW}{OLD}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="No")

    for cut in cuts:
        for var in vars:
            hdict_old = plotTools.ConstructHDict(
                infile_1000_510_500_old.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_510_500 OLD",
                color=rt.kRed,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Ref",
                xtitle=var)
            hdict_new = plotTools.ConstructHDict(
                infile_1000_510_500_new.Get("h_" + var + "_" + cut),
                name="T1ttcc_1000_510_500 NEW",
                color=rt.kBlue,
                title=
                "Comparison between old and new signal scan, for selection " +
                cut,
                appear_in_ratio="Yes",
                xtitle=var)

            hdictlist = [hdict_old, hdict_new]
            canvasname = "Signal_comparison_oldvsnew_1000_510_500__" + var + "__" + cut
            rtitle = "#frac{NEW}{OLD}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="No")

    outfile.Close()
    infile_1000_325_300_old.Close()
    infile_1000_325_300_new.Close()
    infile_1000_510_500_old.Close()
    infile_1000_510_500_new.Close()
예제 #6
0
        "g1Mbg1W0Ll_mdPhig0p5", "g1Mbg1W1LlmT100_mdPhig0p5",
        "0Lbg1Y1LlmT_mdPhig0p5", "0Lbg1uW0Ll_mdPhi0p3"
    ]
    plotinfos = ["Signal region", "T region", "W region", "Q region"]
    legd = plotTools.ConstructLDict(0.65, 0.92, 0.5, 0.8, ncolumns=2)

    for cut in cuts:
        for var in vars:
            hname = "h_%s_%s" % (var, cut)
            htitle = ""
            hlist = []
            for i in range(len(mc_datasets)):
                if not flist[i]: continue
                hdict = plotTools.ConstructHDict(
                    flist[i].Get(hname),
                    name=mc_datasets[i],
                    color=mc_colors[i],
                    title=htitle,
                    xtitle=vartitles[vars.index(var)])
                hlist.append(hdict)

            hsiglist = []
            for i in range(len(sig_datasets)):
                if not fsiglist[i]: continue
                hdict = plotTools.ConstructHDict(
                    fsiglist[i].Get(hname),
                    name=sig_datasets[i],
                    color=sig_colors[i],
                    title=htitle,
                    xtitle=vartitles[vars.index(var)])
                hsiglist.append(hdict)
예제 #7
0
    plotTools.SetBoostStyle()
    tdrstyle.setTDRStyle()

    ########################################################
    # Make comparison of gen level W pt
    hname = "h_MR_jet1ptg200"
    htitle = ""
    xt = "M_{R} (GeV)"
    legd4 = plotTools.ConstructLDict(0.35, 0.9, 0.6, 0.87)
    text1 = TText(0.73, 0.55, "T1t1t model")
    text1.SetNDC()
    text1.SetTextSize(0.04)
    hdict_bg = plotTools.ConstructHDict(infile_bg.Get(hname),
                                        name="Total background",
                                        color=rt.kCyan - 8,
                                        fillstyle=3003,
                                        linewidth=0,
                                        title=htitle,
                                        xtitle=xt)
    hdict_T1t1t_600_225_50 = plotTools.ConstructHDict(
        infile_T1t1t_600_225_50.Get(hname),
        name=
        "m_{#tilde{g}} = 600 GeV, m_{#tilde{t}_{1}} = 225 GeV, m_{#tilde{#chi}_{1}^{0}} = 50 GeV",
        #name="#splitline{m_{#tilde{g}} = 600 GeV, m_{#tilde{t}_{1}} = 225 GeV,}{m_{#tilde{#chi}_{1}^{0}} = 50 GeV}",
        color=rt.kCyan + 2,
        title=htitle,
        xtitle=xt)
    hdict_T1t1t_800_275_100 = plotTools.ConstructHDict(
        infile_T1t1t_800_275_100.Get(hname),
        name=
        "m_{#tilde{g}} = 800 GeV, m_{#tilde{t}_{1}} = 275 GeV, m_{#tilde{#chi}_{1}^{0}} = 100 GeV",
def runB():
    outputdir = "/afs/cern.ch/work/n/nstrobbe/RazorBoost/GIT/Results/results_20140214_signal_comparison/"
    basedir = "/afs/cern.ch/work/n/nstrobbe/RazorBoost/GIT/Results/results_20140214_signal_comparison/"
    inputfile_1200_110_100 = basedir + "rzrBoostMC_T1ttcc_1200_110_100.root"
    inputfile_1200_125_100 = basedir + "rzrBoostMC_T1ttcc_1200_125_100.root"
    inputfile_1200_180_100 = basedir + "rzrBoostMC_T1ttcc_1200_180_100.root"

    if not os.path.isdir(outputdir):
        os.mkdir(outputdir)

    outfile = TFile.Open(outputdir + "/shapeplots2B.root", "RECREATE")
    infile_1200_110_100 = TFile.Open(inputfile_1200_110_100)
    infile_1200_125_100 = TFile.Open(inputfile_1200_125_100)
    infile_1200_180_100 = TFile.Open(inputfile_1200_180_100)

    # Integrated luminosity in fb-1s
    intlumi = 19.789  # ABCD

    vars = ["MR", "R2"]
    yt = ["Events/(100 GeV)", "Events/(0.01)"]
    sf = [100, 0.01]
    cuts = ["SIG", "g1Mbg1W0Ll", "g1Mbg1W1LlmT100"]
    # leg = plotTools.ConstructLDict(0.7,0.88,0.7,0.88,"")

    for cut in cuts:
        for var in vars:
            hdict_10 = plotTools.ConstructHDict(
                infile_1200_110_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_110_100",
                color=rt.kCyan,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Ref",
                xtitle=var,
                ytitle=yt[vars.index(var)])
            hdict_25 = plotTools.ConstructHDict(
                infile_1200_125_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_125_100",
                color=rt.kCyan + 2,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Yes",
                xtitle=var,
                ytitle=yt[vars.index(var)])
            hdict_80 = plotTools.ConstructHDict(
                infile_1200_180_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_180_100",
                color=rt.kCyan + 4,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Yes",
                xtitle=var,
                ytitle=yt[vars.index(var)])

            hdictlist = [hdict_10, hdict_25, hdict_80]
            canvasname = "Signal_comparison_DMlines_1200_1xx_100__" + var + "__" + cut
            rtitle = "#frac{DM}{DM10}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="Width",
                                      scalefactor=sf[vars.index(var)])

    vars = ["met", "njets", "nbjets", "jet1pt", "jet2pt", "jet3pt"]
    cuts = ["g1Mbg1W0Ll", "g1Mbg1W1LlmT100"]
    leg = plotTools.ConstructLDict(0.65, 0.88, 0.7, 0.88, "")

    for cut in cuts:
        for var in vars:
            hdict_10 = plotTools.ConstructHDict(
                infile_1200_110_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_110_100",
                color=rt.kCyan,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Ref",
                xtitle=var)
            hdict_25 = plotTools.ConstructHDict(
                infile_1200_125_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_125_100",
                color=rt.kCyan + 2,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Yes",
                xtitle=var)
            hdict_80 = plotTools.ConstructHDict(
                infile_1200_180_100.Get("h_" + var + "_" + cut),
                name="T1ttcc_1200_180_100",
                color=rt.kCyan + 4,
                title=
                "Comparison between different DM lines for new signal scan, for selection "
                + cut,
                appear_in_ratio="Yes",
                xtitle=var)

            hdictlist = [hdict_10, hdict_25, hdict_80]
            canvasname = "Signal_comparison_DMlines_1200_1xx_100__" + var + "__" + cut
            rtitle = "#frac{DM}{DM10}"
            # plotTools.Plot1D(hdictlist,outputdir,outfile,cname=canvasname,scale="No",legdict=leg)
            plotTools.Plot1DWithRatio(hdictlist,
                                      outputdir,
                                      outfile,
                                      legdict=leg,
                                      cname=canvasname,
                                      ratiotitle=rtitle,
                                      scale="No")

    outfile.Close()
    infile_1200_110_100.Close()
    infile_1200_125_100.Close()
    infile_1200_180_100.Close()
예제 #9
0
    # set root styles
    plotTools.SetBoostStyle()

    ##########################################
    # Plot with trigger efficiency
    ##########################################

    trigdir = "."
    inputfile_trig = trigdir + "/hlteff_0_pre_singlel.root"
    infile_trig = TFile.Open(inputfile_trig)

    hdict_trig = plotTools.ConstructHDict(
        infile_trig.Get("h_HT_j1pt_pre_effph_l"),
        name="",
        #name="#splitline{Preselection}{SingleL}",
        title="",
        xtitle="H_{T} (GeV)",
        ytitle="p_{T}(j_{1}) (GeV)",
        ztitle="Efficiency",
        drawoption="colz",
        palette="SMS")
    canvasname = "h_HT_j1pt_pre_eff_ph_l"
    #plotTools.Plot2DPAS(hdict_trig,outputdir,outfile,cname=canvasname,scale="No",logscale=False,lumitext=" Preliminary", zmax=1.)

    text1 = TLatex(
        0.15, 0.2, "#splitline{SingleL, preselection,}{unc = max(err+, diff)}")
    text1.SetNDC()
    text1.SetTextSize(0.05)
    text1.SetTextFont(42)

    hdict_trig2 = plotTools.ConstructHDict(
        infile_trig.Get("h_HT_j1pt_0_pre_errdiff_up_ph_l"),
예제 #10
0
    plotinfos = [
        "Signal region", "T region", "W region", "Q region", "Baseline",
        "Z-enriched region"
    ]
    legd = plotTools.ConstructLDict(0.58, 0.92, 0.45, 0.8, ncolumns=2)

    for cut in cuts:
        for var in vars:
            hname = "h_%s_%s" % (var, cut)
            htitle = ""
            hlist = []
            for i in range(len(mc_datasets)):
                if not flist[i]: continue
                hdict = plotTools.ConstructHDict(
                    flist[i].Get(hname),
                    name=mc_titles[i],
                    color=mc_colors[i],
                    title=htitle,
                    xtitle=vartitles[vars.index(var)])
                hlist.append(hdict)

            hsiglist = []
            for i in range(len(sig_datasets)):
                if not fsiglist[i]: continue
                hdict = plotTools.ConstructHDict(
                    fsiglist[i].Get(hname),
                    name=sig_titles[i],
                    color=sig_colors[
                        i],  #linestyle=sig_styles[i],linewidth=sig_widths[i],
                    title=htitle,
                    xtitle=vartitles[vars.index(var)])
                hsiglist.append(hdict)
예제 #11
0
    #    * WJets
    #    * ZJets
    # 2. comparison between different control regions
    #    * different QCD regions
    #    * different TTjets regions

    leg = plotTools.ConstructLDict(0.6, 0.9, 0.6, 0.87)

    vars = ["MR", "R2"]
    vartitles = ["M_{R} (GeV)", "R^{2}"]

    for i, var in enumerate(vars):
        hdict_SIG = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W0Ll_mdPhig0p5"),
            name="Signal region",
            color=rt.kRed + 4,
            title=
            "Shape comparison for TTJets in Signal and TTJ Control region",
            appear_in_ratio="Ref",
            xtitle=vartitles[i])
        hdict_TTJmt = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W1LlmT100_mdPhig0p5"),
            name="T region",
            color=rt.kRed + 1,
            title=
            "Shape comparison for TTJets in Signal and TTJ control region",
            appear_in_ratio="Yes",
            xtitle=vartitles[i])
        hdictlist = [hdict_SIG, hdict_TTJmt]
        canvasname = var + "_comparison_TTJ_SIG"
        rtitle = "T/S"
        plotTools.Plot1DWithRatioPAS(hdictlist,
예제 #12
0
    #    * TTJets
    #    * WJets
    #    * ZJets
    # 2. comparison between different control regions
    #    * different QCD regions
    #    * different TTjets regions

    leg = plotTools.ConstructLDict(0.15, 0.9, 0.6, 0.87)

    hnames = ["h_Nmin1_njets_g1Mbg1W0Ll_mdPhig0p5"]
    vartitles = ["Jet multiplicity"]

    for i, hname in enumerate(hnames):
        hdict_bg = plotTools.ConstructHDict(infile_bg.Get(hname),
                                            name="Total background",
                                            color=rt.kBlack,
                                            title="",
                                            xtitle=vartitles[i])
        hdict_sig1 = plotTools.ConstructHDict(
            infile_1000_325_300.Get(hname),
            name=
            "T1ttcc, m_{#tilde{g}} = 1000 GeV, m_{#tilde{t}_{1}} = 325 GeV, m_{#tilde{#chi}_{1}^{0}} = 300 GeV",
            color=rt.kRed + 1,
            title="",
            xtitle=vartitles[i])
        hdict_sig2 = plotTools.ConstructHDict(
            infile_800_425_400.Get(hname),
            name=
            "T1ttcc, m_{#tilde{g}} = 800 GeV, m_{#tilde{t}_{1}} = 425 GeV, m_{#tilde{#chi}_{1}^{0}} = 400 GeV",
            color=rt.kRed + 3,
            title="",
예제 #13
0
    #                                         drawoption="colz", palette="SMS")
    #    
    #    canvasname = var+"_TTJ"
    #    plotTools.Plot2D(hdict_TTJ,outputdir,outfile,cname=canvasname,scale="No",logscale=True)

    #    canvasname = var+"_ratio_TTJ_SIG"
    #    plotTools.Plot2DRatio(hdict_TTJ,hdict_SIG,outputdir,outfile,cname=canvasname,scale="Yes",ctitle="Ratio TTJ CR / SIG region for TTJets MC",ztitle="TTJ/SIG")

    cuts = ["g1Mbg1W1LlmT100_mdPhig0p5","0Lbg1Y1LlmT_mdPhig0p5",
            "g1Mbg1W1LlmT100_mdPhi0p5","0Lbg1Y1LlmT_mdPhi0p5"]
    names = ["T mdPhi > 0.5", "W mdPhi > 0.5","T mdPhi < 0.5","W mdPhi < 0.5"]
    for var in vars:
        for i,cut in enumerate(cuts):
            # total BG
            hdict_bg = plotTools.ConstructHDict(infile_bg.Get("h_"+var+"_"+cut), 
                                                name=names[i]+" CR", title="R2 vs MR distribution for the total background in the %s region"%(names[i]),
                                                xtitle=var.split("_")[0], ytitle=var.split("_")[1],
                                                drawoption="colztext", palette="SMS") 
            canvasname = var+"_"+cut+"_bg"
            plotTools.Plot2D(hdict_bg,outputdir,outfile,cname=canvasname,scale="No",logscale=True)
            
            # data
            hdict_data = plotTools.ConstructHDict(infile_data.Get("h_"+var+"_"+cut), 
                                                  name=names[i]+" CR", title="R2 vs MR distribution for the data in the %s region"%(names[i]),
                                                  xtitle=var.split("_")[0], ytitle=var.split("_")[1],
                                                  drawoption="colztext", palette="SMS") 
            canvasname = var+"_"+cut+"_data"
            plotTools.Plot2D(hdict_data,outputdir,outfile,cname=canvasname,scale="No",logscale=True)
                        
            # ratio
            canvasname = var+"_"+cut+"_ratio_data_bg"
            plotTools.Plot2DRatio(hdict_data,hdict_bg,outputdir,outfile,cname=canvasname,scale="No",
예제 #14
0
    # set root styles
    plotTools.SetBoostStyle()

    ##################################################################
    leg = plotTools.ConstructLDict(0.6, 0.9, 0.6, 0.87)

    varis = ["pileup"]
    vartitles = ["Number of pileup interactions"]

    outfile.cd()
    for i, var in enumerate(varis):
        hdict_data = plotTools.ConstructHDict(infile_data.Get(var).Rebin(10),
                                              name="Data",
                                              color=rt.kBlack,
                                              title="",
                                              drawoption="histP",
                                              markerstyle=20,
                                              markersize=1.2,
                                              xtitle=vartitles[i])
        hdict_bg = plotTools.ConstructHDict(infile_bg.Get("h_" +
                                                          var).Rebin(10),
                                            name="Simulation",
                                            color=rt.kRed + 1,
                                            title="",
                                            drawoption="histP",
                                            markerstyle=22,
                                            markersize=1.2,
                                            xtitle=vartitles[i])
        hdictlist = [hdict_data, hdict_bg]
        canvasname = var + "_comparison"
        #plotTools.Plot1DPAS(hdictlist,outputdir,outfile,legdict=leg,cname=canvasname,scale="Yes")
예제 #15
0
    infile_TTJ = TFile.Open(inputfile_TTJ)

    # Integrated luminosity in fb-1s
    intlumi = 19.789  # ABCD

    # set root styles
    plotTools.SetBoostStyle()

    vars = ["MR", "R2"]

    # build hdictlist for TTJ:
    for var in vars:
        hdict_SIG = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W0Ll"),
            name="SIGNAL region",
            color=rt.kBlack,
            title=
            "Shape comparison for TTJets semileptonic in Signal and TTJ Control region",
            appear_in_ratio="Ref",
            xtitle=var)
        hdict_TTJmt = plotTools.ConstructHDict(
            infile_TTJ.Get("h_" + var + "_g1Mbg1W1LlmT100"),
            name="TTJets CR, mT < 100",
            color=rt.kCyan + 2,
            title=
            "Shape comparison for TTJets semileptonic in Signal and TTJ control region",
            appear_in_ratio="Yes",
            xtitle=var)
        hdictlist = [hdict_SIG, hdict_TTJmt]
        canvasname = var + "_comparison_TTJsemilep_SIG"
        rtitle = "#frac{TTJ}{SIG}"
        plotTools.Plot1DWithRatio(hdictlist,