示例#1
0
dataHisto = RooAbsData.createHistogram(fitter_mWW.ws.data('data_obs'),
                                       'HWW%snujj_data_obs' % mode,
                                       fitter_mWW.ws.var(pars_mWW.var[0]))
dataHisto.SetMarkerStyle(20)
dataHisto.SetName('HWW%snujj_data_obs' % mode)
dataHisto.Draw('same')
dataHisto.Print()
c_bkg.Update()

fitter_mWW.ws.saveSnapshot('nullFitSnapshot', fitter_mWW.ws.allVars())

fitter_mWW.ws.loadSnapshot('nullFitSnapshot')

if opts.obsLimit:
    limit = limits.plcLimit(fitter_mWW.ws.var(pars_mWW.var[0]),
                            fitter_mWW.ws.var('r_signal'),
                            full_pdf, fitter_mWW.ws,
                            fitter_mWW.ws.data('data_obs'))
    
    print '%.0f%% CL upper limit' % (95.), limit['r_signal']['ok'],
    print ': %.4f' % (limit['r_signal']['upper'])
    print '%.0f%% CL lower limit' % (95.), limit['r_signal']['ok'],
    print ': %.4f' % (limit['r_signal']['lower'])

fitter_mWW.ws.loadSnapshot('nullFitSnapshot')

#freeze all parameters in place
#params_mWW.setAttribAll('Constant', True)

import SignalShapeSystematic

allVars = fitter_mWW.ws.allVars()
示例#2
0
comps = RooArgList(theWS.argSet('aTGC_extended,bkg_extended'))
total = RooAddPdf('total', 'total', comps)

getattr(theWS, 'import')(total)
theWS.factory('RooGaussian::bkg_const(bkg_nrm, 1.0, 0.05)')
total_const = theWS.factory('PROD::total_const(total, bkg_const)')

theWS.Print()

total_const.fitTo(data, RooFit.Constrained(), RooFit.Extended())

frame = wpt.frame()
data.plotOn(frame)
total_const.plotOn(frame)
total_const.plotOn(frame, RooFit.Components('bkg*'), RooFit.LineColor(kRed),
                   RooFit.LineStyle(kDashed))
data.plotOn(frame)
frame.Draw()

gPad.Update()
gPad.WaitPrimitive()

poi = RooArgSet(lz, dkg)

limit = limits.plcLimit(wpt, poi, total_const, theWS, data, verbose=True)

#theWS.Print()
fout = TFile('ATGC_likelihood.root', 'recreate')
theWS.Write()
fout.Close()
theWS.factory("RooExtendPdf::aTGC_extended(aTGCPdf,diboson_yield)")
comps = RooArgList(theWS.argSet("aTGC_extended,bkg_extended"))
total = RooAddPdf("total", "total", comps)

getattr(theWS, "import")(total)
theWS.factory("RooGaussian::bkg_const(bkg_nrm, 1.0, 0.05)")
total_const = theWS.factory("PROD::total_const(total, bkg_const)")

theWS.Print()

total_const.fitTo(data, RooFit.Constrained(), RooFit.Extended())

frame = wpt.frame()
data.plotOn(frame)
total_const.plotOn(frame)
total_const.plotOn(frame, RooFit.Components("bkg*"), RooFit.LineColor(kRed), RooFit.LineStyle(kDashed))
data.plotOn(frame)
frame.Draw()

gPad.Update()
gPad.WaitPrimitive()

poi = RooArgSet(lz, dkg)

limit = limits.plcLimit(wpt, poi, total_const, theWS, data, verbose=True)

# theWS.Print()
fout = TFile("ATGC_likelihood.root", "recreate")
theWS.Write()
fout.Close()
示例#4
0
          (expectedLimit['upper'], expectedLimit['upperErr'])
    c_upper = TCanvas('c_upper', 'toy upper limits')
    upperHist.Draw()
    c_upper.Update()

    nquants = upperHist.GetQuantiles(len(qs), qs, probs)
    print 'sensible expected 95%% CL upper limit:',
    print qs
    print 'expected 95%% CL lower limit: %0.4f +/- %0.4f' % \
          (expectedLimit['lower'], expectedLimit['lowerErr'])

fitter_mWW.ws.loadSnapshot('nullFitSnapshot')

if opts.obsLimit:
    limit = limits.plcLimit(fitter_mWW.ws.var(pars_mWW.var[0]),
                            fitter_mWW.ws.var('r_signal'),
                            full_pdf, fitter_mWW.ws,
                            fitter_mWW.ws.data('data_obs'))
    
    print '%.0f%% CL upper limit' % (95.), limit['r_signal']['ok'],
    print ': %.4f' % (limit['r_signal']['upper'])
    print '%.0f%% CL lower limit' % (95.), limit['r_signal']['ok'],
    print ': %.4f' % (limit['r_signal']['lower'])

#freeze all parameters in place
#params_mWW.setAttribAll('Constant', True)

allVars = fitter_mWW.ws.allVars()
allVars.remove(fitter_mWW.ws.set('obsSet'))
varIter = allVars.createIterator()
theVar = varIter.Next()
while theVar: