breit-wigner fitting

  1. bwFit = ROOT.TF1("bwfit",bw,50.e3,200.e3)
  2. bwFit.SetParameter(0,100.e3)
  3. bwFit.SetParameter(1,1.e3)
  4. # Now fit the Breit-Wigner to the histogram,
  5. # write the results as plot labels,
  6. # and write the plot to the output file.
  7. dataHisto.Fit(bwFit ,"E")
  8. dataHisto.Draw("pe")
  9. chi2 = bwFit.GetChisquare()
  10. ndof = bwFit.GetNDF()
  11. mean = bwFit.GetParameter(0)/1000
  12. width = bwFit.GetParameter(1)/1000
  13. latex.DrawText(0.5,0.80,"Mean = %.1f GeV"%(mean))
  14. latex.DrawText(0.5,0.75,"Width = %.1f GeV"%(width))
  15. latex.DrawText(0.5,0.7,"chi2/ndof = %.1f/%d = %.1f"%(chi2,ndof,chi2/ndof))
  16. canvas.Print(plotFileName)