19x = ROOT.RooRealVar(
"x",
"x", -10, 10)
20m = ROOT.RooRealVar(
"m",
"m", 0, -10, 10)
21s = ROOT.RooRealVar(
"s",
"s", 1, -10, 10)
22gauss = ROOT.RooGaussian(
"g",
"g", x, m, s)
25p0 = ROOT.RooRealVar(
"p0",
"p0", 0.01, 0.0, 1.0)
26poly = ROOT.RooPolynomial(
"p",
"p", x, [p0])
29f = ROOT.RooRealVar(
"f",
"f", 0.5, 0.0, 1.0)
30model = ROOT.RooAddPdf(
"model",
"model", [gauss, poly], [f])
35d = model.generate({x}, 1000)
36model.fitTo(d, PrintLevel=-1)
42params = model.getParameters({x})
45params.writeToFile(
"rf505_asciicfg_example.txt")
51params.readFromFile(
"rf505_asciicfg_example.txt")
54configFile = ROOT.gROOT.GetTutorialDir().Data() +
"/roofit/rf505_asciicfg.txt"
57params.readFromFile(configFile,
"",
"Section2")
62params.readFromFile(configFile,
"READ",
"Section3")
65print(
"The following parameters of the were _not_ read from Section3: ", params.selectByAttrib(
"READ",
False))
70params.readFromFile(configFile,
"",
"Section4")