コード例 #1
0
print '***** nll = ',nll,' ***** \n'
print 'total yield: {0:0.0f} +/- {1:0.0f}'.format(totalYield, sqrt(sig2))

# assert(False)

cWpJ = TCanvas('cWpJ', 'W+jets shape')
pars4 = config.the4BodyConfig(fitterPars, opts.mH, opts.syst, opts.alpha)
pars4.mHiggs = opts.mH
pars4.wHiggs = HWWSignalShapes.HiggsWidth[opts.mH]
pars4.initParamsFile = sigYieldFilename
fitter4 = RooWjjMjjFitter(pars4)

fitter4.makeFitter((opts.ParamWpJ>=0))
fitter4.loadData()
fitter4.make4BodyPdf(theFitter)
fitter4.loadParameters(sigYieldFilename)

## assert(False)

mf4 = fitter4.stackedPlot(False, RooWjjMjjFitter.mlnujj)
mf4.SetName("Mlvjj_Stacked")
## sf4 = fitter4.residualPlot(mf4, "h_background", "dibosonPdf", False)
# pf4 = fitter4.residualPlot(mf4, "h_total", "", True)
pf4 = pulls.createPull(mf4.getHist('theData'), mf4.getCurve('h_total'))
pf4.SetName("Mlvjj_Pull")
lf4 = fitter4.stackedPlot(True, RooWjjMjjFitter.mlnujj)
lf4.SetName("Mlvjj_log")

fitUtils = RooWjjFitterUtils(pars4)
iwt = 0
if (opts.mH >= 500):
コード例 #2
0
                      help='error band level')
    (opts, args) = parser.parse_args()

    import pyroot_logon
    config = __import__(opts.modeConfig)

    from ROOT import TFile, Double, Long, gROOT, TCanvas
    ## gROOT.ProcessLine('.L RooWjjFitterParams.h+');
    gROOT.ProcessLine('.L EffTableReader.cc+')
    gROOT.ProcessLine('.L EffTableLoader.cc+')
    gROOT.ProcessLine('.L RooWjjFitterUtils.cc+')
    gROOT.ProcessLine('.L RooWjjMjjFitter.cc+')
    from ROOT import RooWjjMjjFitter, RooFit, \
         RooMsgService, RooArgList, RooArgSet
    from math import sqrt

    RooMsgService.instance().setGlobalKillBelow(RooFit.WARNING)

    fitterPars = config.theConfig(opts.Nj, opts.mcdir, opts.startingFile,
                                  opts.toydataFile )

    theFitter = RooWjjMjjFitter(fitterPars)

    theFitter.makeFitter(False)
    theFitter.loadData()

    theFitter.loadParameters(opts.startingFile)

    (frames, cans) = plot2BodyDist(theFitter, fitterPars,
                                   0, 3, opts.Err, opts.NP)
コード例 #3
0
fr.Print()
nll=fr.minNll()
print '***** nll = ',nll,' ***** \n'
print 'total yield: {0:0.0f} +/- {1:0.0f}'.format(totalYield, sqrt(sig2))

#assert(False)

cWpJ = TCanvas('cWpJ', 'W+jets shape')
pars4 = config.the4BodyConfig(fitterPars, opts.mH, opts.syst, opts.alpha)
pars4.initParamsFile = 'lastSigYield.txt'
fitter4 = RooWjjMjjFitter(pars4)

fitter4.makeFitter((opts.ParamWpJ>=0))
fitter4.loadData()
fitter4.make4BodyPdf(theFitter)
fitter4.loadParameters('lastSigYield.txt')

## assert(False)
## fitter4.getWorkSpace().Print()

mf4 = fitter4.stackedPlot(False, RooWjjMjjFitter.mlnujj)
mf4.SetName("Mlvjj_Stacked")
## sf4 = fitter4.residualPlot(mf4, "h_background", "dibosonPdf", False)
pf4 = fitter4.residualPlot(mf4, "h_total", "", True)
pf4.SetName("Mlvjj_Pull")
lf4 = fitter4.stackedPlot(True, RooWjjMjjFitter.mlnujj)
lf4.SetName("Mlvjj_log")

fitUtils = RooWjjFitterUtils(pars4)
HiggsHist = fitUtils.newEmptyHist('HWW%i_%s_shape' % (opts.mH,modeString))
VBFHiggsHist = fitUtils.newEmptyHist('VBFHWW%i_%s_shape' % (opts.mH,
コード例 #4
0
def qPlot(fitterPars):
    from ROOT import kRed, kBlack, kGreen, kOrange, kMagenta, kCyan, THStack, \
         RooWjjMjjFitter, RooWjjFitterUtils, TCanvas

    fitUtils = RooWjjFitterUtils(fitterPars)
    theFitter = RooWjjMjjFitter(fitterPars)

    thePdf = theFitter.makeFitter(False)
    theFitter.loadParameters(fitterPars.initParamsFile)

    theFitter.getWorkSpace().Print()

    q = theFitter.getWorkSpace().var(fitterPars.var)
    q.SetTitle("Q = m_{l#nujj}-m_{jj}-M_{W}")

    pdfs = thePdf.pdfList()
    coefs = thePdf.coefList()
    shapeHist = THStack('shapeHist', 'shapeHist')

    sumYield = 0.
    for i in range(pdfs.getSize() - 1, -1, -1):
        tmpHist = pdfs[i].createHistogram('h_' + pdfs[i].GetName(), q)
        theName = pdfs[i].GetName()[:3]
        tmpHist.SetFillStyle(1001)
        if theName == 'dib':
            tmpHist.SetFillColor(kOrange)
            tmpHist.SetLineColor(kOrange)
        elif theName == 'WpJ':
            tmpHist.SetFillColor(kRed)
            tmpHist.SetLineColor(kRed)
        elif theName == 'ttP':
            tmpHist.SetFillColor(kBlack)
            tmpHist.SetLineColor(kBlack)
        elif theName == 'stP':
            tmpHist.SetFillColor(kBlack)
            tmpHist.SetLineColor(kBlack)
        elif theName == 'qcd':
            tmpHist.SetFillColor(kGreen)
            tmpHist.SetLineColor(kGreen)
        elif theName == 'ZpJ':
            tmpHist.SetFillColor(kMagenta)
            tmpHist.SetLineColor(kMagenta)


##         tmpHist.Draw()
##         gPad.Update()
##         gPad.WaitPrimitive()

        tmpHist.Scale(coefs[i].getVal())
        sumYield += coefs[i].getVal()
        if (coefs[i].getVal() > 0.):
            shapeHist.Add(tmpHist)

    totalShapeHist = thePdf.createHistogram("totalShapeHist", q)
    totalShapeHist.Print()

    dataHist = fitUtils.newEmptyHist("theData")
    if fitterPars.includeMuons:
        tmpHist = fitUtils.File2Hist(
            fitterPars.DataDirectory + fitterPars.muonData, "tmpData", False,
            0, False, 1.0, fitUtils.fullCuts())
        dataHist.Add(tmpHist)

    if fitterPars.includeElectrons:
        tmpHist = fitUtils.File2Hist(
            fitterPars.DataDirectory + fitterPars.electronData, "tmpData",
            True, 0, False, 1.0, fitUtils.fullCuts())
        dataHist.Add(tmpHist)

    totalShapeHist.Scale(sumYield)
    ##     shapeHist.SetLineColor(kCyan+3)
    ##     shapeHist.SetMarkerColor(kCyan+3)

    cq = TCanvas('cq', 'Q')
    shapeHist.Draw('')
    shapeHist.GetXaxis().SetTitle(q.GetTitle() + ' (GeV)')
    shapeHist.GetYaxis().SetTitle(
        'Events / (%0.0f GeV)' %
        ((fitterPars.maxMass - fitterPars.minMass) / fitterPars.nbins))
    dataHist.Draw('same')
    cq.Modified()
    #totalShapeHist.Draw('same')
    dataHist.Chi2Test(totalShapeHist, "UUNORMP")
    print "KS test:", dataHist.KolmogorovTest(totalShapeHist)
    return (cq, shapeHist, totalShapeHist)