Hi everyone,
I am trying to create some toys so that I can measure the combination of several sources of uncertainties. The concept goes like this: I have a histogram which I call nominal and I fit on it a user-defined TF1 function (fnom). The nominal’s fit is ok and results to status converged.
However when I start producing my toys, there are resampled cases (a lot of them), in which the same function cannot give a converging fit.
h=dict()
Ntrials = 1000
toy = 0
while toy < Ntrials:
h[toy] = resample ( hnom ) #resamples nominal histogram
fun[toy] = function() #returns the TF1 function
h[toy].Fit( fun[toy], "0r+" )
if ROOT.gMinuit.fCstatu != "CONVERGED" : continue
#else keep on doing my stuff
I was wondering whether my check for convergence makes sense or if it’s somewhat biasing the range in which the histogram bins are being randomly resampled. How else could I make the fits more successful (got several errors with Fit 0 : Minimization failed) ? at the moment the user-defined function is defined as:
def function():
fun = ROOT.TF1("Log_power","[0]*pow(x,[1]+[2]*log(x))",400.,1150.)
fun.SetParName(0,"N")
fun.SetParName(1,"a")
fun.SetParName(2,"b")
fun.SetParLimits(2, -10.,10.)
fun.SetParLimits(0,1000,10000000.)
fun.SetParLimits(1 , 0., 100.)
return fun