15from __future__
import print_function
22x = ROOT.RooRealVar(
"x",
"x", -10, 10)
25sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
26mean = ROOT.RooRealVar(
"mean",
"mean", 0, -10, 10)
27gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mean, sigma)
30data = gauss.generate({x}, 10000)
39frame1 = x.frame(Title=
"Data with distorted Gaussian pdf", Bins=40)
40data.plotOn(frame1, DataError=
"SumW2")
49print(
"chi^2 = ", frame1.chiSquare())
55hresid = frame1.residHist()
58hpull = frame1.pullHist()
62frame2 = x.frame(Title=
"Residual Distribution")
63frame2.addPlotable(hresid,
"P")
67frame3 = x.frame(Title=
"Pull Distribution")
68frame3.addPlotable(hpull,
"P")
70c = ROOT.TCanvas(
"rf109_chi2residpull",
"rf109_chi2residpull", 900, 300)
73ROOT.gPad.SetLeftMargin(0.15)
74frame1.GetYaxis().SetTitleOffset(1.6)
77ROOT.gPad.SetLeftMargin(0.15)
78frame2.GetYaxis().SetTitleOffset(1.6)
81ROOT.gPad.SetLeftMargin(0.15)
82frame3.GetYaxis().SetTitleOffset(1.6)
85c.SaveAs(
"rf109_chi2residpull.png")