예제 #1
0
파일: eff.py 프로젝트: yiiyama/MonoX
    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)
예제 #2
0
                     color=ROOT.kRed,
                     mstyle=8)
effCanvas.legend.add('monoph',
                     title='Z#gamma MC',
                     opt='LP',
                     color=ROOT.kBlue,
                     mstyle=4)
effCanvas.legend.add('sf',
                     title='2#mu data/MC',
                     opt='LP',
                     color=ROOT.kBlack,
                     mstyle=34,
                     lwidth=2)
effCanvas.legend.setPosition(0.7, 0.7, 0.9, 0.9)
effCanvas.ylimits = (0.9, 1.05)
effCanvas.SetGrid(True)

# plot configs
configs = {
    'incl': ('0.5', '', (1, 0., 1.)),
    'njet': ('jets.size', 'N_{jet}', (8, 0., 8.)),
    'ht': ('Sum$(jets.pt_)', 'H_{T} (GeV)',
           [100. * x for x in range(5)] + [500., 700., 900., 1200., 2000.]),
    'npv': ('npv', 'N_{vtx}', (20, 0., 40.))
}

outputFile = ROOT.TFile.Open(config.histDir + '/veto_eff/veto_eff.root',
                             'recreate')

for name, config in configs.items():
    expr, title, binning = config
예제 #3
0
파일: sf_compute.py 프로젝트: sraman2/MonoX
outputFile.cd()
scaleFactor.Write()
sfTruth.Write()
dataEff.Write('dataEff')
mcEff.Write('mcEff')
mcTruthEff.Write('mcTruthEff')

### Visualize

lumi = sum(allsamples[s].lumi for s in lumiSamples)

# scaleFactor.SetMaximum(1.05)

canvas = SimpleCanvas(lumi = lumi)
canvas.SetGrid(False, True)
canvas.legend.setPosition(0.7, 0.8, 0.9, 0.9)

canvas.legend.add('sf', 'Scale Factor', opt = 'LP', color = ROOT.kBlack, mstyle = 8)
canvas.legend.add('sf_truth', 'MC truth', opt = 'LP', color = ROOT.kGreen, mstyle = 4)
canvas.ylimits = (0.9, 1.10)

canvas.legend.apply('sf_truth', sfTruth)
canvas.addHistogram(sfTruth, drawOpt = 'EP')

canvas.legend.apply('sf', scaleFactor)
canvas.addHistogram(scaleFactor, drawOpt = 'EP')

if ADDFIT:
    flat = ROOT.TF1('flat', '[0]', scaleFactor.GetXaxis().GetXmin(), scaleFactor.GetXaxis().GetXmax())
    flat.SetParameter(0, 1.)
예제 #4
0
import ROOT

dma = []
dmv = []

for name in allsamples.names():
    matches = re.match('dm([av])-([0-9]+)-([0-9]+)', name)
    if matches:
        if matches.group(1) == 'a':
            dma.append((float(matches.group(2)), float(matches.group(3))))
        else:
            dmv.append((float(matches.group(2)), float(matches.group(3))))

canvas = SimpleCanvas(cms = False)
canvas.SetGrid(True)

gdma = ROOT.TGraph(len(dma))
for iP, (med, dm) in enumerate(dma):
    gdma.SetPoint(iP, med, dm)

gdma.SetTitle('DMA;M_{med} (GeV);M_{DM} (GeV)')
gdma.SetMarkerStyle(21)

canvas.addHistogram(gdma, drawOpt = 'P')
canvas.printWeb('signal_points', 'dma', logx = True)

canvas.Clear()
canvas.SetGrid(True)

gdmv = ROOT.TGraph(len(dmv))