Problems(!) with fittings in a loop

Hallo, I have a similar problem to this post

I have a user defined fit function (written in a separate script), but included into the main script.

Now when i was writing and customising the scripts, I was just fitting one histogram and everything works perfectly fine (well as expected).
But I actually have 64 histograms, so now that I got it working for one I looped over all histograms … this is where the problems occur. Root gives funny fit lines to the histograms, sometimes drawing more than one fit on the same histogram.

It looks like some unclear memory problem due to the recursion. is there anyway to make root forget the last fit?

Be warned, if u ask for ‘the shortest possible runinning script’, you’ll receive 1data file, one fit script and one main script. Thats not meant to put you off :smiley: Oh, and I’m not using TMinut.

Problem solved.

Was some coding error.
I drew the fit within the fit function.
Now when I called it in the main script, I was effectively drawing 2 fits.

:blush: I honestly do try everything before posting. Now its not my fault everything is never enough :blush:

Now i have a new problem, and I’ve tried everything!

I want to GetParamters from the fit functions to use in calculations in the main script.

I intialise and pass an array into the fit function to extract these parameters.
Thats ok.
But when I loop (reinitialise the array and pass it into the function again), it doesn’t return the parameters as the ones printed out by default on the extern window, but as what I gave the fit function as ‘starting’ parameters.

How do I solve this one?