I need your help
I am fitting data with minuit in ROOT in python enviroment (jupyter notebook)
My PDF is an exponential:
def pdf(x, *x0):
f=(1/x0[0])*np.exp(-x/x0[0])
return f
I define the Likelihodd function:
def LHM(*x0):
n= invariant_mass.GetNbinsX()
f=1
for i in n:
frec= invariant_mass.GetBinContent()
x = invariant_mass.GetBinCenter()
f = f*(pdf(x,*x0))**(frec)
f=-2*np.log(f)
return f
The minuit fitting procedure:
minuit= ROOT.TVirtualFitter.Fitter(0,3)
minuit.SetParameter(0,"lambda",10,0.01,0,0)
minuit.SetFCN(LHM)
arglist = np.empty(100)
arglist[0]=0.0
minuit.ExecuteCommand("SET PRINT", arglist,1)
The problem begins here:
arglist[0]=500.0
arglist[1]=0.01
minuit.ExecuteCommand("MIGRAD", arglist, 2)
The problem is the third argument the int “2”. This is the error message:
TypeError Traceback (most recent call last)
Cell In[411], line 8
5 arglist[0]=500.0
6 arglist[1]=0.01
----> 8 minuit.ExecuteCommand("MIGRAD", arglist, 2)
TypeError: int TFitter::ExecuteCommand(const char* command, double* args, int nargs) =>
TypeError: 'int' object is not iterable
**********
** 60 **MINIMIZE 500 0.01
**********
I have tried putting an int in C++ type, range(2), and other options, but none of them seem to work. I would appretiate your help.