Fitting in log and linear scales (limits in parameters?)

My question is not complicated but I don’t know if it has to do with innerworkins of ROOT.

I have a histogram to which I want to fit a function I defined. If I do

hist->Fit("trace")

I get some output. If then I do

gPad->SetLogy()
hist->Fit("trace")

the output is different and if I then change the scale manualy, with the mouse, over the pad and then do the fitting again I get yet another answer. From all these, the one that looks best is the last one. I noticed that in the first two cases it gave me a negative parameter (that would be responsible for a zero in the function that can’t happen in log scale) and in the last one the parameter is positive, as it should be. I also tried limiting the parameter with

func->SetParLimits(5,0,1e19);

What is happening that gives me all these different answers? I would just like to reproduce whatever happened the time it worked, but that is when I change the scale manually. I’d like to do it on a script.

Javier

P.s.: for the record, I’m attaching a file with the histogram and a file that contains all the instructions I made
logFitting.tar (10 KB)

please send your file trace.C

Rene

oops

sorry, here I’m leaving the file trace.C

Javier
trace.C (313 Bytes)

You should set the fit parameters to the same values before fitting if you want to get the same results. The problem has nothing to do with setting the pad in log scale.

Rene