21 trnd = ROOT.TRandom3()
23 x = ROOT.RooRealVar(
"x",
"x", -10, 10)
24 y = ROOT.RooRealVar(
"y",
"y", -10, 10)
27 d = ROOT.RooDataSet(
"d",
"d", coord)
29 for i
in range(10000):
30 tmpy = trnd.Gaus(0, 10)
31 tmpx = trnd.Gaus(0.5 * tmpy, 1)
32 if (abs(tmpy) < 10)
and (abs(tmpx) < 10):
44x = ROOT.RooRealVar(
"x",
"x", -10, 10)
45y = ROOT.RooRealVar(
"y",
"y", -10, 10)
48a0 = ROOT.RooRealVar(
"a0",
"a0", -0.5, -5, 5)
49a1 = ROOT.RooRealVar(
"a1",
"a1", -0.5, -1, 1)
50fy = ROOT.RooPolyVar(
"fy",
"fy", y, [a0, a1])
53sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 0.5, 0.1, 2.0)
54model = ROOT.RooGaussian(
"model",
"Gaussian with shifting mean", x, fy, sigma)
57expDataXY = makeFakeDataXY()
63expDataY = expDataXY.reduce({y})
67data = model.generate({x}, ProtoData=expDataY)
73model.fitTo(expDataXY, ConditionalObservables={y}, PrintLevel=-1)
81expDataXY.plotOn(xframe)
82model.plotOn(xframe, ProjWData=expDataY)
86binnedDataY = expDataY.binnedClone()
87model.plotOn(xframe, ProjWData=binnedDataY, LineColor=
"c", LineStyle=
":")
90(expDataY.get().find(
"y")).setBins(5)
91binnedDataY2 = expDataY.binnedClone()
92model.plotOn(xframe, ProjWData=binnedDataY2, LineColor=
"r")
95c = ROOT.TCanvas(
"rf303_conditional",
"rf303_conditional", 600, 460)
96ROOT.gPad.SetLeftMargin(0.15)
97xframe.GetYaxis().SetTitleOffset(1.2)
100c.SaveAs(
"rf303_conditional.png")