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., 1.)
27poly = ROOT.RooPolynomial(
"p",
"p", x, ROOT.RooArgList(p0))
30f = ROOT.RooRealVar(
"f",
"f", 0.5, 0., 1.)
31model = ROOT.RooAddPdf(
"model",
"model", ROOT.RooArgList(
32 gauss, poly), ROOT.RooArgList(f))
37d = model.generate(ROOT.RooArgSet(x), 1000)
44params = model.getParameters(ROOT.RooArgSet(x))
47params.writeToFile(
"rf505_asciicfg_example.txt")
53params.readFromFile(
"rf505_asciicfg_example.txt")
56configFile = ROOT.gROOT.GetTutorialDir().Data() +
"/roofit/rf505_asciicfg.txt"
59params.readFromFile(configFile,
"",
"Section2")
64params.readFromFile(configFile,
"READ",
"Section3")
67print(
"The following parameters of the were _not_ read from Section3: ",
68 params.selectByAttrib(
"READ", ROOT.kFALSE))
73params.readFromFile(configFile,
"",
"Section4")