'DY': 'Misid. rate prediction' }) legendbox = [0.5, 0.5, 0.92, 0.9] extracmstext = 'Preliminary' extrainfos = [] if process == 'DY': extrainfos = ['Drell-Yan simulation'] if process == 'TT': extrainfos = ['t#bar{t} simulation'] hp.plotdatavsmc(os.path.join(outdir, var + '_' + instancename), observedhist, predictedhists, mcsysthist=predictedsyst, datalabel='MC Obs.', p2yaxtitle='#frac{MC Obs.}{Pred.}', colormap=colormap, labelmap=labelmap, xaxtitle=xaxtitle, yaxtitle=yaxtitle, lumi=lumi, p1legendncols=1, p1legendbox=legendbox, extracmstext=extracmstext, extrainfos=extrainfos) hp.plotdatavsmc(os.path.join(outdir, var + '_' + instancename + '_log'), observedhist, predictedhists, mcsysthist=predictedsyst, datalabel='MC Obs.', p2yaxtitle='#frac{MC Obs.}{Pred.}', colormap=colormap,
extracmstext = 'Preliminary' extrainfos = [] extrainfos.append('{} {}'.format(year, flavour)) extrainfos.append('pT: {}, eta: {}, {}'.format( ptbin, etabin, ftype)) extrainfos.append('prefit') colormap = {} colormap['Prompt'] = ROOT.kAzure + 1 colormap['Nonprompt'] = ROOT.kRed - 7 figname = os.path.join(thisbin + '_prefit') hp.plotdatavsmc(figname, datahist, [prompthist, nonprompthist], datalabel='Data', p2yaxtitle='#frac{Data}{Pred.}', colormap=colormap, xaxtitle=xaxtitle, yaxtitle=yaxtitle, lumi=lumi, extracmstext=extracmstext, extrainfos=extrainfos, infosize=15) # write the histograms to a temporary file tempfilename = thisbin + '_histograms.root' f = ROOT.TFile.Open(tempfilename, 'recreate') prompthist.Write() nonprompthist.Write() datahist.Write() f.Close() prefitnp = nonprompthist.Integral() ### run combine fit
yaxtitle = datahist.GetYaxis().GetTitle() lumimap = {'all': 137600, '2016': 36300, '2017': 41500, '2018': 59700} lumi = lumimap[year] extracmstext = 'Preliminary' extrainfos = [trigger] colormap = {} colormap['WJets'] = ROOT.kAzure + 1 colormap['TT'] = ROOT.kCyan + 1 colormap['DY'] = ROOT.kBlue + 1 colormap['VV'] = ROOT.kCyan - 7 legendbox = [0.7, 0.5, 0.9, 0.9] # make the plot hp.plotdatavsmc( os.path.join(outputdir, trigger), datahist, prompthists, mcsysthist=systunchist, datalabel='Data', p2yaxtitle='#frac{Data}{Pred.}', colormap=colormap, #labelmap=labelmap, xaxtitle=xaxtitle, yaxtitle=yaxtitle, lumi=lumi, p1legendncols=1, p1legendbox=legendbox, extracmstext=extracmstext, extrainfos=extrainfos, infosize=15)