Beispiel #1
0
from datasets import allsamples
from plotstyle import SimpleCanvas
import config
import utils

ROOT.RooMsgService.instance().setGlobalKillBelow(ROOT.RooFit.ERROR)
ROOT.gROOT.LoadMacro(basedir + '/../common/MultiDraw.cc+')

#targs = allsamples.getmany(['sph-16b-m', 'sph-16c-m', 'sph-16d-m'])
targs = allsamples.getmany(['sph-16*-m'])
dataLumi = sum(s.lumi for s in targs)

### Canvas
from plotstyle import SimpleCanvas
canvas = SimpleCanvas()
canvas.lumi = dataLumi


### Make templates
# Visualization
def plotHist(hist):
    canvas.addHistogram(hist)
    canvas.xtitle = '#phi\''
    canvas.printWeb('monophoton/halo', hist.GetName(), logy=False)
    canvas.Clear()


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

templates = {}
trees = {}
Beispiel #2
0
    fitter = ROOT.EfficiencyFitter.singleton()

canvas = SimpleCanvas()
canvas.legend.setPosition(0.7, 0.3, 0.9, 0.5)

for omname in omnames:
    oname = omname[0]
    mname = omname[1]
    print oname, mname

    source = ROOT.TFile.Open(outDir + '/trigger_efficiency_%s_%s.root' %
                             (oname, mname))

    snames, region, probeSel, colname = measurements[(oname, mname)]

    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()
Beispiel #3
0
    leaf.setConstant(True)

### MC flat distribution
# draw
mcTree = ROOT.TChain('events')
mcTree.Add(config.skimDir + '/znng-130_monoph.root')
mcTree.Draw(phimpipi + '>>mcTemp(40,-{pi},{pi})'.format(pi = math.pi), 'photons.scRawPt[0] > 175. && t1Met.met > 170. && t1Met.minJetDPhi > 0.5 && t1Met.photonDPhi > 2.', 'goff')

mcTemp = ROOT.gDirectory.Get('mcTemp')
mcTemp.SetLineColor(ROOT.kBlack)
mcTemp.SetLineWidth(2)
mcTemp.SetTitle(';#phi\'')

lumi = canvas.lumi
canvas.lumi = -1.
canvas.addHistogram(mcTemp)
canvas.printWeb('monophoton/halo', 'mcTemp', logy = False)
canvas.Clear()
canvas.lumi = lumi

### fit to candidates

# candidate phi values
nTarg = candTree.Draw(phivar, 'photons.scRawPt[0] > 175. && t1Met.met > 170. && t1Met.minJetDPhi > 0.5 && t1Met.photonDPhi > 2.', 'goff')
print nTarg, 'target events'

# dump into a RooDataSet
targData = ROOT.RooDataSet('targ', 'targ', phiset)
targPhi = candTree.GetV1()
for iTarg in range(nTarg):