I am trying to optimize a fitting function and I use a TFitPointer object to access the result of a fit (the type of the fir varies with respect to the given function). At some points the fit might fail and then the TFitPointer will be empty. I try to avoid such occasions by doing the followinf checks:
TFitPointer fitResult = 0;
...... // Fitting code here //........
if (fitResult->IsEmpty() || !(fitResult->IsValid())) {return -3;}
else { ... saving the fit ...... }
Somehow though, just by doing the operation fitResult->IsEmpty() or fitResult->IsValid() root is trying to access the pointer which is i guess Null and I get an error:
Warning in : Fit data is empty
Error in : TFitResult is empty - use the fit option S
Is there any way to protect against this? I tried using using using :
if (fitResult == NULL) {…}
or
if (!fitresult) {…}
but neither seems to work. Any suggestions??
Thanks a lot!!!
_ROOT Version: 5.34 / 36 Platform: Windows Compiler: MSVS 2013