예제 #1
0
            #yp.prepRatio(hist)

            # normalize to central value
            #hist.Divide(hCentral)

            hists.append(hist)

        #for hist in hists: print hist.GetName()

        # make stack/total syst hists
        #total = yp.getTotal(hists)
        stack = yp.getStack(hists)
        #sqHist = yp.getSquaredSum(hists)
        sqHist = yp.getSquaredSum(hists[::-1])

        hCentralUncert = yp.getHistWithError(hCentral, sqHist)

        hCentral.GetYaxis().SetRangeUser(0, 5.9)
        hCentral.GetYaxis().SetTitleSize(0.15)
        hCentral.GetYaxis().SetTitleOffset(0.17)

        # save hists
        allhists += hists + [hCentral, hCentralUncert, stack, sqHist]

        canv = yp.plotHists(var + "_" + signame, [stack, sqHist],
                            [hCentral, hCentralUncert],
                            "TLC",
                            1200,
                            600,
                            nCols=2)
        canv.SetName(canv.GetName() + "_Syst")
    mcStack = yp.getStack(mcHists)
    hTotal = yp.getTotal(mcHists)

    # for MC closure
    mcsamp = "EWK_poisson"
    mcsamp = "background_poisson_QCDsubtr"
    hMCpred = yp.makeSampHisto(yds,mcsamp,cat,"MC_prediction"); hMCpred.SetTitle("MC (Pred)")

    # DATA
    hDataPred = yp.makeSampHisto(yds,"data_QCDsubtr",cat,"Data_prediction"); hDataPred.SetTitle("Data (Pred)")
    hData = yp.makeSampHisto(yds,"data_QCDsubtr","SR_MB","Data"); hData.SetTitle("Data")

    ## Append Systematics to prediction
    print "Appending syst. unc. to prediction and total MC"
    hDataPred = yp.getHistWithError(hDataPred, hKappaSysts, new = False)
    hTotal = yp.getHistWithError(hTotal, hMCSysts, new = False)

    # test MC
    #hDataPred = hMCpred

    # Ratio
    #ratio = yp.getRatio(hTotal,hDataPred)
    ratio = yp.getRatio(hData,hDataPred)

    logY = True
    #logY = False
    cname = "Data_2p24fb_"+mask
    canv = yp.plotHists("SR_MB_Prediction",[mcStack,hTotal,hDataPred,hData],ratio,'TM', 1200, 600, logY = logY)
    #canv = yp.plotHists("MC_2p24fb_"+cat+'_'+mask,[mcStack,hTotal,hDataPred],ratio,'TM', 1200, 600, logY = logY)
예제 #3
0
    # MC samps
    samps = [(samp,cat) for samp in mcSamps]
    mcHists = yp.makeSampHists(yds,samps)

    # for MC closure
    #mcsamp = "EWK_poisson"
    #mcsamp = "background_poisson_QCDsubtr"
    #hMCpred = yp.makeSampHisto(yds,mcsamp,cat,"MC_prediction"); hMCpred.SetTitle("MC (Pred)")

    # DATA
    hDataPred = yp.makeSampHisto(yds,"data_QCDsubtr",cat,"Data_prediction"); hDataPred.SetTitle("Prediction")
    hData = yp.makeSampHisto(yds,"data_QCDsubtr","SR_MB","Data"); hData.SetTitle("Data")

    ## Append Systematics to prediction
    print "Appending syst. unc. to prediction and total MC"
    hDataPred = yp.getHistWithError(hDataPred, hKappaSysts, new = False)

    # Do MC hists
    scaleToHist(mcHists,hDataPred)

    mcStack = yp.getStack(mcHists)
    #hTotal = yp.getTotal(mcHists)
    #hTotal = yp.getHistWithError(hTotal, hMCSysts, new = False)
    hUncert = hDataPred.Clone("uncert")
    hUncert.SetTitle("Pred. Uncertainty")
    yp.setUnc(hUncert)

    # test MC
    #hDataPred = hMCpred

    #hData.SetBinErrorOption(TH1.kPoisson)
예제 #4
0
        hist.GetYaxis().SetTitleOffset(0.8)

        #yp.prepKappaHist(hist)
        #yp.prepRatio(hist)

        # normalize to central value
        #hist.Divide(hCentral)

        hists.append(hist)

    # make stack/total syst hists
    #total = yp.getTotal(hists)
    stack = yp.getStack(hists)
    sqHist = yp.getSquaredSum(hists)

    hCentralUncert = yp.getHistWithError(hCentral, sqHist)
    canv = yp.plotHists(var+"_"+samp+"_Syst",[stack,sqHist],[hCentral,hCentralUncert],"TM", 1200, 600)
#    canv = yp.plotHists(var+"_"+samp+"_Syst",[sqHist]+hists,[hCentral,hCentralUncert],"TM", 1200, 600)
#    canv = yp.plotHists(var+"_"+samp+"_Stat",[stack,sqHist],hCentral,"TM", 1200, 600)

    canvs.append(canv)
    if not yp._batchMode: raw_input("Enter any key to exit")

    # Save canvases
    exts = [".pdf",".png",".root"]
    #exts = [".pdf"]

    #odir = "BinPlots/Syst/Combine/test/allSF_noPU_Wpol/Method1A/"
    odir = "BinPlots/Syst/Combine/allSF_noPU_Wpol/Method1A/"
    if not os.path.isdir(odir): os.makedirs(odir)