20 x = ROOT.RooRealVar(
"x",
"x", -10, 10)
21 y = ROOT.RooRealVar(
"y",
"y", -10, 10)
24 d = ROOT.RooDataSet(
"d",
"d", coord)
26 for i
in range(10000):
27 tmpy = ROOT.gRandom.Gaus(0, 10)
28 tmpx = ROOT.gRandom.Gaus(0.5 * tmpy, 1)
29 if (abs(tmpy) < 10)
and (abs(tmpx) < 10):
41x = ROOT.RooRealVar(
"x",
"x", -10, 10)
42y = ROOT.RooRealVar(
"y",
"y", -10, 10)
45a0 = ROOT.RooRealVar(
"a0",
"a0", -0.5, -5, 5)
46a1 = ROOT.RooRealVar(
"a1",
"a1", -0.5, -1, 1)
47fy = ROOT.RooPolyVar(
"fy",
"fy", y, [a0, a1])
50sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 0.5, 0.1, 2.0)
51model = ROOT.RooGaussian(
"model",
"Gaussian with shifting mean", x, fy, sigma)
54expDataXY = makeFakeDataXY()
60expDataY = expDataXY.reduce({y})
64data = model.generate({x}, ProtoData=expDataY)
70model.fitTo(expDataXY, ConditionalObservables={y}, PrintLevel=-1)
78expDataXY.plotOn(xframe)
79model.plotOn(xframe, ProjWData=expDataY)
83binnedDataY = expDataY.binnedClone()
84model.plotOn(xframe, ProjWData=binnedDataY, LineColor=
"c", LineStyle=
":")
87(expDataY.get().find(
"y")).setBins(5)
88binnedDataY2 = expDataY.binnedClone()
89model.plotOn(xframe, ProjWData=binnedDataY2, LineColor=
"r")
92c = ROOT.TCanvas(
"rf303_conditional",
"rf303_conditional", 600, 460)
93ROOT.gPad.SetLeftMargin(0.15)
94xframe.GetYaxis().SetTitleOffset(1.2)
97c.SaveAs(
"rf303_conditional.png")