28x = ROOT.RooRealVar(
"x",
"x", -11, 11)
29y = ROOT.RooRealVar(
"y",
"y", -10, 200)
30dxy = ROOT.RooDataSet(
"dxy",
"dxy", {x, y}, StoreError={x, y})
35 x.setError((0.5 / 1.0)
if (i < 5)
else (1.0 / 1.0))
38 y.setVal(x.getVal() * x.getVal() + 4 * abs(ROOT.gRandom.Gaus()))
39 y.setError(math.sqrt(y.getVal()))
47a = ROOT.RooRealVar(
"a",
"a", 0.0, -10, 10)
48b = ROOT.RooRealVar(
"b",
"b", 0.0, -100, 100)
49c = ROOT.RooRealVar(
"c",
"c", 0.0, -100, 100)
50f = ROOT.RooPolyVar(
"f",
"f", x, [b, a, c])
53frame = x.frame(Title=
"Chi^2 fit of function set of (X#pmdX,Y#pmdY) values")
54dxy.plotOnXY(frame, YVar=y)
57fit1 = f.chi2FitTo(dxy, YVar=y, Save=
True, PrintLevel=-1)
65fit2 = f.chi2FitTo(dxy, YVar=y, Save=
True, PrintLevel=-1, Integrate=
True)
69f.plotOn(frame, LineStyle=
"--", LineColor=
"r")
72c = ROOT.TCanvas(
"rf609_xychi2fit",
"rf609_xychi2fit", 600, 600)
73ROOT.gPad.SetLeftMargin(0.15)
74frame.GetYaxis().SetTitleOffset(1.4)
77c.SaveAs(
"rf609_xychi2fit.png")