16def getWorkspace(mode):
24 w = ROOT.RooWorkspace()
28 w = ROOT.RooWorkspace(
"w", 1)
33 "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])")
43 w.pdf(
"model").setStringAttribute(
"CACHEPARMINT",
"x:y:z")
46 normSet = ROOT.RooArgSet(w.var(
"x"), w.var(
"y"), w.var(
"z"))
47 w.pdf(
"model").getVal(normSet)
48 w.writeToFile(
"rf903_numintcache.root")
52 f = ROOT.TFile(
"rf903_numintcache.root")
75 hhcache = w.expensiveObjectCache().getObj(1)
77 ROOT.TCanvas(
"rf903_numintcache",
"rf903_numintcache", 600, 600)
78 hhcache.createHistogram(
"a").
Draw()
80 ROOT.RooFit.Error(
"rf903_numintcache",
81 "Cached histogram is not existing in workspace")
89d = w.pdf(
"model").generate(
98 d, ROOT.RooFit.Verbose(
99 ROOT.kTRUE), ROOT.RooFit.Timer(
104framex = w.var(
"x").frame(ROOT.RooFit.Title(
"Projection of 3D model on X"))
106w.pdf(
"model").plotOn(framex)
109c = ROOT.TCanvas(
"rf903_numintcache",
"rf903_numintcache", 600, 600)
112c.SaveAs(
"rf903_numintcache.png")
115ROOT.gDirectory.Add(w)