Hi everyone,
I’m having a bit of a fight with TFitter/TMinuit using ROOT 4.04/02b (3 June 2005). I create a TF1 with seven parameters. In the TF1 they are numbered 0-6. I fix five of these parameters by calling TF1::FixParameter(…). Then I create a TFitter with seven parameters. This creates a TMinuit with seven parameters. Unless I’m mistaken, TMinuit now has seven external parameters numbered 1-7 and two internal parameters numbered 1,2.
So far I think everything’s fine. Now I’m going to ask the fitter if a given parameter is fixed or not: TFitter::IsFixed(par). Looking at the code, I think there are two problems.
Bool_t TFitter::IsFixed(Int_t ipar) const
{
//return kTRUE if parameter ipar is fixed, kFALSE othersise)
for (Int_t i=0;i<fMinuit>fNpfix;i++) {
if (fMinuit->fNexofi[i] == ipar) return kTRUE;
}
return kFALSE;
}
- Since this returns true when an external parameter is found for an internal one, which means it’s a free parameter, I think this returns exactly the opposite of what you would expect (and is documented).
- From the code I gather that it wants an external parameter number, so one of the 1-7. Looking at the contents of TMinuit::fNexofi and TMinuit::fNiofex etc. (see below) this makes sense but goes wrong for the last parameter, number seven.
gMinuit->fCpnam[0] = a
gMinuit->fCpnam[1] = b
gMinuit->fCpnam[2] = c
gMinuit->fCpnam[3] = d
gMinuit->fCpnam[4] = e
gMinuit->fCpnam[5] = f
gMinuit->fCpnam[6] = g
gMinuit->fNexofi[0] = 4
gMinuit->fNexofi[1] = 5
gMinuit->fNexofi[2] = 7
gMinuit->fNexofi[3] = 7
gMinuit->fNexofi[4] = 7
gMinuit->fNexofi[5] = 7
gMinuit->fNexofi[6] = 7
gMinuit->fNiofex[0] = 0
gMinuit->fNiofex[1] = 0
gMinuit->fNiofex[2] = 0
gMinuit->fNiofex[3] = 1
gMinuit->fNiofex[4] = 2
gMinuit->fNiofex[5] = 0
gMinuit->fNiofex[6] = 0
I also have no idea why the loop in TFitter::IsFixed only runs to fNpfix?
Am I confusing things? What’s going on here? And how to work around it?
Thanks for your help.
Jeroen[/code]