for plot in ['pt','eta']:
    for num,denom in [('medium','loose'),('tight','loose'),('tight','medium')]:
        kwargs = deepcopy(plots[plot])
        if plot in cust:
            update = deepcopy(cust[plot])
            update['yaxis'] = update['yaxis'].format(num=num,denom=denom)
            kwargs.update(update)
        for chan in chans:
            numname = '{0}/{1}/{2}'.format(num,chan,plot)
            denomname = '{0}/{1}/{2}'.format(denom,chan,plot)
            savename = 'ratio/{0}_{1}/{2}/{3}'.format(num,denom,chan,plot)
            subtractMap = {
                'data': ['MC'],
            }
            customOrder = ['data_uncorrected','data']
            dijetFakeRatePlotter.plotRatio(numname,denomname,savename,ymax=1.,customOrder=customOrder,legendpos=34,numcol=2,subtractMap=subtractMap,**kwargs)
            #for etabin in range(5):
            #    if plot=='eta': continue
            #    if chan=='m' and etabin>1: continue
            #    numname = '{0}/{1}/etaBin{2}/{3}'.format(lepton,chan,etabin,plot)
            #    denomname = 'loose/{0}/etaBin{1}/{2}'.format(chan,etabin,plot)
            #    savename = 'ratio/{0}/{1}/{2}_etabin{3}'.format(lepton,chan,plot,etabin)
            #    dijetFakeRatePlotter.plotRatio(numname,denomname,savename,ymax=1.,customOrder=customOrder,legendpos=34,numcol=2,subtractMap=subtractMap,**kwargs)
            #for jetPt in jetPtBins:
            #    numname = '{0}/{1}/jetPt{2}/{3}'.format(num,chan,jetPt,plot)
            #    denomname = '{0}/{1}/jetPt{2}/{3}'.format(denom,chan,jetPt,plot)
            #    savename = 'ratio/{0}_{1}/{2}/{3}_jetPt{4}'.format(num,denom,chan,plot,jetPt)
            #    dijetFakeRatePlotter.plotRatio(numname,denomname,savename,ymax=1.,customOrder=customOrder,legendpos=34,numcol=2,subtractMap=subtractMap,**kwargs)
            #for dR in dRBins:
            #    numname = '{0}/{1}/dR{2}/{3}'.format(num,chan,dR,plot)
            #    denomname = '{0}/{1}/dR{2}/{3}'.format(denom,chan,dR,plot)
     values_dm_mc[ndm] = {}
     errors_dm_mc[ndm] = {}
 # get the values
 for e in range(len(etaBins) - 1):
     # get the histogram
     numname = name.format(num, e)
     denomname = name.format(denom, e)
     savename = '{0}_{1}'.format(num, denom)
     subtractMap = {
         'data': ['MC'],
     }
     customOrder = ['data']
     hists = fakeratePlotter.plotRatio(numname,
                                       denomname,
                                       savename,
                                       customOrder=customOrder,
                                       subtractMap=subtractMap,
                                       rebin=ptBins,
                                       getHists=True)
     for p in range(len(ptBins) - 1):
         pt = float(ptBins[p] + ptBins[p + 1]) / 2.
         eta = float(etaBins[e] + etaBins[e + 1]) / 2.
         key = (pt, eta)
         values[key] = hists['data'].GetBinContent(p + 1)
         errors[key] = hists['data'].GetBinError(p + 1)
     customOrder = ['W']
     hists_mc = fakeratePlotter.plotRatio(numname,
                                          denomname,
                                          savename,
                                          customOrder=customOrder,
                                          rebin=ptBins,
示例#3
0
for plot in ['Pt','Eta']:
    #for lepton in ['zLeadingLepton','zSubLeadingLepton']:
    for lepton in ['zLeadingLepton']:
        kwargs = deepcopy(plots[lepton+plot])
        kwargsOS = deepcopy(plots[lepton+plot])
        if lepton+plot in ratio_cust: kwargs.update(ratio_cust[lepton+plot])
        if lepton+plot in ratio_cust: kwargsOS.update(ratio_cust[lepton+plot])
        kwargsOS['yaxis'] = 'N_{OS}/N'
        for chan in chans:
            for region in ['','EE','BB']:
                subdirs = '{0}/{1}{2}'.format(chan,lepton,plot)
                numname = 'SS{0}/{1}'.format(region,subdirs)
                denomname = ['OS{0}/{1}'.format(region,subdirs),  'SS{0}/{1}'.format(region,subdirs)]
                savename = 'ratio/{0}/{1}{2}'.format(chan,lepton,plot)
                if region: savename += '_'+region
                chargePlotter.plotRatio(numname,denomname,savename,ymax=0.07,plotratio=True,ratiomin=0.9,ratiomax=1.2,**kwargs)
                ## sum gen matched
                #numname = {}
                #denomname = {}
                #numname['MC'] = ['{0}/{1}/{2}{3}'.format('SS1',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('SS2',chan,lepton,plot)]
                #denomname['MC'] = ['{0}/{1}/{2}{3}'.format('SS1',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('SS2',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('OS',chan,lepton,plot)]
                #numname['data'] = ['{0}/{1}/{2}{3}'.format('SS',chan,lepton,plot)]
                #denomname['data'] = ['{0}/{1}/{2}{3}'.format('SS',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('OS',chan,lepton,plot)]
                #savename = 'ratio/{0}/{1}{2}_genMatched'.format(chan,lepton,plot)
                #chargePlotter.plotRatio(numname,denomname,savename,ymax=0.07,plotratio=True,ratiomin=0.9,ratiomax=1.2,**kwargs)
                # OS
                numname = 'OS{0}/{1}'.format(region,subdirs)
                denomname = ['OS{0}/{1}'.format(region,subdirs),  'SS{0}/{1}'.format(region,subdirs)]
                savename = 'ratio/{0}/{1}{2}_OS'.format(chan,lepton,plot)
                if region: savename += '_'+region
                chargePlotter.plotRatio(numname,denomname,savename,ymin=0.8,ymax=1.2,plotratio=True,ratiomin=0.95,ratiomax=1.05,**kwargsOS)
示例#4
0
 kwargs = deepcopy(plots[plot])
 kwargs.update(cust[plot])
 kwargs['yaxis'] = 'Ratio'
 numname = '{0}/{1}'.format(num, plot)
 denomname = '{0}/{1}'.format(denom, plot)
 savename = 'ratio/{0}_{1}/{2}'.format(num, denom, plot)
 #if '/' in num:
 #    savename = 'ratio/{0}_{1}/{2}'.format(num,denom.split('/')[-1],plot)
 subtractMap = {
     'data': ['MC'],
 }
 customOrder = ['data_uncorrected', 'Z', 'data']
 plotter.plotRatio(numname,
                   denomname,
                   savename,
                   ymax=1.,
                   customOrder=customOrder,
                   subtractMap=subtractMap,
                   **kwargs)
 for eb in range(2):
     kwargs = deepcopy(plots[plot])
     kwargs.update(cust[plot])
     kwargs['yaxis'] = 'Ratio'
     numname = '{0}/etaBin{1}/{2}'.format(num, eb, plot)
     denomname = '{0}/etaBin{1}/{2}'.format(denom, eb, plot)
     savename = 'ratio/{0}_{1}/{2}_etaBin{3}'.format(
         num, denom, plot, eb)
     #if '/' in num:
     #    savename = 'ratio/{0}_{1}/{2}_etaBin{3}'.format(num,denom.split('/')[-1],plot,eb)
     subtractMap = {
         'data': ['MC'],
numDenoms = [('iso0.15','default'),('iso0.25','default'),('iso0.40','default'),('iso0.15','iso0.40'),]
numDenoms += [('iso0.15trig','defaulttrig'),('iso0.25trig','defaulttrig'),('iso0.40trig','defaulttrig'),('iso0.15trig','iso0.40trig'),]
numDenoms += [('mediumiso0.15','mediumdefault'),('mediumiso0.25','mediumdefault'),('mediumiso0.40','mediumdefault'),('mediumiso0.15','mediumiso0.40'),]
numDenoms += [('mediumiso0.15trig','mediumdefaulttrig'),('mediumiso0.25trig','mediumdefaulttrig'),('mediumiso0.40trig','mediumdefaulttrig'),('mediumiso0.15trig','mediumiso0.40trig'),]

for plot in cust:
    for num,denom in numDenoms:
        kwargs = deepcopy(plots[plot])
        kwargs.update(cust[plot])
        kwargs['yaxis'] = 'Ratio'
        numname = '{0}/{1}'.format(num,plot)
        denomname = '{0}/{1}'.format(denom,plot)
        savename = 'ratio/{0}_{1}/{2}'.format(num,denom,plot)
        subtractMap = {
            'data': ['MC'],
        }
        customOrder = ['data_uncorrected','Z','data']
        plotter.plotRatio(numname,denomname,savename,ymax=1.,customOrder=customOrder,subtractMap=subtractMap,**kwargs)
        for eb in range(3):
            kwargs = deepcopy(plots[plot])
            kwargs.update(cust[plot])
            kwargs['yaxis'] = 'Ratio'
            numname = '{0}/etaBin{1}/{2}'.format(num,eb,plot)
            denomname = '{0}/etaBin{1}/{2}'.format(denom,eb,plot)
            savename = 'ratio/{0}_{1}/{2}_etaBin{3}'.format(num,denom,plot,eb)
            subtractMap = {
                'data': ['MC'],
            }
            customOrder = ['data_uncorrected','Z','data']
            plotter.plotRatio(numname,denomname,savename,ymax=1.,customOrder=customOrder,subtractMap=subtractMap,**kwargs)
示例#6
0
    'absDz'         : '|#Delta_{z}|',
    'conversionVeto': 'Pass Conversion Veto',
}

# electrons
for varname in ['wzLoose','wzMedium','wzTight','heepV60','mvaTrigWP80','mvaTrigWP90','mvaNonTrigWP80','mvaNonTrigWP90']:
    plotname = 'electron_{0}'.format(varname)
    num = 'h_{0}_numerator'.format(plotname)
    numFake = 'h_{0}_fake_numerator'.format(plotname)
    numJet = 'h_{0}_jet_numerator'.format(plotname)
    denom = 'h_{0}_denominator'.format(plotname)
    denomJet = 'h_{0}_jet_denominator'.format(plotname)
    denomFake = 'h_{0}_fake_denominator'.format(plotname)
    numMap = {'Z':num, 'TT':numJet, 'QCD': numFake, 'HppHmm500GeV':num}
    denomMap = {'Z':denom, 'TT':denomJet, 'QCD': denomFake, 'HppHmm500GeV':denom}
    effPlotter.plotRatio(numMap,denomMap,plotname,numcol=2,legendpos=34,ymax=1.3,ymin=0.,yaxis='Efficiency',xaxis='p^{e}_{T} (GeV)',rebin=5)
    sigPlotter.plotRatio(num,denom,plotname,numcol=2,legendpos=34,ymax=1.3,ymin=0.,yaxis='Efficiency',xaxis='p^{e}_{T} (GeV)',rebin=5)
for region in ['barrel','endcap']:
    for var in ['pt','sigmaIEtaIEta','absDEtaIn','absDPhiIn','hOverE','relIsoEA','ooEmooP','absDxy','absDz','conversionVeto']:
        varname = 'h_electron_{0}_{1}'.format(var,region)
        effPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],customOrder=['Z','HppHmm500GeV'],logy=0)
        sigPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],logy=0)
for var in ['eta']:
    varname = 'h_electron_{0}'.format(var)
    effPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],customOrder=['Z','HppHmm500GeV'],logy=0)
    sigPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],logy=0)


# muons
for varname in ['wzLoose','wzMedium','highPt_tightiso','tight_tightiso']:
    plotname = 'muon_{0}'.format(varname)
allSamplesDict = {'MC':[]}

for s in samples:
    allSamplesDict['MC'] += sigMap[s]

chargePlotter.addHistogram('MC',allSamplesDict['MC'],style={'linecolor': ROOT.kRed})
chargePlotter.addHistogram('data',sigMap['data'],style={'linecolor':ROOT.kBlack})

ptbins = [10,20,40,60,200]
etabins = [-2.3,-1.479,-0.8,0.,0.8,1.479,2.3]

ratio_cust = {
    'zTauMuPt'   : {'yaxis': 'N_{SS}/N_{OS}', 'rebin': ptbins},
    'zTauMuEta'  : {'yaxis': 'N_{SS}/N_{OS}', 'rebin': etabins},
    'zTauHadPt'  : {'yaxis': 'N_{SS}/N_{OS}', 'rebin': ptbins},
    'zTauHadEta' : {'yaxis': 'N_{SS}/N_{OS}', 'rebin': etabins},
}

for plot in ['Pt','Eta']:
    for lepton in ['zTauMu','zTauHad']:
        kwargs = deepcopy(plots[lepton+plot])
        if lepton+plot in ratio_cust: kwargs.update(ratio_cust[lepton+plot])
        for chan in chans:
            numname = 'SS/mtCut/{0}/{1}{2}'.format(chan,lepton,plot)
            denomname = 'OS/mtCut/{0}/{1}{2}'.format(chan,lepton,plot)
            savename = 'ratio/{0}/{1}{2}'.format(chan,lepton,plot)
            chargePlotter.plotRatio(numname,denomname,savename,ymax=1.,**kwargs)


示例#8
0
    #'{0}_tightElectron_tightMuon_looseIsolation',
    #'{0}_tightElectron_tightMuon_tightIsolation',
    #'{0}_tightElectron_tightMuon_vtightIsolation',
]

binning = [0,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,350,400,450,500,550,600,650,700,800,900,1000]
binning = [0,20,40,60,80,100,120,140,160,180,200,240,300,400,500,600,800,1000]
for idName in idNames:
    num = {
        #'signew': 'default/prompt/{0}/pt'.format(idName.format('new')),
        'sigold': 'default/prompt/{0}/pt'.format(idName.format('old')),
        #'fakenew': 'default/fake/{0}/pt'.format(idName.format('new')),
        'fakeold': 'default/fake/{0}/pt'.format(idName.format('old')),
    }
    denom = {
        #'signew': 'default/prompt/pt',
        'sigold': 'default/prompt/pt',
        #'fakenew': 'default/fake/pt',
        'fakeold': 'default/fake/pt',
    }
    savename = idName.format('tau')
    tPlotter.plotRatio(num,denom,savename,rebin=binning,xaxis='p_{T} (GeV)',numcol=2,ymax=1.2)
    #if 'noIsolation' in idName:
    #    var = {
    #        #'signew': 'default/prompt/{0}/isoMVAold'.format(idName.format('new')),
    #        'sigold': 'default/prompt/{0}/isoMVAold'.format(idName.format('old')),
    #        #'fakenew': 'default/fake/{0}/isoMVAold'.format(idName.format('new')),
    #        'fakeold': 'default/fake/{0}/isoMVAold'.format(idName.format('old')),
    #    }
    #    tPlotter.plotNormalized(var,savename+'_isoMVAold',xaxis='Isolation MVA',numcol=2)
    errors = {}
    values_mc = {}
    errors_mc = {}
    # get the values
    for e in range(len(etaBins)-1):
        # get the histogram
        numname = name.format(num,e)
        denomname = name.format(denom,e)
        savename = '{0}_{1}'.format(num,denom)
        if '/' in denom:
            savename = '{0}_{1}'.format(num,denom.split('/')[-1])
        subtractMap = {
            'data': ['MC'],
        }
        customOrder = ['data']
        hists = fakeratePlotter.plotRatio(numname,denomname,savename,customOrder=customOrder,subtractMap=subtractMap,rebin=ptBins,getHists=True)
        for p in range(len(ptBins)-1):
            pt = float(ptBins[p]+ptBins[p+1])/2.
            eta = float(etaBins[e]+etaBins[e+1])/2.
            key = (pt,eta)
            values[key] = hists['data'].GetBinContent(p+1)
            errors[key] = hists['data'].GetBinError(p+1)
        customOrder = ['Z']
        hists_mc = fakeratePlotter.plotRatio(numname,denomname,savename,customOrder=customOrder,rebin=ptBins,getHists=True)
        for p in range(len(ptBins)-1):
            pt = float(ptBins[p]+ptBins[p+1])/2.
            eta = float(etaBins[e]+etaBins[e+1])/2.
            key = (pt,eta)
            values_mc[key] = hists_mc['Z'].GetBinContent(p+1)
            errors_mc[key] = hists_mc['Z'].GetBinError(p+1)
示例#10
0
]:
    plotname = "electron_{0}".format(varname)
    num = "h_{0}_numerator".format(plotname)
    numFake = "h_{0}_fake_numerator".format(plotname)
    numJet = "h_{0}_jet_numerator".format(plotname)
    denom = "h_{0}_denominator".format(plotname)
    denomJet = "h_{0}_jet_denominator".format(plotname)
    denomFake = "h_{0}_fake_denominator".format(plotname)
    numMap = {"Z": num, "TT": numJet, "QCD": numFake, "HppHmm500GeV": num}
    denomMap = {"Z": denom, "TT": denomJet, "QCD": denomFake, "HppHmm500GeV": denom}
    effPlotter.plotRatio(
        numMap,
        denomMap,
        plotname,
        numcol=2,
        legendpos=34,
        ymax=1.3,
        ymin=0.0,
        yaxis="Efficiency",
        xaxis="p^{e}_{T} (GeV)",
        rebin=5,
    )
    sigPlotter.plotRatio(
        num,
        denom,
        plotname,
        numcol=2,
        legendpos=34,
        ymax=1.3,
        ymin=0.0,
        yaxis="Efficiency",
        xaxis="p^{e}_{T} (GeV)",
示例#11
0
    'absDz'         : '|#Delta_{z}|',
    'conversionVeto': 'Pass Conversion Veto',
}

# electrons
for varname in ['wzLoose','wzMedium','wzTight','heepV60','mvaTrigWP80','mvaTrigWP90','mvaNonTrigWP80','mvaNonTrigWP90']:
    plotname = 'electron_{0}'.format(varname)
    num = 'h_{0}_numerator'.format(plotname)
    numFake = 'h_{0}_fake_numerator'.format(plotname)
    numJet = 'h_{0}_jet_numerator'.format(plotname)
    denom = 'h_{0}_denominator'.format(plotname)
    denomJet = 'h_{0}_jet_denominator'.format(plotname)
    denomFake = 'h_{0}_fake_denominator'.format(plotname)
    numMap = {'Z':num, 'TT':numJet, 'QCD': numFake, 'HppHmm500GeV':num}
    denomMap = {'Z':denom, 'TT':denomJet, 'QCD': denomFake, 'HppHmm500GeV':denom}
    effPlotter.plotRatio(numMap,denomMap,plotname,numcol=2,legendpos=34,ymax=1.3,ymin=0.,yaxis='Efficiency',xaxis='p^{e}_{T} (GeV)',rebin=5)
    sigPlotter.plotRatio(num,denom,plotname,numcol=2,legendpos=34,ymax=1.3,ymin=0.,yaxis='Efficiency',xaxis='p^{e}_{T} (GeV)',rebin=5)
for region in ['barrel','endcap']:
    for var in ['pt','sigmaIEtaIEta','absDEtaIn','absDPhiIn','hOverE','relIsoEA','ooEmooP','absDxy','absDz','conversionVeto']:
        varname = 'h_electron_{0}_{1}'.format(var,region)
        effPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],customOrder=['Z','HppHmm500GeV'],logy=0)
        sigPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],logy=0)
for var in ['eta']:
    varname = 'h_electron_{0}'.format(var)
    effPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],customOrder=['Z','HppHmm500GeV'],logy=0)
    sigPlotter.plotNormalized(varname,varname,legendps=34,yaxis='Unit Normalized',xaxis=xaxisMap[var],logy=0)


# muons
for varname in ['wzLoose','wzMedium','highPt_tightiso','tight_tightiso']:
    plotname = 'muon_{0}'.format(varname)
示例#12
0
ePlotter.addHistogram('sig',sigMap['HppHmm1000GeV'],style={'name': 'Match to gen','linecolor':ROOT.kBlue})
ePlotter.addHistogram('fake',sigMap['QCD'],style={'name':'Fake','linecolor':ROOT.kBlue,'linestyle':2})

idNames = [
    'cutBasedVeto',
    'cutBasedLoose',
    'cutBasedMedium',
    'cutBasedTight',
    'wwLoose',
    'heepV60',
    'NonTrigWP80',
    'NonTrigWP90',
    'TrigPre',
    'TrigWP80',
    'TrigWP90',
]

binning = [0,20,40,60,80,100,120,140,160,180,200,220,240,260,280,300,350,400,450,500,550,600,650,700,800,900,1000]
binning = [0,20,40,60,80,100,120,140,160,180,200,240,300,400,500,600,800,1000]
for idName in idNames:
    num = {
        'sig': 'default/prompt/{0}/pt'.format(idName),
        'fake': 'default/fake/{0}/pt'.format(idName),
    }
    denom = {
        'sig': 'default/prompt/pt',
        'fake': 'default/fake/pt',
    }
    savename = idName
    ePlotter.plotRatio(num,denom,savename,rebin=binning,xaxis='p_{T} (GeV)',numcol=2,ymax=1.2)
 values = {}
 errors = {}
 # get the values
 for e in range(len(yBinning) - 1):
     # get the histogram
     numname = '{0}/{1}/etaBin{2}/pt'.format(num, chan, e)
     denomname = '{0}/{1}/etaBin{2}/pt'.format(denom, chan, e)
     savename = 'filler'
     subtractMap = {
         'data': ['MC'],
     }
     customOrder = ['data']
     hists = dijetFakeRatePlotter.plotRatio(numname,
                                            denomname,
                                            savename,
                                            customOrder=customOrder,
                                            subtractMap=subtractMap,
                                            rebin=xBinning,
                                            getHists=True)
     # get the pt bins
     for p in range(len(xBinning) - 1):
         pt = float(xBinning[p] + xBinning[p + 1]) / 2.
         eta = float(yBinning[e] + yBinning[e + 1]) / 2.
         key = (pt, eta)
         values[key] = hists['data'].GetBinContent(p + 1)
         errors[key] = hists['data'].GetBinError(p + 1)
 # save the values
 savename = 'fakeratePtEta'
 savedir = '{0}/{1}_{2}'.format(chan, num, denom)
 dijetFakeRateMaker.make2D(savename,
                           values,
 xaxis = 'p_{{T}}^{{{0}}}'.format(labelMap[chan])
 yBinning = etaBins[chan]
 yaxis = '|#eta^{{{0}}}|'.format(labelMap[chan])
 values = {}
 errors = {}
 # get the values
 for e in range(len(yBinning)-1):
     # get the histogram
     numname = '{0}/{1}/etaBin{2}/pt'.format(num,chan,e)
     denomname = '{0}/{1}/etaBin{2}/pt'.format(denom,chan,e)
     savename = 'filler'
     subtractMap = {
         'data': ['MC'],
     }
     customOrder = ['data']
     hists = dijetFakeRatePlotter.plotRatio(numname,denomname,savename,customOrder=customOrder,subtractMap=subtractMap,rebin=xBinning,getHists=True)
     # get the pt bins
     for p in range(len(xBinning)-1):
         pt = float(xBinning[p]+xBinning[p+1])/2.
         eta = float(yBinning[e]+yBinning[e+1])/2.
         key = (pt,eta)
         values[key] = hists['data'].GetBinContent(p+1)
         errors[key] = hists['data'].GetBinError(p+1)
 # save the values
 savename = 'fakeratePtEta'
 savedir = '{0}/{1}_{2}'.format(chan,num,denom)
 dijetFakeRateMaker.make2D(savename,values,errors,xBinning,yBinning,savedir=savedir,xaxis=xaxis,yaxis=yaxis)
 # jet Pt change
 #for jetPt in jetPtBins:
 #    values = {}
 #    errors = {}
示例#15
0
     kwargsOS.update(ratio_cust[lepton + plot])
 kwargsOS['yaxis'] = 'N_{OS}/N'
 for chan in chans:
     for region in ['', 'EE', 'BB']:
         subdirs = '{0}/{1}{2}'.format(chan, lepton, plot)
         numname = 'SS{0}/{1}'.format(region, subdirs)
         denomname = [
             'OS{0}/{1}'.format(region, subdirs),
             'SS{0}/{1}'.format(region, subdirs)
         ]
         savename = 'ratio/{0}/{1}{2}'.format(chan, lepton, plot)
         if region: savename += '_' + region
         chargePlotter.plotRatio(numname,
                                 denomname,
                                 savename,
                                 ymax=0.07,
                                 plotratio=True,
                                 ratiomin=0.9,
                                 ratiomax=1.2,
                                 **kwargs)
         ## sum gen matched
         #numname = {}
         #denomname = {}
         #numname['MC'] = ['{0}/{1}/{2}{3}'.format('SS1',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('SS2',chan,lepton,plot)]
         #denomname['MC'] = ['{0}/{1}/{2}{3}'.format('SS1',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('SS2',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('OS',chan,lepton,plot)]
         #numname['data'] = ['{0}/{1}/{2}{3}'.format('SS',chan,lepton,plot)]
         #denomname['data'] = ['{0}/{1}/{2}{3}'.format('SS',chan,lepton,plot), '{0}/{1}/{2}{3}'.format('OS',chan,lepton,plot)]
         #savename = 'ratio/{0}/{1}{2}_genMatched'.format(chan,lepton,plot)
         #chargePlotter.plotRatio(numname,denomname,savename,ymax=0.07,plotratio=True,ratiomin=0.9,ratiomax=1.2,**kwargs)
         # OS
         numname = 'OS{0}/{1}'.format(region, subdirs)
         denomname = [