def scaleToHist(hists, hRef): hTotal = yp.getTotal(hists) for hist in hists: hist.Divide(hTotal) hist.Multiply(hRef)
mcSamps = ['DY','TTV','SingleT','WJets','TT'] #mcSamps = ['EWK'] # update colors yp.colorDict["MC_prediction"] = yp.kRed yp.colorDict["Data_prediction"] = yp.kRed # Category cat = "SR_MB_predict" # MC samps samps = [(samp,cat) for samp in mcSamps] mcHists = yp.makeSampHists(yds,samps) 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)
# mcSamps = ["EWK","TTJets","WJets","SingleTop","DY","TTV"] #mcSamps = ['TTdiLep','TTsemiLep','WJets','TTV','SingleT','DY'] mcSamps = ['DY', 'TTV', 'SingleT', 'WJets', 'TTdiLep', 'TTsemiLep'] cat = "SR_MB" #logY = True logY = False print "Making plot for", cat # MC samps samps = [(samp, cat) for samp in mcSamps] mcHists = yp.makeSampHists(ydsMC, samps) hMC = yp.getStack(mcHists) hTotal = yp.getTotal(mcHists) # Signals sighists = [] masses = [] mass = "mGo1500_mLSP100" massName = "(1500,100)" masses.append((mass, massName, yp.kMagenta)) mass = "mGo1200_mLSP800" massName = "(1200,800)" masses.append((mass, massName, yp.kBlack)) for (mass, massName, col) in masses: