Hi experts.
I fit two types of function(pol2+gaus, gaus) and integrate the gaus function.
void MultiFitIntegral()
{
double initparms[] = {68.37, 2.9, 0.51, 24.1, -8.2, 0.74};
TF1 *f1 = new TF1("f1","gaus(0)+pol2(3)");
f1->SetParameters(initparms);
hdet_y->Fit(f1,"R","",0,6);
double initparms2[] = {68.37, 2.9, 0.51};
TF1 *f2 = new TF1("f1","gaus");
f2->SetParameters(initparms2);
f2->SetLineColor(kBlue);
hdet_y->Fit(f2,"R+","",0,6);
auto fitresult = hdet_y->Fit(f2,"S","",0,6);
double integral = f2->Integral(0,6);
auto covMatrix = fitresult->GetCovarianceMatrix();
std::cout << "Covariance matrix from the fit";
covMatrix.Print();
double sigma_integral = f2->IntegralError(0,6,fitresult->GetParams(),covMatrix.GetMatrixArray());
std::cout << "Integral = " << integral << " +/- " << sigma_integral << std::endl;
}
But as shown in under picture, only gaus function is shown.
What should i do?
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided