IntegralError give impossible result


I want to use IntegralError function for fit integral two TH1. For first TH1 IntegralError is ok. For second IntegralError return 0, but it is impossible. What to do?

A cdoe:

auto fitResult = MPi0Rho->Fit("tot", "LS", "", inf, sup);
  auto covMatrix = fitResult->GetCovarianceMatrix();
  auto BW2_Phi = [](const double* x, const double* p) -> double {
      double E = x[0], E2 = E*E;
      double M = p[5], M2 = M*M;
      double G = p[6], G2 = G*G;
      double gamma = sqrt( M2 * ( M2 + G2 ) );
      double k = M_2_PI * M_SQRT2 * M * G * gamma / sqrt( M2 + gamma );
      std::complex<double> bw( E2 - M2, M * G );
      bw = sqrt(k)/bw;
      bw = p[3] * bw;
      return std::norm(bw);
  TF1* phi = new TF1("BW_phi", BW2_Phi, 0.980, 1.058, 12);
  phi->FixParameter(0, total->GetParameter(0));
  phi->FixParameter(1, total->GetParameter(1));
  phi->FixParameter(2, total->GetParameter(2));
  phi->FixParameter(4, total->GetParameter(4));
  phi->FixParameter(7, total->GetParameter(7));
  phi->FixParameter(8, total->GetParameter(8));
  phi->FixParameter(9, total->GetParameter(9));
  phi->FixParameter(10, total->GetParameter(10));
  phi->FixParameter(11, total->GetParameter(11));
  phi->SetParameter(3, total->GetParameter(3));
  phi->SetParameter(5, total->GetParameter(5));
  phi->SetParameter(6, total->GetParameter(6));
  cout << phi->Integral(0.98, 1.058) << endl 
       << phi->IntegralError(0.98, 1.058, fitResult->GetParams(), covMatrix.GetMatrixArray()) << endl
       << N_phi << endl;

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

You are using the “fitResult” (for function parameters and its covariance matrix) so, you should use (assuming that “total” is actually the “tot” function used for fitting):

 cout << total->Integral(0.98, 1.058) << endl 
      << total->IntegralError(0.98, 1.058, fitResult->GetParams(), covMatrix.GetMatrixArray()) << endl
      << N_phi << endl;

total” has background function, I want to calculate integral without background. For this I made “phi” function

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.