Hi forum,
I have a histogram with a plateau region. For considering the uncertainties of this plateau, I fit a horizontal line and a linear line with some slope to the plateau and look for some differences.
The problem I have is, that the linear fit function called fslope does not take the values from the fit (which I see in the output), but the parameters are still the original values.
fLine = new TF1("fLine","[0]",0,1000);
fSlope = new TF1("fSlope","[0] + [1]*x",0,1000);
fLine->SetParameter(0, someinitalvalue);
histogram->Fit("fLine","","",binstart, binend)
float plateauHeight = fLine->GetParameter(0)
cout << "Plateau Height is " << fLine->GetParameter(0) << endl;
fSlope->SetParameters(plateauHeight, 0.);
//The Slope is initially set to be the same as fLine
histogram->Fit("fSlope","","",binstart, binend);
Now, I get the ouput from the Fit, which tells me that both fits (fLine & fSlope) converge and the parameter values differ as expected. However I now try to get these values with the following command, the actual parameters of fSlope are still plateauHeight and zero and not the newly fitted values.
cout << "Parameters of fSlope: p0 = " << fSlope->GetParameter(0) << " p1 = " << fSlope->GetParameter(1) << endl;
Here is an example output from the log of the fit:
fLine:
FCN=10.7144 FROM MIGRAD STATUS=CONVERGED 12 CALLS 13 TOTAL
EDM=2.29974e-15 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 2.54368e+01 3.49470e-02 5.84037e-05 -1.94064e-06
fSlope:
FCN=8.50783 FROM MIGRAD STATUS=CONVERGED 37 CALLS 38 TOTAL
EDM=2.2915e-19 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 2.58210e+01 2.61019e-01 5.26164e-05 1.93279e-08
2 p1 -1.00532e-02 6.76774e-03 1.36424e-06 7.45442e-07
As you can see, the p0 parameters should differ after the two fits, but for fslope the parameters are never updated from the fLine p0 adn zero to the new fSlope p0 and p1.
Does anybody know, why the parameters are not updated? I use ROOT v6