19x = ROOT.RooRealVar(
"x",
"x", 0, 10)
23mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5)
24sigma = ROOT.RooRealVar(
"sigma",
"width of gaussians", 0.5)
25sig = ROOT.RooGaussian(
"sig",
"Signal component 1", x, mean, sigma)
28a0 = ROOT.RooRealVar(
"a0",
"a0", 0.5, 0.0, 1.0)
29a1 = ROOT.RooRealVar(
"a1",
"a1", 0.2, 0.0, 1.0)
30bkg1 = ROOT.RooChebychev(
"bkg1",
"Background 1", x, [a0, a1])
33alpha = ROOT.RooRealVar(
"alpha",
"alpha", -1)
34bkg2 = ROOT.RooExponential(
"bkg2",
"Background 2", x, alpha)
37bkg1frac = ROOT.RooRealVar(
"bkg1frac",
"fraction of component 1 in background", 0.2, 0.0, 1.0)
38bkg = ROOT.RooAddPdf(
"bkg",
"Signal", [bkg1, bkg2], [bkg1frac])
41bkgfrac = ROOT.RooRealVar(
"bkgfrac",
"fraction of background", 0.5, 0.0, 1.0)
42model = ROOT.RooAddPdf(
"model",
"g1+g2+a", [bkg, sig], [bkgfrac])
45y = ROOT.RooRealVar(
"y",
"y", -10, 10)
46data = ROOT.RooDataSet(
"data",
"data", {x, y})
61model_obs = model.getObservables(data)
62ROOT.SetOwnership(model_obs,
True)
69model_params = model.getParameters({x})
70ROOT.SetOwnership(model_params,
True)
71model_params.Print(
"v")
75model_params2 = model.getParameters(data)
76ROOT.SetOwnership(model_params2,
True)
83model_comps = model.getComponents()
84ROOT.SetOwnership(model_comps,
True)
91sigma2 = ROOT.RooRealVar(
"sigma2",
"width of gaussians", 1)
92sig2 = ROOT.RooGaussian(
"sig2",
"Signal component 1", x, mean, sigma2)
95sig1frac = ROOT.RooRealVar(
"sig1frac",
"fraction of component 1 in signal", 0.8, 0.0, 1.0)
96sigsum = ROOT.RooAddPdf(
"sigsum",
"sig+sig2", [sig, sig2], [sig1frac])
99cust = ROOT.RooCustomizer(model,
"cust")
102cust.replaceArg(sig, sigsum)
112cust_clone = cust.build(ROOT.kTRUE)
113ROOT.SetOwnership(cust_clone,
True)