plots = { # z cand 'zMass' : {'xaxis': 'm_{l^{+}l^{-}} (GeV)', 'yaxis': 'Events / 1 GeV', 'rebin': range(81,101,1)}, 'zLeadingLeptonPt' : {'xaxis': 'p_{T}^{Z_{lead}} (GeV)', 'yaxis': 'Events / 1 GeV', 'rebin': range(0,150,1)}, 'zLeadingLeptonEta' : {'xaxis': '|#eta^{Z_{lead}}|', 'yaxis': 'Events',}, 'zSubLeadingLeptonPt' : {'xaxis': 'p_{T}^{Z_{sublead}} (GeV)', 'yaxis': 'Events / 1 GeV', 'rebin': range(0,150,1)}, 'zSubLeadingLeptonEta' : {'xaxis': '|#eta^{Z_{sublead}}|', 'yaxis': 'Events',}, } # signal region for plot in plots: for sign in ['SS','OS','SS1','SS2','SSEE','SSBB','OSEE','OSBB']: for chan in chans: plotname = '{0}/{1}/{2}'.format(sign,chan,plot) savename = '{0}/{1}/{2}'.format(sign,chan,plot) chargePlotter.plot(plotname,savename,**plots[plot]) # sum gen matched for plot in plots: for chan in chans: plotnames = {} for sample in samples: plotnames[sample] = ['{0}/{1}/{2}'.format('SS1',chan,plot), '{0}/{1}/{2}'.format('SS2',chan,plot)] plotnames['data'] = ['{0}/{1}/{2}'.format('SS',chan,plot)] savename = '{0}/{1}/{2}'.format('SS12',chan,plot) chargePlotter.plot(plotnames,savename,**plots[plot]) # ratios of SS/OS as func of pt/eta chargePlotter.clearHistograms()
} ############################ ### MC based BG estimate ### ############################ for s in samples: plotter.addHistogramToStack(s, sigMap[s]) if not blind: plotter.addHistogram('data', sigMap['data']) for plot in plots: for sel in sels: kwargs = deepcopy(plots[plot]) plotname = '{0}/{1}'.format(sel, plot) savename = '{0}/mc/{1}'.format(sel, plot) plotter.plot(plotname, savename, **kwargs) # ratios of tight/loose as func of pt/eta plotter.clearHistograms() plotter.addHistogram('MC', sigMap['BG']) plotter.addHistogram('Z', sigMap['Z']) plotter.addHistogram('data', sigMap['data'], style={ 'linecolor': ROOT.kBlack, 'name': 'Data' }) plotter.addHistogram('data_uncorrected', sigMap['data'], style={ 'linecolor': ROOT.kRed,
for s in samples: plotter.addHistogramToStack(s, sigMap[s]) if 'lowmass' not in sel and 'highmass' not in sel: for signal in signals: plotter.addHistogram(signal, sigMap[signal], signal=True) if not blind or 'regionD' in sel or 'lowmass' in sel or 'highmass' in sel: plotter.addHistogram('data', sigMap['data']) for plot in plots: kwargs = deepcopy(plots[plot]) plotname = '{0}/{1}'.format(sel, plot) savename = '{0}/mc/{1}'.format(sel, plot) plotter.plot(plotname, savename, **kwargs) if blind and 'regionD' not in sel and 'lowmass' not in sel and 'highmass' not in sel: plotter.addHistogram('data', sigMap['data']) for s in special: for plot in special[s]: kwargs = deepcopy(special[s][plot]) plotname = '{0}/{1}'.format(sel, plot) savename = '{0}/mc/{1}_{2}'.format(sel, plot, s) plotter.plot(plotname, savename, **kwargs) ######################### ### Signals on 1 plot ### #########################
############################ ### MC based BG estimate ### ############################ for s in samples: plotter.addHistogramToStack(s,sigMap[s]) if not blind: plotter.addHistogram('data',sigMap['data']) for plot in plots: for sel in sels: kwargs = deepcopy(plots[plot]) plotname = '{0}/{1}'.format(sel,plot) savename = '{0}/mc/{1}'.format(sel,plot) plotter.plot(plotname,savename,**kwargs) # ratios of tight/loose as func of pt/eta plotter.clearHistograms() plotter.addHistogram('MC',sigMap['BG']) plotter.addHistogram('Z',sigMap['Z']) plotter.addHistogram('data',sigMap['data'],style={'linecolor':ROOT.kBlack,'name':'Data'}) plotter.addHistogram('data_uncorrected',sigMap['data'],style={'linecolor':ROOT.kRed,'name':'Uncorrected'}) ptbins = [3,5,10,15,20,25,30,50,100] etabins = [-2.4,-1.5,-1.0,0.,1.0,1.5,2.4] cust = { 'mPt' : {'rebin': ptbins, 'overflow': False, 'logy': False}, #'mEta' : {'rebin': etabins},
'GluGluToContinToZZTo4e_13TeV_MCFM701_pythia8', 'GluGluToContinToZZTo4mu_13TeV_MCFM701_pythia8', 'GluGluToContinToZZTo4tau_13TeV_MCFM701_pythia8', 'ZZTo2L2Nu_13TeV_powheg_pythia8', 'ZZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8'], 'VVV' : ['WZZ_TuneCUETP8M1_13TeV-amcatnlo-pythia8'], 'TTV' : ['TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8'], 'ZG' : ['ZGTo2LG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'WW' : ['WWTo2L2Nu_13TeV-powheg'], 'Z' : ['DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8', 'DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'TT' : ['TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'data': ['DoubleMuon', 'DoubleEG', 'MuonEG', 'SingleMuon', 'SingleElectron'], } for s in ['TT','TTV','Z','ZG','WW','VVV','ZZ','WZ']: wzPlotter.addHistogramToStack(s,sigMap[s]) wzPlotter.addHistogram('data',sigMap['data']) plotStyles = { 'zMass': {'xaxis': 'm_{l^{+}l^{#font[122]{\55}}}', 'yaxis': 'Events/1 GeV'}, } for plot in ['zMass']: wzPlotter.plot(plot,plot,**plotStyles[plot])
# runs #'wmMt_Run2016B' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016C' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016D' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016E' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016F' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016G' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, #'wmMt_Run2016H' : {'xaxis': 'm_{T}^{#mu} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': 5}, } for plot in plots: for chan in chans: for region in ['loose','medium','tight']: plotname = '{0}/{1}/{2}'.format(region,chan,plot) savename = '{0}/{1}/{2}'.format(region,chan,plot) fakeratePlotter.plot(plotname,savename,**plots[plot]) #for sel in ['SS','ZVeto','WMt','full']: for sel in ['WVeto','WMt','ZVeto','full']: plotname = '{0}/{1}/{2}/{3}'.format(region,sel,chan,plot) savename = '{0}/{1}/{2}/{3}'.format(region,sel,chan,plot) fakeratePlotter.plot(plotname,savename,**plots[plot]) # ratios of tight/loose as func of pt/eta sigMap['MC'] = [] for sample in ['TTsub','Z','WWsub']: sigMap['MC'] += sigMap[sample] fakeratePlotter.clearHistograms() fakeratePlotter.addHistogram('MC',sigMap['MC']) fakeratePlotter.addHistogram('W',sigMap['W'])
'GluGluToContinToZZTo4e_13TeV_MCFM701_pythia8', 'GluGluToContinToZZTo4mu_13TeV_MCFM701_pythia8', 'GluGluToContinToZZTo4tau_13TeV_MCFM701_pythia8', 'ZZTo2L2Nu_13TeV_powheg_pythia8', 'ZZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8'], 'VVV' : ['WZZ_TuneCUETP8M1_13TeV-amcatnlo-pythia8'], 'TTV' : ['TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8'], 'ZG' : ['ZGTo2LG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'WW' : ['WWTo2L2Nu_13TeV-powheg'], 'Z' : ['DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8', 'DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'TT' : ['TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'data': ['DoubleMuon', 'DoubleEG', 'MuonEG', 'SingleMuon', 'SingleElectron'], 'HppHmm500GeV' : ['HPlusPlusHMinusMinusHTo4L_M-500_13TeV-pythia8'], } for s in ['TT','TTV','Z','ZG','WW','VVV','ZZ','WZ']: hpp4lPlotter.addHistogramToStack(s,sigMap[s]) hpp4lPlotter.addHistogram('HppHmm500GeV',sigMap['HppHmm500GeV']) if not blind: hpp4lPlotter.addHistogram('data',sigMap['data']) for plot in ['hppMass']: hpp4lPlotter.plot(plot,plot,logy=True,numcol=2,legendpos=34)
'yaxis': 'Events / 1 GeV', 'rebin': range(0, 150, 1) }, 'zSubLeadingLeptonEta': { 'xaxis': '|#eta^{Z_{sublead}}|', 'yaxis': 'Events', }, } # signal region for plot in plots: for sign in ['SS', 'OS', 'SS1', 'SS2', 'SSEE', 'SSBB', 'OSEE', 'OSBB']: for chan in chans: plotname = '{0}/{1}/{2}'.format(sign, chan, plot) savename = '{0}/{1}/{2}'.format(sign, chan, plot) chargePlotter.plot(plotname, savename, **plots[plot]) # sum gen matched for plot in plots: for chan in chans: plotnames = {} for sample in samples: plotnames[sample] = [ '{0}/{1}/{2}'.format('SS1', chan, plot), '{0}/{1}/{2}'.format('SS2', chan, plot) ] plotnames['data'] = ['{0}/{1}/{2}'.format('SS', chan, plot)] savename = '{0}/{1}/{2}'.format('SS12', chan, plot) chargePlotter.plot(plotnames, savename, **plots[plot]) # ratios of SS/OS as func of pt/eta
if doNMinusOne and doVBS: plotCounts(wzPlotter, baseDir='default-vbs/{0}'.format(cut), saveDir='vbsNMinusOne/{0}'.format(cut)) for control in controls: if doControls: plotCounts(wzPlotter, saveDir=control, baseDir=control) if doVBS and doControls: plotCounts(wzPlotter, saveDir=control + '-vbs', baseDir=control + '-vbs') if doMC: for plot in plotStyles: plotname = 'default/{0}'.format(plot) savename = 'mc/{0}'.format(plot) wzPlotter.plot(plotname, savename, **plotStyles[plot]) plotname = 'default-vbs/{0}'.format(plot) savename = 'vbs/{0}'.format(plot) if doVBS: wzPlotter.plot(plotname, savename, **plotStyles[plot]) for cut in nMinusOneCuts: plotname = 'default/{0}/{1}'.format(cut, plot) savename = 'nMinusOne/{0}/{1}'.format(cut, plot) if doNMinusOne: wzPlotter.plot(plotname, savename, **plotStyles[plot]) for cut in vbsNMinusOneCuts: plotname = 'default-vbs/{0}/{1}'.format(cut, plot) savename = 'vbsNMinusOne/{0}/{1}'.format(cut, plot) if doNMinusOne and doVBS: wzPlotter.plot(plotname, savename, **plotStyles[plot]) for control in controls: plotname = '{0}/{1}'.format(control, plot)
'legendpos': 34, 'numcol': 3, 'yscale': 1.4, }, # event 'met': { 'xaxis': 'E_{T}^{miss} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': range(0, 200, 5), }, 'metPhi': { 'xaxis': '#phi_{E_{T}^{miss}}', 'yaxis': 'Events', 'rebin': 1, 'numcol': 3, 'legendpos': 34, 'yscale': 1.4, }, } # signal region for region in ['default', 'high', 'low']: for plot in plots: plotname = '{}/{}'.format(region, plot) kwargs = deepcopy(plots[plot]) dyPlotter.plot(plotname, plotname, ratiomin=0.9, ratiomax=1.1, **kwargs)
plotter.clearHistograms() for s in samples: plotter.addHistogramToStack(s,sigMap[s]) if 'lowmass' not in sel and 'highmass' not in sel: for signal in signals: plotter.addHistogram(signal,sigMap[signal],signal=True) if not blind or 'regionA' not in sel or 'lowmass' in sel or 'highmass' in sel: plotter.addHistogram('data',sigMap['data']) for plot in plots: kwargs = deepcopy(plots[plot]) plotname = '{0}/{1}'.format(sel,plot) savename = '{0}/mc/{1}'.format(sel,plot) plotter.plot(plotname,savename,**kwargs) if blind and 'regionA' in sel and 'lowmass' not in sel and 'highmass' not in sel: plotter.addHistogram('data',sigMap['data']) for s in special: for plot in special[s]: kwargs = deepcopy(special[s][plot]) plotname = '{0}/{1}'.format(sel,plot) savename = '{0}/mc/{1}_{2}'.format(sel,plot,s) plotter.plot(plotname,savename,**kwargs) ######################### ### Signals on 1 plot ### ######################### if doDESY: plotter.clearHistograms()
'yaxis': 'Events', 'rebin': 10, 'numcol': 3, 'legendpos': 34 }, 'nJets': { 'xaxis': 'Number of jets (p_{T} > 30 GeV)', 'yaxis': 'Events', 'rebin': 1 }, } # signal region for plot in plots: plotname = 'default/{0}'.format(plot) dyPlotter.plot(plotname, plot, **plots[plot]) for chan in chans: plotname = 'default/{0}/{1}'.format(chan, plot) savename = '{0}/{1}'.format(chan, plot) dyPlotter.plot(plotname, savename, **plots[plot]) # pileup plots pileup = { 'numVertices_60000': { 'xaxis': 'Reconstructed Vertices', 'yaxis': 'Events' }, 'numVertices_61000': { 'xaxis': 'Reconstructed Vertices', 'yaxis': 'Events'
for s in samples: dyPlotter.addHistogramToStack(s,sigMap[s]) dyPlotter.addHistogram('data',sigMap['data']) # plot definitions plots = { # z cand 'zMass' : {'xaxis': 'm_{l^{+}l^{-}} (GeV)', 'yaxis': 'Events / 2 GeV', 'rebin': range(61,121,2), 'logy':1, 'ymin':1000, 'ymax': 1e9, 'legendpos': 34, 'numcol': 3,}, 'zPt' : {'xaxis': 'p_{T}^{l^{+}l^{-}} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': range(0,155,5), }, 'z1Pt' : {'xaxis': 'p_{T}^{Z_{lead}} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': range(25,150,5),}, 'z2Pt' : {'xaxis': 'p_{T}^{Z_{sublead}} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': range(0,150,5),}, 'z1Eta' : {'xaxis': '#eta^{Z_{lead}} (GeV)', 'yaxis': 'Events', 'rebin':1, 'legendpos': 34, 'numcol': 3, 'yscale':1.4, }, 'z2Eta' : {'xaxis': '#eta^{Z_{sublead}} (GeV)', 'yaxis': 'Events', 'rebin':1, 'legendpos': 34, 'numcol': 3, 'yscale':1.4, }, 'z1Iso' : {'xaxis': 'I_{rel.}^{Z_{lead}} (GeV)', 'yaxis': 'Events', 'rebin':1, 'legendpos': 34, 'numcol': 3, 'yscale':1.4, }, 'z2Iso' : {'xaxis': 'I_{rel.}^{Z_{sublead}} (GeV)', 'yaxis': 'Events', 'rebin':1, 'legendpos': 34, 'numcol': 3, 'yscale':1.4, }, # event 'met' : {'xaxis': 'E_{T}^{miss} (GeV)', 'yaxis': 'Events / 5 GeV', 'rebin': range(0,200,5),}, 'metPhi' : {'xaxis': '#phi_{E_{T}^{miss}}', 'yaxis': 'Events', 'rebin': 1, 'numcol': 3, 'legendpos': 34, 'yscale': 1.4, }, } # signal region for region in ['default','high','low']: for plot in plots: plotname = '{}/{}'.format(region,plot) kwargs = deepcopy(plots[plot]) dyPlotter.plot(plotname,plotname,ratiomin=0.9,ratiomax=1.1,**kwargs)
'ZZTo2L2Nu_13TeV_powheg_pythia8', 'ZZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8' ], 'VVV': ['WZZ_TuneCUETP8M1_13TeV-amcatnlo-pythia8'], 'TTV': ['TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8'], 'ZG': ['ZGTo2LG_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'WW': ['WWTo2L2Nu_13TeV-powheg'], 'Z': [ 'DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8', 'DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8' ], 'TT': ['TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8'], 'data': ['DoubleMuon', 'DoubleEG', 'MuonEG', 'SingleMuon', 'SingleElectron'], } for s in ['TT', 'TTV', 'Z', 'ZG', 'WW', 'VVV', 'ZZ', 'WZ']: wzPlotter.addHistogramToStack(s, sigMap[s]) wzPlotter.addHistogram('data', sigMap['data']) plotStyles = { 'zMass': { 'xaxis': 'm_{l^{+}l^{#font[122]{\55}}}', 'yaxis': 'Events/1 GeV' }, } for plot in ['zMass']: wzPlotter.plot(plot, plot, **plotStyles[plot])
'yaxis': 'Events', 'rebin': 10, 'numcol': 3, 'legendpos': 34 }, 'nJets': { 'xaxis': 'Number of jets (p_{T} > 30 GeV)', 'yaxis': 'Events', 'rebin': 1 }, } # signal region for plot in plots: plotname = 'default/{0}'.format(plot) dyPlotter.plot(plotname, plot, ratiomin=0.8, ratiomax=1.2, **plots[plot]) for chan in chans: plotname = 'default/{0}/{1}'.format(chan, plot) savename = '{0}/{1}'.format(chan, plot) dyPlotter.plot(plotname, savename, ratiomin=0.8, ratiomax=1.2, **plots[plot]) # pileup plots pileup = { 'numVertices_60000': { 'xaxis': 'Reconstructed Vertices', 'yaxis': 'Events'
# plot definitions plots = { 'pt' : {'xaxis': 'p_{T} (GeV)', 'yaxis': 'Events/0.5 GeV', 'rebin': 5, 'rangex': [0,150]}, 'eta' : {'xaxis': '#eta', 'yaxis': 'Events', 'rebin': 5, 'rangex': [-2.5,2.5]}, #'met' : {'xaxis': 'E_{T}^{miss} (GeV)', 'yaxis': 'Events/0.2 GeV', 'rebin': 2, 'rangex': [0,200]}, 'wMass' : {'xaxis': 'm_{T}^{l^{+},MET} (GeV)', 'yaxis': 'Events/0.5 GeV', 'rebin': 5, 'rangex': [0,200]}, } # signal region for plot in plots: for lepton in ['loose','medium','tight']: for chan in chans: plotname = '{0}/{1}/{2}'.format(lepton,chan,plot) savename = '{0}/{1}/{2}'.format(lepton,chan,plot) dijetFakeRatePlotter.plot(plotname,savename,**plots[plot]) # plots of multiple ptcuts on same plot dijetFakeRatePlotter.clearHistograms() jetPts = [20,25,30,35,40,45,50] jetPts = [20,30,40,50] dRs = [0.5,0.75,1.,1.25,1.5] jetPtColors = { 10 : ROOT.TColor.GetColor('#000000'), 15 : ROOT.TColor.GetColor('#330000'), 20 : ROOT.TColor.GetColor('#660000'), 25 : ROOT.TColor.GetColor('#800000'), 30 : ROOT.TColor.GetColor('#990000'), 35 : ROOT.TColor.GetColor('#B20000'), 40 : ROOT.TColor.GetColor('#CC0000'),
if doCounts and doMC: plotCounts(wzPlotter,saveDir='mc',baseDir='default') if doVBS: plotCounts(wzPlotter,saveDir='vbs',baseDir='default-vbs') for cut in nMinusOneCuts: if doNMinusOne: plotCounts(wzPlotter,baseDir='default/{0}'.format(cut),saveDir='nMinusOne/{0}'.format(cut)) for cut in vbsNMinusOneCuts: if doNMinusOne and doVBS: plotCounts(wzPlotter,baseDir='default-vbs/{0}'.format(cut),saveDir='vbsNMinusOne/{0}'.format(cut)) for control in controls: if doControls: plotCounts(wzPlotter,saveDir=control,baseDir=control) if doVBS and doControls: plotCounts(wzPlotter,saveDir=control+'-vbs',baseDir=control+'-vbs') if doMC: for plot in plotStyles: plotname = 'default/{0}'.format(plot) savename = 'mc/{0}'.format(plot) wzPlotter.plot(plotname,savename,**plotStyles[plot]) plotname = 'default-vbs/{0}'.format(plot) savename = 'vbs/{0}'.format(plot) if doVBS: wzPlotter.plot(plotname,savename,**plotStyles[plot]) for cut in nMinusOneCuts: plotname = 'default/{0}/{1}'.format(cut,plot) savename = 'nMinusOne/{0}/{1}'.format(cut,plot) if doNMinusOne: wzPlotter.plot(plotname,savename,**plotStyles[plot]) for cut in vbsNMinusOneCuts: plotname = 'default-vbs/{0}/{1}'.format(cut,plot) savename = 'vbsNMinusOne/{0}/{1}'.format(cut,plot) if doNMinusOne and doVBS: wzPlotter.plot(plotname,savename,**plotStyles[plot]) for control in controls: plotname = '{0}/{1}'.format(control,plot) savename = '{0}/{1}'.format(control,plot) if doControls: wzPlotter.plot(plotname,savename,**plotStyles[plot])