Well, I am making a little bit of progress. It turns out that, because of some subtleties in the configuration files, I was compiling one library and linking against another. Not good. I’ve got three different packages that I make modifications to, plus my own program that links them. Then, some of the packages use other parts of the BaBar software. In the ordinary course of things everything is set up so it links automatically, but when you want to do something unusual against a custom version of ROOT, all that falls apart and you have to figure out all the links from scratch, and modify Makefiles and env variables accordingly. Since the default scripts are the result of dozens of bright scientists working for the best part of a decade, this is nontrivial. But I’ve got it now to the point where I can insert code in the MINUIT fit library and have it run.
So now I’m back to my original problem, namely, why is the fit trying to set my parameters to NaN? This is where the aptly named ‘fU’ variable comes in. MINUIT is the fitting library, and knows nothing about what you’re trying to do; it just runs a smart search algorithm to find the minimum point of a supplied function over a given parameter space. Internally, it searches each parameter from minus to plus infinity; usually, though, you want to limit the actual search space. So there’s a transformation from MINUIT-internal to your external variables, and the fU array is what gets passed to your function telling it “This is where I’m searching right now, what’s the function value here?”
At any rate, this array is being filled with NaN values, and I’ve been struggling for days on end to figure out why. I’ve now traced it to the method ‘mninex’ – this is a C transcription of FORTRAN code, and it shows. (Looking over it with my supervisor yesterday, he was surprised to learn that C++ actually has a GOTO construct. He’d never seen it used before. Neither have I in serious code, come to think of it.) Lovely variable names like l65, fWord7, mninex, and of course the famous fU. At any rate, mninex is just the part that does the transform from internal to external; so I’ve traced the problem one step back, and now need to find why the internal coordinates are being set to NaN. I do note, the values just before that happens look sort of dodgy as well; they are very close to the limits, where they ought not to be. So I may just be seeing a symptom of something else wrong with the fit.