Esempio n. 1
0
def getit(fn):
    f = ROOT.TFile(fn)
    t = f.Get('mfvMiniTree/t')
    hr = draw_hist_register(t, True)
    h,n = hr.draw('weight', 'nvtx>=2', binning='1,0,1', get_n=True, goff=True)
    i = get_integral(h)[0]
    d = Samples.norm_from_file(f)
    e,l,u = clopper_pearson(i, d)
    ee = (u-l)/2
    return e,ee,i,d
Esempio n. 2
0
def getit(fn):
    f = ROOT.TFile(fn)
    t = f.Get('mfvMiniTree/t')
    hr = draw_hist_register(t, True)
    h, n = hr.draw('weight',
                   'nvtx>=2' +
                   ('&& genmatch0 && genmatch1' if req_genmatch else ''),
                   binning='1,0,1',
                   get_n=True,
                   goff=True)
    #i = get_integral(h)[0]
    #c = i/n
    d = Samples.norm_from_file(f)
    e, l, u = clopper_pearson(n, d)
    ee = (u - l) / 2
    return e, ee, n, d
Esempio n. 3
0
                size=(600, 600),
                pdf=True,
                log=False)

multijet = Samples.mfv_signal_samples_2017
dijet = Samples.mfv_stopdbardbar_samples_2017

for sample in multijet + dijet:
    fn = os.path.join('/uscms_data/d2/tucker/crab_dirs/MiniTree%s' % version,
                      sample.name + '.root')
    if not os.path.exists(fn):
        print 'no', sample.name
        continue
    f = ROOT.TFile(fn)
    t = f.Get('mfvMiniTree/t')
    hr = draw_hist_register(t, True)
    cut = 'nvtx>=2'  # && svdist > 0.04'
    h = hr.draw('weight', cut, binning='1,0,1', goff=True)
    num, _ = get_integral(h)
    den = Samples.norm_from_file(f)
    sample.y, sample.yl, sample.yh = clopper_pearson(
        num, den)  # ignore integral != entries, just get central value right
    print '%26s: efficiency = %.3f (%.3f, %.3f)' % (sample.name, sample.y,
                                                    sample.yl, sample.yh)

per = PerSignal('efficiency', y_range=(0., 1.05))
per.add(multijet, title='#tilde{N} #rightarrow tbs')
per.add(dijet, title='#tilde{t} #rightarrow #bar{d}#bar{d}', color=ROOT.kBlue)
per.draw(canvas=ps.c)
ps.save('sigeff')