'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #503
Reading and using a workspace
The input file for self macro is generated by rf502_wspaceread.py
import ROOT
f = ROOT.TFile("rf502_workspace_py.root")
w = f.Get("w")
x = w["x"]
model = w["model"]
data = w["modelData"]
model.Print("t")
model.fitTo(data)
xframe = x.frame(Title="Model and data read from workspace")
data.plotOn(xframe)
model.plotOn(xframe)
model.plotOn(xframe, Components="bkg", LineStyle="--")
model.plotOn(xframe, Components="bkg,sig2", LineStyle=":")
c = ROOT.TCanvas("rf503_wspaceread", "rf503_wspaceread", 600, 600)
ROOT.gPad.SetLeftMargin(0.15)
xframe.GetYaxis().SetTitleOffset(1.4)
xframe.Draw()
c.SaveAs("rf503_wspaceread.png")
- Date
- February 2018
- Author
- Clemens Lange
Definition in file rf503_wspaceread.py.