noNeg2P2F = {} noNeg3P1F = {} redBkg = {} init2P2F_noCor = {} init3P1F_noCor = {} sigSub2P2F_noCor = {} sigSub3P1F_noCor = {} noNeg2P2F_noCor = {} noNeg3P1F_noCor = {} redBkg_noCor = {} for channel in ['eeee', 'eemm', 'mmmm']: cr3P1F = plotter.makeHist('3P1F', '3P1F', channel, var, '', bins, weights=cr3PScale[channel], perUnitWidth=False, nameForLegend='\\text{Z/WZ+X}', isBackground=True) cr2P2F = plotter.makeHist('2P2F', '2P2F', channel, var, '', bins, weights=cr2PScale[channel], perUnitWidth=False, nameForLegend='\\text{Z/WZ+X}', isBackground=True) cr3P1F.sumw2() cr2P2F.sumw2() init2P2F[channel] = Hist(cr2P2F, name='CR2P2F_{}'.format(channel)) init2P2F[channel].Write() init3P1F[channel] = Hist(cr3P1F, name='CR3P1F_{}'.format(channel))
if channel != 'zz': chEnding = '_%s'%channel if channel == 'zz': particles = '4\\ell' elif channel == 'eeee': particles = '4e' elif channel == 'eemm': particles = '2e2\\mu' elif channel == 'mmmm': particles = '4\\mu' if noBKG: extraBkgs = [] else: cr3P1F = plotter.makeHist('3P1F', '3P1F', channel, var, constSelection, bins, weights=cr3PScale[channel], perUnitWidth=False, nameForLegend='Z/WZ+X', isBackground=True) cr2P2F = plotter.makeHist('2P2F', '2P2F', channel, var, constSelection, bins, weights=cr2PScale[channel], perUnitWidth=False, nameForLegend='Z/WZ+X', isBackground=True) # print '\n', channel, ":" # print " Init:" # print " 3P1F: %f 2P2F: %f"%(cr3P1F.Integral(), cr2P2F.Integral()) cr3P1F.sumw2() cr2P2F.sumw2()
elif channel == "eeee": particles = "4e" elif channel == "eemm": particles = "2e2\\mu" elif channel == "mmmm": particles = "4\\mu" if noBKG: extraBkgs = [] else: cr3P1F = plotter.makeHist( "3P1F", "3P1F", channel, var, constSelection, bins, weights=cr3PScale[channel], perUnitWidth=False, nameForLegend="Z/WZ+X", isBackground=True, ) cr2P2F = plotter.makeHist( "2P2F", "2P2F", channel, var, constSelection, bins, weights=cr2PScale[channel], perUnitWidth=False,
} objectTextL = { 'z' : '\\ell', 'ze' : 'e\\,', 'zm' : '\\mu', } for z, objects in objectsZ.iteritems(): channel = [channels[lep] for lep in objectsZ[z]] weight = [mcWeight[lep] for lep in objectsZ[z]] s = plotter.makeCategoryStack('mc', channel, '1.', '', [1,0.,2.], 1., weight) h = plotter.makeHist('data', 'data', channel, '1.', '', [1,0.,2.]) mcScale = h.GetEntries() / s.GetStack().Last().Integral() # print z, mcScale # continue for var, bins in binningZ.iteritems(): variables = [varTempsZ[lep]%var for lep in objectsZ[z]] weight = [('%f*'%mcScale)+mcWeight[lep] for lep in objectsZ[z]] plotter.fullPlot('%s%s'%(z, var), channel, variables, '', bins, 'mc', 'data', canvasX=1000, logy=False, xTitle=xTitlesZ[var]%objectTextZ[z], xUnits=units[var], outFile='%s%s.png'%(z,var), mcWeights=weight,