26x = ROOT.RooRealVar(
"x",
"x", -11, 11)
27y = ROOT.RooRealVar(
"y",
"y", -10, 200)
28dxy = ROOT.RooDataSet(
"dxy",
"dxy", {x, y}, StoreError={x, y})
33 x.setError((0.5 / 1.0)
if (i < 5)
else (1.0 / 1.0))
36 y.setVal(x.getVal() * x.getVal() + 4 * abs(ROOT.gRandom.Gaus()))
37 y.setError(math.sqrt(y.getVal()))
45a = ROOT.RooRealVar(
"a",
"a", 0.0, -10, 10)
46b = ROOT.RooRealVar(
"b",
"b", 0.0, -100, 100)
47f = ROOT.RooPolyVar(
"f",
"f", x, [b, a, 1.0])
50frame = x.frame(Title=
"Chi^2 fit of function set of (X#pmdX,Y#pmdY) values")
51dxy.plotOnXY(frame, YVar=y)
54f.chi2FitTo(dxy, YVar=y)
61f.chi2FitTo(dxy, YVar=y, Integrate=
True)
64f.plotOn(frame, LineStyle=
"--", LineColor=
"r")
67c = ROOT.TCanvas(
"rf609_xychi2fit",
"rf609_xychi2fit", 600, 600)
68ROOT.gPad.SetLeftMargin(0.15)
69frame.GetYaxis().SetTitleOffset(1.4)
72c.SaveAs(
"rf609_xychi2fit.png")