Exemplo n.º 1
0
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')

canvas.xtitle = vtitle
canvas.ylimits = (0., 1.2)

canvas.Update()

if type(binning) is tuple:
    canvas.addLine(binning[0], 1., binning[2], 1.)
    eff.GetXaxis().SetLimits(binning[1], binning[2])
else:
    canvas.addLine(binning[0], 1., binning[-1], 1.)
    eff.GetXaxis().SetLimits(binning[0], binning[-1])

eff.GetYaxis().SetRangeUser(0., 1.2)

canvas.printWeb('trigger', vname + '_' + tname + '_' + sname + '_' + oname, logy = False)

func = None
marker = None

if vname == 'pt' and (tname == 'l1' or tname == 'l1hlt') and sname == 'jht':
    func = work.factory('PolyVar::func(x, {intercept[1.04,0.,2.], slope[-0.001,-0.01,0.]})')
    params = ROOT.RooArgList(work.arg('intercept'), work.arg('slope'))
Exemplo n.º 2
0
canvas.xtitle = binningTitle
canvas.printWeb('efake', 'frate_' + dataType + '_' + binningName, logy = False)

for iBin, (binName, cut) in enumerate(fitBins):
    print '%15s [%.3f +- %.3f (stat.) +- %.3f (syst.)] x 10^{-2}' % (binName, contents[iBin] * 100., staterrs[iBin] * 100., systerrs[iBin] * 100.)

if toyUncert and binningName == 'pt':
    binName = 'pt_100_6500'
    for conf in ['ee', 'eg']:
        canvas.Clear(full = True)
        canvas.ylimits = (0., 0.05)
        canvas.xtitle = 'N_{Z}'

        toydist = toydists[binName][conf]
        toydist.Scale(1. / toydist.GetSumOfWeights())

        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)
        canvas.legend.add('nominal', title = 'Nominal', opt = 'L', color = ROOT.kBlack, lwidth = 2)

        canvas.legend.apply('toys', toydist)

        canvas.addHistogram(toydist, drawOpt = 'HIST')
        arrow = canvas.addLine(nominal[conf][binName], toydist.GetMaximum() * 0.2, nominal[conf][binName], 0., width = 2, cls = ROOT.TArrow)

        canvas.legend.apply('nominal', arrow)

        canvas.printWeb('efake', 'toys_' + dataType + '_' + conf + '_' + binName, logy = False)

outputFile.Close()
Exemplo n.º 3
0
        graph.SetPoint(iX - 1, cent.GetXaxis().GetBinCenter(iX), y)
        graph.SetPointError(iX - 1, binw * 0.5, binw * 0.5,
                            up.GetBinContent(iX) - y,
                            y - down.GetBinContent(iX))
        bars.SetPoint(iX - 1, cent.GetXaxis().GetBinCenter(iX), y)
        bars.SetPointError(iX - 1, binw * 0.5, 0.)

        cent.SetBinError(iX, 0.)

    canvas.legend.apply(hname, cent)
    canvas.legend.apply(hname, bars)
    canvas.legend.apply(hname, graph)

    cent.GetXaxis().SetTitle('p_{T}^{#gamma} (GeV)')
    cent.GetYaxis().SetTitle('#sigma_{QCD}^{NNLO} / #sigma^{LO}')

    canvas.addHistogram(cent, drawOpt='EP')
    canvas.addHistogram(graph, drawOpt='2')
    canvas.addHistogram(bars, drawOpt='EZ')

canvas.addLine(cent.GetXaxis().GetXmin(),
               1.,
               cent.GetXaxis().GetXmax(),
               1.,
               style=ROOT.kDashed)

canvas.ylimits = (0.8, 1.8)

canvas.printWeb('kfactor', 'zgwg', logy=False)
canvas.Clear()
Exemplo n.º 4
0
                if nompset.find('tpconf').getLabel() == conf and nompset.find(
                        'binName').getLabel() == bin:
                    break
            else:
                raise RuntimeError('Nom pset for ' + suffix + ' not found')

            nZ = nompset.find('nZ').getVal()

            toydist = toydists[bin][conf]
            toydist.Scale(1. / toydist.GetSumOfWeights())

            canvas.legend.apply('toys', toydist)

            canvas.addHistogram(toydist, drawOpt='HIST')
            canvas.Update(logy=False)
            arrow = canvas.addLine(nZ,
                                   toydist.GetMaximum() * 0.2,
                                   nZ,
                                   0.,
                                   width=2,
                                   cls=ROOT.TArrow)
            arrow.SetArrowSize(0.1)

            canvas.legend.apply('nominal', arrow)

            canvas.printWeb('efake/toys_' + binningName,
                            dataType + '_' + conf + '_' + bin,
                            logy=False)

outputFile.Close()
Exemplo n.º 5
0
        canvas.addHistogram(sf, drawOpt='EP')

        if tname + '_' + vname == fit_targ:
            func = ROOT.TF1('fitfunc', formula, *fit_range)
            if len(params) > 1:
                func.SetParameters(*params)
            else:
                func.SetParameter(0, params[0])
            sf.Fit(func, "", "", *fit_range)
            canvas.addHistogram(func, drawOpt='')

        canvas.xtitle = vtitle
        canvas.ylimits = (0.8, 1.2)

        canvas.Update()

        if type(binning) is tuple:
            canvas.addLine(binning[0], 1., binning[2], 1., style=ROOT.kDashed)
            sf.GetXaxis().SetLimits(binning[1], binning[2])
        else:
            canvas.addLine(binning[0], 1., binning[-1], 1., style=ROOT.kDashed)
            sf.GetXaxis().SetLimits(binning[0], binning[-1])

        sf.GetYaxis().SetRangeUser(0.8, 1.2)

        canvas.printWeb(outName,
                        'sf_' + oname + '_' + mname1 + '_' + mname2 + '_' +
                        tname + '_' + vname,
                        logy=False)
Exemplo n.º 6
0
tree.Add('/scratch5/yiiyama/hist/triggertree/t2mit/filefi/042/' + allsamples['sph-d4'].directory + '/l1t_*.root')

binning = array.array('d', [30. + 5. * x for x in range(14)] + [100. + 10. * x for x in range(10)] + [200. + 20. * x for x in range(5)])

passing = ROOT.TH1D('passing', ';p_{T}^{#gamma} (GeV)', len(binning) - 1, binning)
denom = ROOT.TH1D('denom', ';p_{T}^{#gamma} (GeV)', len(binning) - 1, binning)

tree.Draw('pt>>denom')
tree.Draw('pt>>passing', 'l1dr2 < 0.25')

eff = ROOT.TGraphAsymmErrors(passing, denom)

canvas = SimpleCanvas(lumi = allsamples['sph-d3'].lumi + allsamples['sph-d4'].lumi)
canvas.legend.setPosition(0.7, 0.3, 0.9, 0.5)
canvas.legend.add('eff', title = 'L1 seed', opt = 'LP', color = ROOT.kBlack, mstyle = 8)

canvas.SetGrid()

canvas.legend.apply('eff', eff)

canvas.addHistogram(eff, drawOpt = 'EP')
canvas.addLine(0., 1., 300., 1.)
eff.GetXaxis().SetLimits(0., 300.)

canvas.xtitle = 'p_{T}^{#gamma} (GeV)'
canvas.ytitle = 'L1 seed eff.'

canvas.ylimits = (0., 1.2)

canvas.printWeb('trigger', 'l1seed', logy = False)
Exemplo n.º 7
0
            if y > 5.:
                y = 5.
            if y < -5.:
                y = -5.

            graph.SetPoint(ip, x, y)

        graph.SetTitle('')

        outputFile.cd()
        graph.Write('%s_%s' % (sigs, faken))

        graphs.append(graph)

        canvas.legend.apply('n%s' % faken, graph)
        canvas.addHistogram(graph, drawOpt='P')

    canvas.addLine(-5., 0., 5., 0., style=ROOT.kDashed)
    canvas.addLine(0., -5., 0., 5., style=ROOT.kDashed)
    canvas.xlimits = (-5., 5.)
    canvas.ylimits = (-5., 5.)

    canvas.title = '#sigma#timesBR = %.2f' % mu
    canvas.xtitle = 'Fake E_{T}^{miss}: (N_{fit} - N_{true})/#sigma_{fit}'
    canvas.ytitle = 'Signal: (N_{fit} - N_{true})/#sigma_{fit}'

    canvas.printWeb('monophoton/fakemet', sourceName + '_' + sigs, logy=False)
    canvas.Clear()

outputFile.Close()
Exemplo n.º 8
0
            if x > 2.:
                x = 2.
            if y > 2.:
                y = 2.

            graph.SetPoint(ip, x, y)

        graph.SetTitle('')

        outputFile.cd()
        graph.Write('%s_%s' % (sigs, faken))

        graphs.append(graph)

        canvas.legend.apply('n%s' % faken, graph)
        canvas.addHistogram(graph, drawOpt='P')

    canvas.addLine(0., 1., 2., 1., style=ROOT.kDashed)
    canvas.addLine(1., 0., 1., 2., style=ROOT.kDashed)
    canvas.xlimits = (0., 2.)
    canvas.ylimits = (0., 2.)

    canvas.title = '#sigma#timesBR = %.2f' % mu
    canvas.xtitle = 'Fake E_{T}^{miss} extracted / injected'
    canvas.ytitle = 'Signal extracted / injected'

    canvas.printWeb('monophoton/fakemet', sigs, logy=False)
    canvas.Clear()

outputFile.Close()