12from __future__
import print_function
20x = ROOT.RooRealVar(
"x",
"x", -10, 10)
21m = ROOT.RooRealVar(
"m",
"m", 0, -10, 10)
22s = ROOT.RooRealVar(
"s",
"s", 1, -10, 10)
23gauss = ROOT.RooGaussian(
"g",
"g", x, m, s)
26p0 = ROOT.RooRealVar(
"p0",
"p0", 0.01, 0.0, 1.0)
27poly = ROOT.RooPolynomial(
"p",
"p", x, [p0])
30f = ROOT.RooRealVar(
"f",
"f", 0.5, 0.0, 1.0)
31model = ROOT.RooAddPdf(
"model",
"model", [gauss, poly], [f])
36d = model.generate({x}, 1000)
37model.fitTo(d, PrintLevel=-1)
43params = model.getParameters({x})
46params.writeToFile(
"rf505_asciicfg_example.txt")
52params.readFromFile(
"rf505_asciicfg_example.txt")
55configFile = ROOT.gROOT.GetTutorialDir().Data() +
"/roofit/rf505_asciicfg.txt"
58params.readFromFile(configFile,
"",
"Section2")
63params.readFromFile(configFile,
"READ",
"Section3")
66print(
"The following parameters of the were _not_ read from Section3: ", params.selectByAttrib(
"READ",
False))
71params.readFromFile(configFile,
"",
"Section4")