18x = ROOT.RooRealVar(
"x",
"x", -10, 10)
19y = ROOT.RooRealVar(
"y",
"y", -10, 10)
22mx = ROOT.RooRealVar(
"mx",
"mx", 1, -10, 10)
23my = ROOT.RooRealVar(
"my",
"my", 1, -10, 10)
25gx = ROOT.RooGaussian(
"gx",
"gx", x, mx, ROOT.RooFit.RooConst(1))
26gy = ROOT.RooGaussian(
"gy",
"gy", y, my, ROOT.RooFit.RooConst(1))
28sig = ROOT.RooProdPdf(
"sig",
"sig", gx, gy)
31px = ROOT.RooPolynomial(
"px",
"px", x)
32py = ROOT.RooPolynomial(
"py",
"py", y)
33bkg = ROOT.RooProdPdf(
"bkg",
"bkg", px, py)
36f = ROOT.RooRealVar(
"f",
"f", 0., 1.)
37model = ROOT.RooAddPdf(
38 "model",
"model", ROOT.RooArgList(
39 sig, bkg), ROOT.RooArgList(f))
42modelData = model.generate(ROOT.RooArgSet(x, y), 10000)
63x.setRange(
"SB1", -10, +10)
64y.setRange(
"SB1", -10, 0)
66x.setRange(
"SB2", -10, 0)
67y.setRange(
"SB2", 0, +10)
69x.setRange(
"SIG", 0, +10)
70y.setRange(
"SIG", 0, +10)
72x.setRange(
"FULL", -10, +10)
73y.setRange(
"FULL", -10, +10)
80r_sb1 = model.fitTo(modelData, ROOT.RooFit.Range(
81 "SB1"), ROOT.RooFit.Save())
85r_sb2 = model.fitTo(modelData, ROOT.RooFit.Range(
86 "SB2"), ROOT.RooFit.Save())
93r_sb12 = model.fitTo(modelData, ROOT.RooFit.Range(
94 "SB1,SB2"), ROOT.RooFit.Save())