19x = ROOT.RooRealVar(
"x",
"x", 0, 10)
23mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5)
24sigma1 = ROOT.RooRealVar(
"sigma1",
"width of gaussians", 0.5)
25sigma2 = ROOT.RooRealVar(
"sigma2",
"width of gaussians", 1)
26sig1 = ROOT.RooGaussian(
"sig1",
"Signal component 1", x, mean, sigma1)
27sig2 = ROOT.RooGaussian(
"sig2",
"Signal component 2", x, mean, sigma2)
30sig1frac = ROOT.RooRealVar(
"sig1frac",
"fraction of component 1 in signal", 0.8, 0.0, 1.0)
31sig = ROOT.RooAddPdf(
"sig",
"Signal", [sig1, sig2], [sig1frac])
34a0 = ROOT.RooRealVar(
"a0",
"a0", 0.5, 0.0, 1.0)
35a1 = ROOT.RooRealVar(
"a1",
"a1", -0.2, 0.0, 1.0)
36bkg1 = ROOT.RooChebychev(
"bkg1",
"Background 1", x, [a0, a1])
39alpha = ROOT.RooRealVar(
"alpha",
"alpha", -1)
40bkg2 = ROOT.RooExponential(
"bkg2",
"Background 2", x, alpha)
43bkg1frac = ROOT.RooRealVar(
"sig1frac",
"fraction of component 1 in background", 0.2, 0.0, 1.0)
44bkg = ROOT.RooAddPdf(
"bkg",
"Signal", [bkg1, bkg2], [sig1frac])
47bkgfrac = ROOT.RooRealVar(
"bkgfrac",
"fraction of background", 0.5, 0.0, 1.0)
48model = ROOT.RooAddPdf(
"model",
"g1+g2+a", [bkg, sig], [bkgfrac])
54params = model.getParameters({x})
57initParams = params.snapshot()
60data = model.generate({x}, 1000)
61model.fitTo(data, PrintLevel=-1)
71params.printLatex(Columns=2)
74params.printLatex(Sibling=initParams)
78params.printLatex(Sibling=initParams, Columns=2)
81params.printLatex(Sibling=initParams, OutputFile=
"rf407_latextables.tex")