xmax = None for hist in sorted(hists): print 'Processing: ', hist, dataName, anaDir ssign, osign = makePlot(hist, weights, wJetScaleSS, wJetScaleOS, options.box, options.mtregion, options.embed) ssQCD, osQCD = getQCD(ssign, osign, dataName) if options.rebin is not None: rebin = int(options.rebin) osQCD.Rebin(rebin) ssQCD.Rebin(rebin) canvas = TCanvas(hist, hist, 750, 700) canvasRatio = TCanvas(hist + '_ratio', hist + '_ratio', 750, 700) canvases.append(canvas) canvases.append(canvasRatio) formatPad(canvas) formatPad(canvasRatio) SSD[hist] = ssQCD OSD[hist] = osQCD histName = os.path.basename(hist) canvas.cd() osQCD.DrawStack('HIST', xmin=xmin, xmax=xmax) savePlot(histName + '_lin.png') gPad.SetLogy() savePlot(histName + '_log.png') gPad.SetLogy(False) gPad.Update() canvasRatio.cd() osQCDRatio = copy.deepcopy(osQCD) OSDR[hist] = osQCDRatio osQCDRatio.DrawRatioStack('HIST',
plot.Hist('bgd1').layer = 1 plot.Hist('bgd2').layer = 2 h4 = TH1F('h4','h4', 100,-5,5) h4.Sumw2() sData.formatHisto(h4) plot._BuildStack(plot.histos) dataModel = plot.stack.totalHist.obj for i in range(0, int(dataModel.GetEntries())): rnd = dataModel.GetRandom() h4.Fill(rnd) plot.AddHistogram('data', h4) plot.Hist('data').stack=False c1 = TCanvas('c1') formatPad(c1) plot.DrawStack('HIST') c2 = TCanvas('c2') formatPad(c2) ratioplot = copy.copy(plot) ratioplot.DrawRatioStack('HIST', ymin=0.6, ymax=1.5) c3 = TCanvas('c3') formatPad(c3) ratio2 = copy.copy(plot) ratio2.DrawDataOverMCMinus1()
plot.Hist('signal').layer = 4 plot.Hist('bgd1').layer = 1 plot.Hist('bgd2').layer = 2 h4 = TH1F('h4', 'h4', 100, -5, 5) h4.Sumw2() sData.formatHisto(h4) plot._BuildStack(plot.histos) dataModel = plot.stack.totalHist.obj for i in range(0, int(dataModel.GetEntries())): rnd = dataModel.GetRandom() h4.Fill(rnd) plot.AddHistogram('data', h4) plot.Hist('data').stack = False c1 = TCanvas('c1') formatPad(c1) plot.DrawStack('HIST') c2 = TCanvas('c2') formatPad(c2) ratioplot = copy.copy(plot) ratioplot.DrawRatioStack('HIST', ymin=0.6, ymax=1.5) c3 = TCanvas('c3') formatPad(c3) ratio2 = copy.copy(plot) ratio2.DrawDataOverMCMinus1()
cfg = imp.load_source( 'cfg', cfgFileName, file) embed = options.embed selComps, weights, zComps = prepareComponents(anaDir, cfg.config) can, pad, padr = buildCanvas() fwss, fwos, ss, os = plot_W_inclusive( var, anaDir, selComps, weights, 30, 60, 300, options.cut, weight=weight, embed=options.embed) iso, antiso = fakePlots( opt, var, anaDir, selComps, weights, fwss, fwos, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed) draw(iso) c2 = TCanvas() formatPad(c2) hfake = fakeRate(opt, iso, antiso) hfake.Draw() if opt == 'ele': h_jose_qcdEleIsoRatio.Draw('same') elif opt == 'tau': h_jose_qcdTauIsoRatio.Draw('same') gPad.SaveAs('fake_{opt}.png'.format(opt=opt)) print histToCutstr(var, hfake.weighted)
300, options.cut, weight=weight, embed=options.embed) iso, antiso = fakePlots(opt, var, anaDir, selComps, weights, fwss, fwos, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed) draw(iso) c2 = TCanvas() formatPad(c2) hfake = fakeRate(opt, iso, antiso) hfake.Draw() if opt == 'mu': h_jose_qcdMuIsoRatio.Draw('same') elif opt == 'tau': h_jose_qcdTauIsoRatio.Draw('same') gPad.SaveAs('fake_{opt}.png'.format(opt=opt)) print histToCutstr(var, hfake.weighted)
file = open(cfgFileName, 'r') cfg = imp.load_source('cfg', cfgFileName, file) selComps, weights = prepareComponents(anaDir, cfg.config) print selComps canvases = [] plots = {} xmin = None xmax = None for hist in sorted(hists): print 'Processing: ', hist, anaDir plot = makePlot(hist, weights, options.box, options.mtregion) if options.rebin is not None: rebin = int(options.rebin) plot.Rebin(rebin) canvas = TCanvas(hist, hist, 750, 700) canvases.append(canvas) formatPad(canvas) plots[hist] = plot histName = os.path.basename(hist) canvas.cd() plot.DrawStack('HIST', xmin=xmin, xmax=xmax) savePlot(histName + '_lin.png') gPad.SetLogy() savePlot(histName + '_log.png') gPad.SetLogy(False) gPad.Update()
for hist in sorted(hists): print 'Processing: ',hist,dataName, anaDir ssign,osign = makePlot( hist, weights, wJetScaleSS, wJetScaleOS, options.box, options.mtregion, options.embed) ssQCD, osQCD = getQCD( ssign, osign, dataName ) if options.rebin is not None: rebin = int( options.rebin ) osQCD.Rebin( rebin ) ssQCD.Rebin( rebin ) canvas = TCanvas( hist, hist, 750, 700) canvasRatio = TCanvas( hist + '_ratio', hist + '_ratio', 750, 700) canvases.append( canvas ) canvases.append( canvasRatio ) formatPad( canvas ) formatPad( canvasRatio ) SSD[hist] = ssQCD OSD[hist] = osQCD histName = os.path.basename( hist ) canvas.cd() osQCD.DrawStack('HIST', xmin=xmin, xmax=xmax ) savePlot( histName + '_lin.png') gPad.SetLogy() savePlot( histName + '_log.png') gPad.SetLogy(False) gPad.Update() canvasRatio.cd() osQCDRatio = copy.deepcopy(osQCD) OSDR[hist] = osQCDRatio osQCDRatio.DrawRatioStack('HIST', xmin=xmin, xmax=xmax, ymin=0.001, ymax=2)
canvases = [] plots = {} xmin = None xmax = None for hist in sorted(hists): print 'Processing: ',hist, anaDir plot = makePlot( hist, weights, options.box, options.mtregion) if options.rebin is not None: rebin = int( options.rebin ) plot.Rebin( rebin ) canvas = TCanvas( hist, hist, 750, 700) canvases.append( canvas ) formatPad( canvas ) plots[hist] = plot histName = os.path.basename( hist ) canvas.cd() plot.DrawStack('HIST', xmin=xmin, xmax=xmax ) savePlot( histName + '_lin.png') gPad.SetLogy() savePlot( histName + '_log.png') gPad.SetLogy(False) gPad.Update()