21x = ROOT.RooRealVar(
"x",
"x", -10, 10)
24sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
25mean = ROOT.RooRealVar(
"mean",
"mean", 0, -10, 10)
26gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mean, sigma)
29data = gauss.generate({x}, 10000)
38frame1 = x.frame(Title=
"Data with distorted Gaussian pdf", Bins=40)
39data.plotOn(frame1, DataError=
"SumW2")
48print(
"chi^2 = ", frame1.chiSquare())
54hresid = frame1.residHist()
57hpull = frame1.pullHist()
61frame2 = x.frame(Title=
"Residual Distribution")
62frame2.addPlotable(hresid,
"P")
66frame3 = x.frame(Title=
"Pull Distribution")
67frame3.addPlotable(hpull,
"P")
69c = ROOT.TCanvas(
"rf109_chi2residpull",
"rf109_chi2residpull", 900, 300)
72ROOT.gPad.SetLeftMargin(0.15)
73frame1.GetYaxis().SetTitleOffset(1.6)
76ROOT.gPad.SetLeftMargin(0.15)
77frame2.GetYaxis().SetTitleOffset(1.6)
80ROOT.gPad.SetLeftMargin(0.15)
81frame3.GetYaxis().SetTitleOffset(1.6)
84c.SaveAs(
"rf109_chi2residpull.png")