ROOT Version: 6.26/06
Platform: Scientific Linux 7.3 (Nitrogen)
Compiler: g++ (GCC) 12.1.0
Hi ROOTers, I have what I think is a real head-scratcher. I have the following lines in a compiled file:
hcalout_eta[i]->Fit("myexpo", "N", "", fitmin, fitmax);
std::cout << hcalout_eta[i]->GetFunction("myexpo") << std::endl;
f2f = (TF1 *) hcalout_eta[i]->GetFunction("myexpo");
std::cout << f2f << std::endl;
Where myexpo
is a user defined function.
The output is:
FCN=921.949 FROM MIGRAD STATUS=CONVERGED 67 CALLS 68 TOTAL
EDM=2.66807e-09 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 2.99920e-01 4.98635e-04 5.44379e-06 1.92797e-01
2 p1 1.06291e+00 7.12072e-04 7.77442e-06 -6.58834e-02
0
0
Where the two 0
s are from printint out the return value of GetFunction
. Later, I call GetParameter
on f2f
, and the code segfaults.
This doesn’t make any sense to me - the fit converges, and in the very next line I try to access the result of the fit, but it doesn’t seem to work - I just get back a null pointer. Why would this happen? Am I missing something obvious? Thanks!