当前位置: 首页>>代码示例>>Python>>正文


Python RooWorkspace.cat方法代码示例

本文整理汇总了Python中ROOT.RooWorkspace.cat方法的典型用法代码示例。如果您正苦于以下问题:Python RooWorkspace.cat方法的具体用法?Python RooWorkspace.cat怎么用?Python RooWorkspace.cat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ROOT.RooWorkspace的用法示例。


在下文中一共展示了RooWorkspace.cat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RooWorkspace

# 需要导入模块: from ROOT import RooWorkspace [as 别名]
# 或者: from ROOT.RooWorkspace import cat [as 别名]
## simparamfile = 'nom3.5SimFit.txt'

ws = RooWorkspace("ws","ws")

readData(ws, hidatafile, ppdatafile, cuts, mmin, mmax)

mass = ws.var('invariantMass')

ppBkgModel = 1
bkgModel = 0
if useKeys:
    bkgModel = 2

buildPdf(ws, False, ppBkgModel, True)
buildPdf(ws, True, bkgModel, True)
simPdf = buildSimPdf(ws, ws.cat('dataCat'))

#ws.Print()

data = ws.data('data').reduce('(QQsign==QQsign::PlusMinus)')
pars = simPdf.getParameters(data)
ws.var('nsig1_pp').setVal(90)
ws.var('nsig1_pp').setError(10)
ws.var('nsig1_hi').setVal(1200)
ws.var('nsig1_hi').setError(40)

ws.var('nbkg_pp').setVal(335*(mmax-mmin)/7.)
ws.var('nbkg_pp').setError(12)
ws.var('nbkg_hi').setVal(10000*(mmax-mmin)/7.)
ws.var('nbkg_hi').setError(100)
开发者ID:TENorbert,项目名称:usercode-2,代码行数:32,代码来源:simQuickFit.py

示例2: RooWorkspace

# 需要导入模块: from ROOT import RooWorkspace [as 别名]
# 或者: from ROOT.RooWorkspace import cat [as 别名]
ws = RooWorkspace("ws","ws")

readData(ws, hidatafile, ppdatafile, cuts, mmin, mmax)

mass = ws.var('invariantMass')

ppBkgModel = 1
bkgModel = 0
if useKeys:
    bkgModel = 2

mass.Print()
buildPdf(ws, False, ppBkgModel, True)
buildPdf(ws, True, bkgModel, True)
simPdf = buildSimPdf(ws, ws.cat('dataCat'))

#ws.Print()

data = ws.data('data').reduce('(QQsign==QQsign::PlusMinus)')

pars = simPdf.getParameters(data)

ws.var('nsig1_pp').setVal(90)
ws.var('nsig1_pp').setError(10)
ws.var('nsig1_hi').setVal(1200)
ws.var('nsig1_hi').setError(40)

if len(simparamfile) > 0:
    pars.readFromFile(simparamfile)
开发者ID:TENorbert,项目名称:usercode-2,代码行数:31,代码来源:nullSimFit.py

示例3: RooWorkspace

# 需要导入模块: from ROOT import RooWorkspace [as 别名]
# 或者: from ROOT.RooWorkspace import cat [as 别名]
hidatafile = 'data/dimuonTree_150mub.root'
# hidatafile = 'data/dimuonTree_181912-182609.root'
ppdatafile = 'data/dimuonTree_2011_pp.root'

cuts = '(muPlusPt > %0.1f) && (muMinusPt > %0.1f) && (abs(upsRapidity)<2.4) && (vProb > 0.05)' \
       % (opts.pt, opts.pt)
simparamfile = opts.paramfile
useKeys = opts.keys

ws = RooWorkspace("ws","ws")

readData(ws, hidatafile, ppdatafile, cuts)

buildPdf(ws, False, 1, True)
buildPdf(ws, True, 0, True)
simPdf = buildSimPdf(ws, ws.cat('dataCat'))

pars = simPdf.getParameters(ws.data('data'))
pars.readFromFile(simparamfile)

Npp_tot = Long(ws.var("nsig1_pp").getVal() + \
               ws.function("nsig2_pp").getVal() + \
               ws.function("nsig3_pp").getVal() + \
               ws.var("nbkg_pp").getVal() + 0.5)
Nhi_tot = Long(ws.var("nsig1_hi").getVal() + \
               ws.function("nsig2_hi").getVal() + \
               ws.function("nsig3_hi").getVal() + \
               ws.var("nbkg_hi").getVal() + 0.5)
dataCat = ws.cat('dataCat')
QQsign = ws.cat('QQsign')
reducedCols = RooArgSet(dataCat,QQsign)
开发者ID:TENorbert,项目名称:usercode-2,代码行数:33,代码来源:toyFit.py

示例4: RooWorkspace

# 需要导入模块: from ROOT import RooWorkspace [as 别名]
# 或者: from ROOT.RooWorkspace import cat [as 别名]
newTrigger = "HLT_L2DoubleMu23_NoVertex_2Cha_Angle2p5_v"

# Load the input file
tree = ROOT.TChain("T")
#tree.Add("/afs/cern.ch/user/d/demattia/public/TagAndProbe/TagAndProbe_ZMuMu.root")
tree.Add("/afs/cern.ch/user/d/demattia/public/TagAndProbe/TagAndProbe_Run2012A.root")
tree.Add("/afs/cern.ch/user/d/demattia/public/TagAndProbe/TagAndProbe_Run2012B.root")
tree.Add("/afs/cern.ch/user/d/demattia/public/TagAndProbe/TagAndProbe_Run2012C.root")
tree.Add("/afs/cern.ch/user/d/demattia/public/TagAndProbe/TagAndProbe_Run2012D.root")

# Prepare the workspace
ws = RooWorkspace("ws", "workspace")
Workspace.buildPdf(ws, p)

mass = ws.var("mass")
sample = ws.cat("sample")
simPdf = ws.pdf("simPdf")
efficiency = ws.var("efficiency")
meanB = ws.var("meanB")

# prepare_datasets(ws, p)

# Prepare datasets
datasetAllMap = {}
datasetPassMap = {}
hAllMap = {}
hPassMap = {}
for ptBin1 in range(0, len(ptBinsX)):
    for ptBin2 in range(0, len(ptBinsY)):
        datasetAllMap[(ptBin1, ptBin2)] = RooDataSet(buildName("datasetAll_", ptBin1, ptBin2, ptBinsX, ptBinsY), buildName("datasetAll_", ptBin1, ptBin2, ptBinsX, ptBinsY), RooArgSet(mass))
        datasetPassMap[(ptBin1, ptBin2)] = RooDataSet(buildName("datasetPass_", ptBin1, ptBin2, ptBinsX, ptBinsY), buildName("datasetPass_", ptBin1, ptBin2, ptBinsX, ptBinsY), RooArgSet(mass))
开发者ID:Hosein47,项目名称:usercode,代码行数:33,代码来源:EfficiencyFitterForRatio.py

示例5: len

# 需要导入模块: from ROOT import RooWorkspace [as 别名]
# 或者: from ROOT.RooWorkspace import cat [as 别名]
    for p in plotting:
        (cat, kTrig, fitparams, xlow, xup) = p
        nfitparams = len(fitparams)
        if cat != "cat4":  continue

        var = "var0"
        xtitle = "#scale[0.7]{RECO} T0T1 PFMET [GeV]"
        ws = RooWorkspace("workspace", "workspace")
        RunFactory(ws, eff, fitparams, var, [cat], xlow=xlow, xup=xup)
        #ws.var("fit0").setConstant(1); ws.var("fit2").setConstant(1); nfitparams -= 2
        #wsfilename = "workspace.root"
        #ws.writeToFile(wsfilename)

        rootfilename = "dataset_%s.root" % kTrig
        dsfile = TFile.Open(rootfilename)
        ds = RooDataSet("data", "data", RooArgSet(ws.var(var), ws.cat(cat)), RooFit.Import(dsfile.tree)); ds.Print()

        model = cat.replace("cat","model")
        res = ws.pdf(model).fitTo(ds, RooFit.ConditionalObservables(RooArgSet(ws.var(var))), RooFit.Minimizer("Minuit"), RooFit.Save())

        ymax = fitparams[2][2]+0.1
        if ymax < 0.2:  ymax = fitparams[2][2]+0.01
        text = draw(ws, res, eff, var, cat, xtitle, kTrig, nfitparams, xlow=xlow, xup=xup, ymax=ymax)
        for t in text:  writing.append(t)
        save(imgdir, "fiteff_" + kTrig + "_" + eff)

    # Printout
    print "-" * 40
    for t in writing:  print t

开发者ID:jiafulow,项目名称:JetMETTriggerAnalysis,代码行数:31,代码来源:fitter_METTriggers.py


注:本文中的ROOT.RooWorkspace.cat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。