Problem with Minuit


ROOT Version Welcome to ROOT 6.10/08
Scientific Linux release 7.4 (Nitrogen), gcc version 7.2.0 (GCC)


Hello!

I’m trying to executing the small test program for Minuit:

The code:

#include
#include “TMinuit.h”

void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *u, Int_t flag) {
f=u[0]*u[0]+u[1]*u[1];
std::cout<<“par=”<<u[0]<<" f="<<f<<" flag="<<flag<<std::endl;
}

void fittest() {
TMinuit minuit(2);
minuit.SetFCN(fcn);
Double_t param[10];
param[0]=1;
Int_t iflag,ierflg;
minuit.mnexcm(“SET ERR”,param,1,iflag);
std::cout<<“seterr flag=”<<iflag<<std::endl;
std::cout<<iflag<<std::endl;
minuit.mnparm(0,“par1”,1,0.1,-10,10,ierflg);
minuit.mnparm(1,“par2”,2,0.1,-10,10,ierflg);
std::cout<<“par flag=”<<ierflg<<std::endl;
minuit.mnexcm(“CALL FCN”,param,1,iflag);
std::cout<<“callfcn flag=”<<iflag<<std::endl;
minuit.mnexcm(“MIGRAD”,param,2,iflag);
std::cout<<“migrad flag=”<<iflag<<std::endl;
}

The output:

root [0] .L minuit_test.C+
root [1] fittest()


** 1 **SET ERR 1


seterr flag=0
0
PARAMETER DEFINITIONS:
NO. NAME VALUE STEP SIZE LIMITS
1 par1 1.00000e+00 1.00000e-01 -1.00000e+01 1.00000e+01
2 par2 2.00000e+00 1.00000e-01 -1.00000e+01 1.00000e+01
par flag=0


** 2 **CALL FCN 1


par=1 f=5 flag=1
FCN=5 FROM CALl fcn STATUS=RESET 1 CALLS 1 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS PHYSICAL LIMITS
NO. NAME VALUE ERROR NEGATIVE POSITIVE
1 par1 1.00000e+00 1.00000e-01 -1.00000e+01 1.00000e+01
2 par2 2.00000e+00 1.00000e-01 -1.00000e+01 1.00000e+01
callfcn flag=0


** 3 **MIGRAD 1 2.234e-316


START MIGRAD MINIMIZATION. STRATEGY 1. CONVERGENCE WHEN EDM .LT.2.23e-319
par=1.001 f=5.002 flag=4
par=0.999 f=4.998 flag=4
par=1 f=5.004 flag=4
par=1 f=4.996 flag=4
FCN=5 FROM MIGRAD STATUS=INITIATE 4 CALLS 5 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 par1 1.00000e+00 1.00000e-01 1.00506e-02 1.98997e+01
2 par2 2.00000e+00 1.00000e-01 1.02064e-02 3.91918e+01
CALL LIMIT EXCEEDED IN MIGRAD.
MIGRAD TERMINATED WITHOUT CONVERGENCE.
FCN=5 FROM MIGRAD STATUS=CALL LIMIT 4 CALLS 5 TOTAL
EDM= unknown STRATEGY= 1 NO ERROR MATRIX
EXT PARAMETER CURRENT GUESS STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 par1 1.00000e+00 1.00000e-01 1.00506e-02 1.98997e+01
2 par2 2.00000e+00 1.00000e-01 1.02064e-02 3.91918e+01
NO ERROR MATRIX
migrad flag=4

Thy the mimimization doesn’t work in fact?

Thanks.

@moneta will be able to help you with this question.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.