コード例 #1
0
tfunc = w.factory('expr::tfunc("log(mmgMass^2 - mmMass^2)", {mmgMass, mmMass})')
tfunc.SetName('t')
data.addColumn(tfunc)
tfunc.SetName('tfunc')
xtdata = data.reduce(ROOT.RooArgSet(mmMass, t))
data = data.reduce(ROOT.RooArgSet(mmgMass, mmMass, phoERes, mmgMassPhoGenE))

## Build the model fXT1(x, t1) for mmMass vs log(mmgMassPhoGenE^2 - mmMass^2)
t.setRange(*t1range)
xt1pdf = ROOT.RooNDKeysPdf('xt1pdf', 'xt1pdf', ROOT.RooArgList(mmMass, t),
                           xt1data, "a", 1.5)

## Build the model fT2(t2|s,r) for log(Ereco/Egen) ft2(t2|r,s)
t.setRange(*t2range)
t.setVal(0)
t2pdf = LogPhoeresKeysPdf('t2pdf', 't2pdf', phoERes, t, phoScale, phoRes, data,
                          rho=1.5)

## Build the model for fT(t|s,r) = fT1(t1) * fT2(t2|s,r)
t.setRange(*t1range)
mmMass.setRange(*mmMass_range)
t.setBins(100, "cache")
mmMass.setBins(20, "cache")
xtpdf = ROOT.RooFFTConvPdf('tpdf', 'tpdf', t, xt1pdf, t2pdf)
xtpdf.setBufferFraction(0)
xtpdf.setCacheObservables(ROOT.RooArgSet(mmMass, t))
xtpdf.setNormValueCaching(2)

## Plot fXT1(x, t1) with training data.
c1 = canvases.next('xt1')
c1.SetWindowSize(800, 400)
c1.Divide(2,1)
コード例 #2
0
# t.setVal(8.3)
nomirror = ROOT.RooKeysPdf.NoMirror
## t1pdf = ROOT.RooKeysPdf('t1pdf', 't1pdf', t, t1data, nomirror, 1.5)
t1mode = w.factory('t1mode[8.3,5,10]')
t1width = w.factory('t1width[0.2,0.01,5]')
t1pdf = ParametrizedKeysPdf('t1pdf', 't1pdf', t, t1mode, t1width, t1data,
                            nomirror, 1.5)
t1pdf.fitTo(t1data)
t1mode.setConstant(True)
t1width.setConstant(True)
## TODO: use parametrized KEYS PDF with forced ranges and fit it to data.

## Build the model fT2(t2|s,r) for log(Ereco/Egen) ft2(t2|r,s)
t.setRange(-1, 1)
t.setVal(0)
t2pdf = LogPhoeresKeysPdf('t2pdf', 't2pdf', phoERes, t, phoScale, phoRes, data,
                          rho=1.5)

## Build the model for fT(t|s,r) = fT1(t1) * fT2(t2|s,r)
t.setRange(5, 10)
t.setBins(1000, "cache")
tpdf = ROOT.RooFFTConvPdf('tpdf', 'tpdf', t, t1pdf, t2pdf)
tpdf.setBufferFraction(0.1)

##------------------------------------------------------------------------------
## Plot fT1(t1) with training data.
canvases.next('t1pdf').SetGrid()
t.setRange(5, 10)
t.SetTitle('log(m_{#mu#mu#gamma,E_{gen}^{#gamma}}^{2} - m_{#mu#mu}^{2})')
plot = t.frame(roo.Range(6, 9))
t1data.plotOn(plot)
t1pdf.shape.plotOn(plot)
コード例 #3
0
canvases.next('phoEResPdf').SetGrid()
plot = phoERes.frame(roo.Range(-10, 10))
data.plotOn(plot)
phoEResPdf.plotOn(plot)
phoEResPdf.paramOn(plot)
plot.Draw()

t = w.factory('t[0,-1,1]')
t.SetTitle('log(E_{reco}^{#gamma}/E_{gen}^{#gamma})')
tfunc = w.factory('expr::tfunc("log(0.01 * phoERes + 1)", {phoERes})')
tfunc.SetName('t')
data.addColumn(tfunc)

## Build the model for log(Ereco/Egen) ft2(t2|r,s)
t2pdf = LogPhoeresKeysPdf('t2pdf', 't2pdf', phoERes, t, phoScale, phoRes, data,
                          rho=1.5)

## Fit nominal data with ft2(t2|r,s)
canvases.next('t2pdf').SetGrid()
t2pdf.fitTo(data, roo.Range(ROOT.TMath.Log(0.5), ROOT.TMath.Log(2.0)))
plot = t.frame(roo.Range(-0.15, 0.15))
data.plotOn(plot)
t2pdf.plotOn(plot)
plot.Draw()
Latex([
    's_{shape}: %.3f %%' % t2pdf.s0val,
    's_{sfit}: %.3f #pm %.3f %%' % (phoScale.getVal(), phoScale.getError()),
    's_{fit} - s_{shape}: %.4f #pm %.4f %%' % (
        phoScale.getVal() - t2pdf.s0val,
        phoScale.getError()
        ),