CMS 3D CMS Logo

Functions

fitResidual Namespace Reference

Functions

def fitResidual

Function Documentation

def fitResidual::fitResidual (   histo,
  nSigmas = 2,
  verbose = False 
)

Definition at line 3 of file fitResidual.py.

00004                                               :
00005     option = "R0"
00006     if not verbose: option += "Q"
00007 
00008     minFit = histo.GetMean() - histo.GetRMS()
00009     maxFit = histo.GetMean() + histo.GetRMS()
00010 
00011     funcName = histo.GetName() + "_gaus"
00012     fitFunc = ROOT.TF1(funcName,"gaus",minFit,maxFit)
00013     histo.Fit(fitFunc,option)
00014 
00015     minFit = fitFunc.GetParameter(1) - nSigmas*fitFunc.GetParameter(2)
00016     maxFit = fitFunc.GetParameter(1) + nSigmas*fitFunc.GetParameter(2)
00017     fitFunc.SetRange(minFit,maxFit)
00018     histo.Fit(fitFunc,option)
00019 
00020     return (histo,fitFunc)