예제 #1
0
        print "#Saving yields to pickle"

        # save to pickle
        import cPickle as pickle
        pickle.dump( ydsSyst, open( pckname, "wb" ) )

    # Sys types
#    systs = ["btagHF","Wxsec","topPt","PU","DLSlope","DLConst"]#,"JEC"]
#    systs = ["Wxsec","PU","JEC","btagHF","btagLF","topPt"]
#    systs = ["Wxsec","PU","JEC","btagHF","btagLF","topPt","DLConst","DLSlope","JER"]
    systs = ["TTVxsec","Wpol","Wxsec","PU","JEC","btagHF","btagLF","topPt","DLConst","DLSlope"]

    # Kappa systematics
    samp = "EWK";    var = "Kappa"
    systSamps = [(samp+"_"+syst+"_syst",var) for syst in systs]
    systHists = yp.makeSampHists(ydsSyst,systSamps)
    hKappaSysts = yp.getSquaredSum(systHists)

    print "Created syst hist", hKappaSysts

    # MC systematics
    samp = "EWK";    var = "SR_MB"
    systSamps = [(samp+"_"+syst+"_syst",var) for syst in systs]
    systHists = yp.makeSampHists(ydsSyst,systSamps)
    hMCSysts = yp.getSquaredSum(systHists)


    ###########################
    ## Make Prediction plots ##
    ###########################
예제 #2
0
            hPredUnc.SetFillStyle(3244)
            hPredUnc.SetMarkerColor(col)
            hPredUnc.SetMarkerStyle(0)
            hPredUnc.GetYaxis().SetTitle(ratio.GetYaxis().GetTitle())
            hPredUnc.GetYaxis().SetRangeUser(0,3.9)

            # set error
            for i in xrange(1,hPredUnc.GetNbinsX()+1):
                try:
                    hPredUnc.SetBinError(i,hDataPred.GetBinError(i)/hDataPred.GetBinContent(i))
                except ZeroDivisionError:
                    hPredUnc.SetBinError(i, 0.)

        # MC samps
        samps = [(samp,cat) for samp in mcSamps]
        mcHists = yp.makeSampHists(yds,samps)

        # Scale MC hists to Prediction
        scaleToHist(mcHists,hDataPred)

        mcStack = yp.getStack(mcHists)
        hUncert = hDataPred.Clone("uncert")
        hUncert.SetTitle("Statistical Uncertainty only")
        yp.setUnc(hUncert)

        #canv = plotHists("DataNJ45_"+cat,[stack,hMCpred,hDataPred,hData,total],ratio)
        width = 1200
        height = 600
        legPos = "TM"

        if doSquare == True:
        print "#Saving yields to pickle"

        # save to pickle
        import cPickle as pickle
        pickle.dump( ydsSyst, open( "allSysts.pck", "wb" ) )

    # Sys types
#    systs = ["btagHF","Wxsec","topPt","PU","DLSlope","DLConst"]#,"JEC"]
#    systs = ["Wxsec","PU","JEC","btagHF","btagLF","topPt"]
#    systs = ["Wxsec","PU","JEC","btagHF","btagLF","topPt","DLConst","DLSlope","JER"]
    systs = ["TTVxsec","Wpol","Wxsec","PU","JEC","btagHF","btagLF","topPt","DLConst","DLSlope"]

    # Kappa systematics
    samp = "EWK";    var = "Kappa"
    systSamps = [(samp+"_"+syst+"_syst",var) for syst in systs]
    systHists = yp.makeSampHists(ydsSyst,systSamps)
    hKappaSysts = yp.getSquaredSum(systHists)

    print "Created syst hist", hKappaSysts

    # MC systematics
    samp = "EWK";    var = "SR_MB"
    systSamps = [(samp+"_"+syst+"_syst",var) for syst in systs]
    systHists = yp.makeSampHists(ydsSyst,systSamps)
    hMCSysts = yp.getSquaredSum(systHists)


    ###########################
    ## Make Prediction plots ##
    ###########################