15def getWorkspace(mode):
23 w = ROOT.RooWorkspace()
27 w = ROOT.RooWorkspace(
"w", 1)
32 "EXPR::model('1/((x-a)*(x-a)+0.01)+1/((y-a)*(y-a)+0.01)+1/((z-a)*(z-a)+0.01)',x[-1,1],y[-1,1],z[-1,1],a[-5,5])")
42 w.pdf(
"model").setStringAttribute(
"CACHEPARMINT",
"x:y:z")
45 normSet = ROOT.RooArgSet(w.var(
"x"), w.var(
"y"), w.var(
"z"))
46 w.pdf(
"model").getVal(normSet)
47 w.writeToFile(
"rf903_numintcache.root")
51 f = ROOT.TFile(
"rf903_numintcache.root")
74 hhcache = w.expensiveObjectCache().getObj(1)
76 ROOT.TCanvas(
"rf903_numintcache",
"rf903_numintcache", 600, 600)
77 hhcache.createHistogram(
"a").
Draw()
79 ROOT.RooFit.Error(
"rf903_numintcache",
80 "Cached histogram is not existing in workspace")
88d = w.pdf(
"model").generate(
97 d, ROOT.RooFit.Verbose(
98 ROOT.kTRUE), ROOT.RooFit.Timer(
103framex = w.var(
"x").frame(ROOT.RooFit.Title(
"Projection of 3D model on X"))
105w.pdf(
"model").plotOn(framex)
108c = ROOT.TCanvas(
"rf903_numintcache",
"rf903_numintcache", 600, 600)
111c.SaveAs(
"rf903_numintcache.png")
114ROOT.gDirectory.Add(w)