11from __future__
import print_function
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., 1.)
26poly = ROOT.RooPolynomial(
"p",
"p", x, ROOT.RooArgList(p0))
29f = ROOT.RooRealVar(
"f",
"f", 0.5, 0., 1.)
30model = ROOT.RooAddPdf(
"model",
"model", ROOT.RooArgList(
31 gauss, poly), ROOT.RooArgList(f))
36d = model.generate(ROOT.RooArgSet(x), 1000)
43params = model.getParameters(ROOT.RooArgSet(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: ",
67 params.selectByAttrib(
"READ", ROOT.kFALSE))
72params.readFromFile(configFile,
"",
"Section4")