breit-wigner fitting
bwFit = ROOT.TF1("bwfit",bw,50.e3,200.e3) bwFit.SetParameter(0,100.e3) bwFit.SetParameter(1,1.e3)# Now fit the Breit-Wigner to the histogram, # write the results as plot labels, # and write the plot to the output file.dataHisto.Fit(bwFit ,"E") dataHisto.Draw("pe")chi2 = bwFit.GetChisquare() ndof = bwFit.GetNDF()mean = bwFit.GetParameter(0)/1000width = bwFit.GetParameter(1)/1000latex.DrawText(0.5,0.80,"Mean = %.1f GeV"%(mean)) latex.DrawText(0.5,0.75,"Width = %.1f GeV"%(width)) latex.DrawText(0.5,0.7,"chi2/ndof = %.1f/%d = %.1f"%(chi2,ndof,chi2/ndof))canvas.Print(plotFileName)