コード例 #1
0
    Gamma, DGamma, Dm,
    C, D, Dbar, S, Sbar,
    resmodel, acc,
    terrpdf, mistagpdf,
    aprod, adet)

# generate "proto data" for mistag and time error
proto_data = WS(ws, mistagpdf_os.generate(RooArgSet(mistag_os), nevts))
mistag_ss_data = WS(ws, mistagpdf_ss.generate(RooArgSet(mistag_ss), nevts))
terr_data = WS(ws, terrpdf.generate(RooArgSet(timeerr), nevts))
proto_data.merge(mistag_ss_data, terr_data)

# generate events
obs = RooArgSet(qf, qt_os, qt_ss, time) #if use proto data, don't put mistag/time error observables here!
ds = WS(ws, genpdf.generate(obs, RooFit.ProtoData(proto_data)))
ds.Print('v')
ds.table(qf).Print('v')
ds.table(qt_os).Print('v')
ds.table(qt_ss).Print('v')

# HACK (2/2): restore correct eta range after generation
ds.get().find("mistag_os").setRange(0.0,0.5)
ds.get().find("mistag_ss").setRange(0.0,0.5)

# plot generated dataset + generating pdf
#plotAll(ds,genpdf,qf,qt_os,time,"GenPdfAndDataOS_decRateCoeff_Bd_tut_PEDTE.eps")
#plotAll(ds,genpdf,qf,qt_ss,time,"GenPdfAndDataSS_decRateCoeff_Bd_tut_PEDTE.eps")

# use workspace for fit pdf
config['CONTEXT'] = 'FIT'
コード例 #2
0
ファイル: time-tut003a.py プロジェクト: user-vm/tutorial
    fitconfig['Context'] = 'FIT%u' % i
    fitconfig['NBinsAcceptance'] = 0

    fitpdf = buildTimePdf(fitconfig)
    #ds = WS(fitpdf['ws'],ds);
    # add data set to fitting workspace
    ds1 = WS(fitpdf['ws'], dspercat[i])

    print 72 * "#"
    print "WS:" + str(fitpdf["ws"])
    print "PDF:" + str(fitpdf["pdf"])
    print "OBS:" + str(fitpdf["obs"])
    print "DS:" + str(ds1)
    fitpdf['ws'].Print("v")
    fitpdf['pdf'].Print("v")
    ds1.Print("v")
    mistag = fitpdf['ws'].obj("mistag")
    aveta = etaAvgList.At(i).getValV();
    mistag.setVal(aveta);
    mistag.setError(min([0.5 / NUMCAT / sqrt(12), abs(aveta) * 0.5, abs(aveta - 0.5) * 0.5]))
    mistag.Print("v")
    print 72 * "#"

    print "\n-------PRINTING DS1--------\n"
    ds1.Print('v')
    for o in fitpdf['obs']:
        if not o.InheritsFrom('RooAbsCategory'): continue
        ds1.table(o).Print('v')
    print "\n---------------------------\n"

    """
コード例 #3
0
# tweaks that speed up fitting during generation (because they waste time there)
genconfig = copy.deepcopy(config)
genconfig['Context'] = 'GEN'
genconfig['NBinsAcceptance'] = 0
genconfig['NBinsProperTimeErr'] = 0
genconfig['ParameteriseIntegral'] = False
genpdf = buildTimePdf(genconfig)

# generate 150K events
#print '150K'
#ds = genpdf['pdf'].generate(RooArgSet(*genpdf['obs']), 150000, RooFit.Verbose())
from B2DXFitters import datasetio

weight = WS(genpdf['ws'], RooRealVar(weightVarName, 'weight', -1e9, 1e9))

weight.Print()

for v in genpdf['obs']:
    v.Print('v')
obsset = RooArgSet(weight, *genpdf['obs'])
ds = datasetio.readDataSet(genconfig, genpdf['ws'], obsset)
#ds.Print();
#sys.exit(0);
#saveEta(ds);

# HACK (2/2): restore correct eta range after generation
ds.get().find('eta').setRange(0.0, 0.5)

ds.Print('v')
for o in genpdf['obs']:
    if not o.InheritsFrom('RooAbsCategory'): continue