19 x = ROOT.RooRealVar(
"x",
"x", -10, 10)
20 y = ROOT.RooRealVar(
"y",
"y", -10, 10)
23 d = ROOT.RooDataSet(
"d",
"d", coord)
25 for i
in range(10000):
26 tmpy = ROOT.gRandom.Gaus(0, 10)
27 tmpx = ROOT.gRandom.Gaus(0.5 * tmpy, 1)
28 if (abs(tmpy) < 10)
and (abs(tmpx) < 10):
40x = ROOT.RooRealVar(
"x",
"x", -10, 10)
41y = ROOT.RooRealVar(
"y",
"y", -10, 10)
44a0 = ROOT.RooRealVar(
"a0",
"a0", -0.5, -5, 5)
45a1 = ROOT.RooRealVar(
"a1",
"a1", -0.5, -1, 1)
46fy = ROOT.RooPolyVar(
"fy",
"fy", y, [a0, a1])
49sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 0.5, 0.1, 2.0)
50model = ROOT.RooGaussian(
"model",
"Gaussian with shifting mean", x, fy, sigma)
53expDataXY = makeFakeDataXY()
59expDataY = expDataXY.reduce({y})
63data = model.generate({x}, ProtoData=expDataY)
69model.fitTo(expDataXY, ConditionalObservables={y})
77expDataXY.plotOn(xframe)
78model.plotOn(xframe, ProjWData=expDataY)
82binnedDataY = expDataY.binnedClone()
83model.plotOn(xframe, ProjWData=binnedDataY, LineColor=
"c", LineStyle=
":")
86(expDataY.get().find(
"y")).setBins(5)
87binnedDataY2 = expDataY.binnedClone()
88model.plotOn(xframe, ProjWData=binnedDataY2, LineColor=
"r")
91c = ROOT.TCanvas(
"rf303_conditional",
"rf303_conditional", 600, 460)
92ROOT.gPad.SetLeftMargin(0.15)
93xframe.GetYaxis().SetTitleOffset(1.2)
96c.SaveAs(
"rf303_conditional.png")