TF1 IntegralError(): TFitResult problems

I am trying to use IntegralError on a fit, but it’s a little more complicated than that.

Let’s start off with the fit. I call it my ‘total fit’ because it is actually the combination of three different fits, a gaussian, a landau times an exponential, and another gaussian. It is created like this:
TF1 *fg0_prov = new TF1(“fg0_prov”,“gaus(0)+([3]*TMath::Exp([4]*x)*TMath::Landau(x,[5],[6],0))+gaus(7)”,-15,10);

I save this total fit like so:
TFitResultPtr fg0_results = tpc0->Fit(fg0,“RS0”);

Now I am trying to do IntegralError on each of the individual fits, so find the error on the gaussian fit, the landau times exponential fit, and the other gaussian fit. IntegralError requires four parameters, the upper and lower bounds of the integral, the parameters of the fit, and the covariance matrix.

My problem right now is getting the parameters of the fit for the individual fits from the total fit. If I was just doing the total fit, it would look something like this:
TFitResult fTotalParameters = (TFitResult)fileFitResult->Get(“2.0GeVto2.5GeVFitParameters”);
total1->IntegralError(-0.7,4,fTotalParameters->GetParams(), fElecParameters2_25->GetCovarianceMatrix().GetMatrixArray());

I tried to get the parameters for the individual fits like so…
TFitResult fGauss1Parameters={f_parameters2_25->GetParams()[0], f_parameters2_25->GetParams()[1], f_parameters2_25->GetParams()[2]};
TFitResult fLandauParameters={f_parameters2_25->GetParams()[3], f_parameters2_25->GetParams()[4], f_parameters2_25->GetParams()[5], f_parameters2_25->GetParams()[6]};
TFitResult fGauss2Parameters={f_parameters2_25->GetParams()[7], f_parameters2_25->GetParams()[8], f_parameters2_25->GetParams()[9]};

But got the error:
error: no matching constructor for initialization of ‘TFitResult’
with an arrow pointing to the third value in the {} brackets.

How else do I parse the parameters so I can get the errors on the integrals of the individual fits?

Here is the full snippet of the code below. Let me know if any more information is needed:
TFitResult fTotalParameters = (TFitResult)fileFitResult->Get(“2.0GeVto2.5GeVFitParamters”);

TFitResult fGauss1Parameters={fTotalParameters->GetParams()[0], fTotalParameters->GetParams()[1], fTotalParameters->GetParams()[2]};

TFitResult fLandauParameters={fTotalParameters->GetParams()[3], fTotalParameters->GetParams()[4], fTotalParameters2_25->GetParams()[5], fTotalParameters->GetParams()[6]};
TFitResult fGauss2Parameters={fTotalParameters->GetParams()[7], fTotalParameters->GetParams()[8], fTotalParameters->GetParams()[9]};

double gauss1Err2_25=KaonProtonFit2_25->IntegralError(-0.7,4, fGauss1Parameters->GetParams(), fGauss1Parameters->GetCovarianceMatrix().GetMatrixArray());
double landauErr2_25=total1Pion->IntegralError(-0.7,4,fLandauParameters->GetParams(), fLandauParameters->GetCovarianceMatrix().GetMatrixArray());
double gauss2Err2_25=total1->IntegralError(-0.7,4,fGauss2Parameters2_25->GetParams(), fGauss2Parameters->GetCovarianceMatrix().GetMatrixArray());

Hi Josephina,

Thanks for the post and welcome to the ROOT forum.
You provided a lot of details of the interesting problem you are trying to solve.
But could you perhaps provide a minimal reproducer that exhibits the behaviour you believe is problematic?

Best,
Danilo