canvas.lumi = sum(sample.lumi for sample in allsamples.getmany(snames)) for tname, (_, _, title, variables) in confs[oname].items(): if len(omname) > 2 and tname != omname[2]: continue print ' ', tname trigDir = source.GetDirectory(tname) for vname, (vtitle, _, _, binning) in variables.items(): print ' ', vname eff = trigDir.Get(vname + '_eff') canvas.Clear() canvas.SetGrid() canvas.legend.Clear() if title: canvas.legend.add('eff', title=title, opt='LP', color=ROOT.kBlack, mstyle=8) canvas.legend.apply('eff', eff) else: eff.SetMarkerColor(ROOT.kBlack) eff.SetMarkerStyle(8) canvas.addHistogram(eff, drawOpt='EP', clone=False)
if name == 'ht': monophHt = monophDist # znng efficiency monophEff = eff.Clone('monoph_' + eff.GetName()) effCanvas.legend.apply('monoph', monophEff) mcMonoph.Draw( 'electrons.size == 0 && muons.size == 0:' + expr + '>>' + monophEff.GetName(), weight, 'prof goff') # print plots distCanvas.addHistogram(dataDist, drawOpt='HIST') distCanvas.addHistogram(mumugDist, drawOpt='HIST') distCanvas.addHistogram(monophDist, drawOpt='HIST') distCanvas.printWeb('veto_eff', 'dist_' + name) distCanvas.Clear() effCanvas.addHistogram(dataEff, drawOpt='EP') effCanvas.addHistogram(mumugEff, drawOpt='EP') if name == 'incl': effCanvas.addHistogram(datajetEff, drawOpt='EP') effCanvas.addHistogram(mumugjetEff, drawOpt='EP') effCanvas.addHistogram(monophEff, drawOpt='EP') effCanvas.addHistogram(sf, drawOpt='P') effCanvas.printWeb('veto_eff', 'eff_' + name, logy=False) effCanvas.Clear() effCanvas.SetGrid(True) # save histograms outputFile.cd()
for iX in range(hnominal.GetNbinsX() + 2): if ROOT.TMath.IsNaN(hnominal.GetBinContent(iX)) or ROOT.TMath.IsNaN(hnominal.GetBinError(iX)): print hnominal.GetName(), 'cannot be plotted because it contains NaN' plot = False break if huncert and (ROOT.TMath.IsNaN(huncert.GetBinContent(iX)) or ROOT.TMath.IsNaN(huncert.GetBinError(iX))): print huncert.GetName(), 'cannot be plotted because it contains NaN' plot = False break if not plot: continue canvas1.legend.apply('stat', hnominal) if huncert: canvas1.Clear() canvas1.legend.apply('total', huncert) canvas1.addHistogram(huncert, drawOpt = 'E2') canvas1.addHistogram(hnominal, drawOpt = 'EP') canvas1.printWeb(plotDir, hnominal.GetName(), logy = not proc.startswith('tf_')) else: canvas2.Clear() canvas2.addHistogram(hnominal, drawOpt = 'EP') canvas2.printWeb(plotDir, hnominal.GetName(), logy = not proc.startswith('tf_')) rcanvas = RatioCanvas(name = 'datamc', lumi = 36400) rcanvas.legend.setPosition(0.7, 0.7, 0.9, 0.9)
logy=False) for iBin, (bin, _) in enumerate(fitBins): if dataType == 'mc': print '%15s [%.3f +- %.3f (stat.) +- %.3f (syst.)] x 10^{-2} (mc %.3f)' % ( bin, result.GetBinContent(iBin + 1) * 100., staterrs[iBin] * 100., systerrs[iBin] * 100., trueResult.GetBinContent(iBin + 1) * 100.) else: print '%15s [%.3f +- %.3f (stat.) +- %.3f (syst.)] x 10^{-2}' % ( bin, result.GetBinContent(iBin + 1) * 100., staterrs[iBin] * 100., systerrs[iBin] * 100.) if uncSource: for conf in meas: for bin, _ in fitBins: canvas.Clear(full=True) canvas.ylimits = (0., 0.1) canvas.xtitle = '(N_{Z}^{toy}-N_{Z}^{orig})/N_{Z}^{orig}' canvas.legend.setPosition(0.7, 0.7, 0.9, 0.9) canvas.legend.add('toys', title='Toys', opt='LF', color=ROOT.kBlue - 7, lwidth=2, fstyle=3003) for ip in range(nomparams.numEntries()): nompset = nomparams.get(ip) if nompset.find('tpconf').getLabel() == conf and nompset.find( 'binName').getLabel() == bin:
dataHist.GetXaxis().SetTitle('#Delta#phi(#gamma, E_{T}^{miss})') dataHist.GetYaxis().SetTitle( '(E_{55}^{#gamma} - E_{T}^{#gamma}) / E_{T}^{miss}') dataHist.Sumw2() dataTree.Draw( yString + ":" + xString + ">>" + sample, '(photons.pt[0] > 175. && t1Met.minJetDPhi > 0.5 && t1Met.met > 170.)', 'goff') ColorGrad() canvas.addHistogram(dataHist, drawOpt='COLZ TEXT') canvas.printWeb('monophoton/phoMet', 'DiffVsPhi' + '_' + sample, logy=False) canvas.Clear(xmax=0.90) dataTree = ROOT.TChain('events') dataTree.Add('/scratch5/ballen/hist/monophoton/skim/sph-d*_monoph.root') xString = "photons.eta[0]" yString = "photons.phi[0]" dataHist = ROOT.TH2D("lego", "", 30, -1.5, 1.5, 30, -math.pi, math.pi) dataHist.GetXaxis().SetTitle('#eta') dataHist.GetYaxis().SetTitle('#phi') dataHist.Sumw2() dataTree.Draw( yString + ":" + xString + ">>lego", 'photons.pt[0] > 175. && t1Met.minJetDPhi > 0.5 && t1Met.met > 170. && t1Met.photonDPhi < 2.', 'goff')