TMinuit::SetFCN() trouble

From: Gerco Onderwater (onderwat@nialas.npl.uiuc.edu)
Date: Tue Nov 30 1999 - 16:47:56 MET


Hi Rooters,

I'm experiencing the following problem with minuit:  I define my own
minimization function and let minuit know about it using SetFCN. 
Furthermore, I defined my function in such a way that when called with
flag=2, it will compute the array of first derivatives gin with respect to
each of its parameters, so that I can use the gradient option.

The problem now is, that when I fix one of the parameters (or when one of
the parameters gets fixed for a Minos error estimation, for example), the
variable npar passed to the minimization function changes (it becomes the
number of not-fixed parameters). However, there is no notion what so ever
in the function on which one of the variables was fixed. And therefore,
the meaning of the various fields in the gradient-array gin is also
obscured (I guess). 

What is the best way to circumvent this behaviour (except not using the
grad-option)? Neither H1FitChisquare nor H1FitLikelihood have a (working)
implementation of this option, so an example would be nice. And of course
some documentation on what the meaning of the flag is actually supposed to
be would be helpful.

I'm using version 2.22/09 with Debian Linux on a Pentium PC. A little demo
macro to show the effect and its output are attached.

Looking forward to a solution,

-- Gerco

Dr. C.J.G. Onderwater
Nuclear Physics Laboratory
312 Loomis Laboratory of Physics
University of Illinois at Urbana-Champaign
1110 West Green Street
Urbana, IL 61801-3080     
Phone : (217) 244-7363
Fax   : (217) 333-1215  
E-mail: onderwat@uiuc.edu



******************************************* * * * W E L C O M E to R O O T * * * * Version 2.22/09 13 July 1999 * * * * You are welcome to visit our Web site * * http://root.cern.ch * * * ******************************************* FreeType Engine v1.1 used to render TrueType fonts. CINT/ROOT C/C++ Interpreter version 5.14.8, Jul 4 1999 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. PARAMETER DEFINITIONS: NO. NAME VALUE STEP SIZE LIMITS 1 a 0.00000e+00 1.00000e-01 no limits 2 b 0.00000e+00 1.00000e-01 no limits 3 c 0.00000e+00 1.00000e-01 no limits ********** ** 1 **SET PRINTOUT 3 ********** ********** ** 2 **SET GRADIENT 1 ********** NPAR = 3 FIRST CALL TO USER FUNCTION AT NEW START POINT, WITH IFLAG=4. NPAR = 3 NPAR = 3 NPAR = 3 NPAR = 3 NPAR = 3 NPAR = 3 NPAR = 3 CHECK OF GRADIENT CALCULATION IN FCN PARAMETER G(IN FCN) G(MINUIT) DG(MINUIT) AGREEMENT 1 a 1.0000e+00 1.0000e+00 1.0000e+00 GOOD 2 b 1.0000e+00 1.0000e+00 1.0000e+00 GOOD 3 c 1.0000e+00 1.0000e+00 1.0000e+00 GOOD ********** ** 3 **FIX 1 ********** FCN=0 FROM FIX STATUS=RESET 0 CALLS 8 TOTAL EDM= unknown STRATEGY= 1 NO ERROR MATRIX EXT PARAMETER CURRENT GUESS PHYSICAL LIMITS NO. NAME VALUE ERROR NEGATIVE POSITIVE 1 a 0.00000e+00 fixed 2 b 0.00000e+00 1.00000e-01 3 c 0.00000e+00 1.00000e-01 ********** ** 4 **SET GRADIENT 1 ********** NPAR = 2 NPAR = 2 NPAR = 2 NPAR = 2 NPAR = 2 CHECK OF GRADIENT CALCULATION IN FCN PARAMETER G(IN FCN) G(MINUIT) DG(MINUIT) AGREEMENT 2 b 1.0000e+00 1.0000e+00 1.0000e+00 GOOD 3 c 0.0000e+00 -5.4321e+04 5.4321e+04 NONE AGREEMENT=NONE MEANS FCN DID NOT CALCULATE THE DERIVATIVE MINUIT DOES NOT ACCEPT DERIVATIVE CALCULATIONS BY FCN TO FORCE ACCEPTANCE, ENTER *SET GRAD 1*



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET