bug in TMinuit calling "fcn" function

stefan kluth (skluth@mh1.lbl.gov)
Fri, 8 Jan 1999 17:12:24 -0800 (PST)


Hi,

with root 2.20/06 I find that in

void fcn( Int_t &npar, Double_t *gin, Double_t &f,
Double_t *par, Int_t iflag) {

// my fit code

}

which is called by MINUIT through TMinuit the parameter iflag is not
passed correctly. Even calling fcn explicitly with

...
arglist[0]= 4;
gMinuit->mnexcm( "CALL", arglist, 1, ierflg );
...

I get nonsense (i.e something like iflag= 6585878) for iflag in fcn. This
is bad, because traditionally in MINUIT style fits one has if-blocks in
the fcn function which test the value of iflag to initialise, calculate
the fit function or do some final calculation after the fit is done. At
the moment, I have a workaround by using an extra constant fit parameter
to pass a value for iflag, but this is quite ugly.

cheers, Stefan

---Stefan Kluth---------------Lynen Fellow----------------|\--|\-------
- LBNL, MS 50A 2160 - phone: +1 510 495 2376 - |/ |/ -
- 1 Cyclotron Rd. - fax: +1 510 495 2957 - |\/\|\/\|' -
---Berkeley, CA94720, USA-----e-mail: SKluth@lbl.gov------|/\/|/\/|----