Dear experts,
After fitting a PDF composed of a signal and a background component, I’m trying to get the integral of the signal with its error in a given range, different from the one I used to fit the total PDF.
Taking inspiration from other posts found in this forum, I made the attempt that you can see below. Unfortunately, the error that I obtain from that seems to be always largely overestimated (I compare it with the one that I get from the fit itself, setting the fitting range to be the same as the integral estimation range, as a test).
Does this have anything to do with the fact that when I consider only the signal component I’m actually neglecting correlations of my parameters with the parameters of other components, which are in turn bound by the fit?
What is the right way to obtain the proper error on the integral of a PDF component in a given range, after a fit?
Thank you!
RooArgSet prodSet(*m_sig); //my signal component, after the fit
prodSet.add(*m_nsig); //the yield of my signal component, after the fit
double sigval = m_nsig->getVal();
RooProduct *unNormPdf = new RooProduct("fitted Function", "fitted Function", prodSet);
RooArgSet *pars = unNormPdf->getParameters(*m_var);
RooArgList l_m_var = RooArgList(*m_var);
RooArgList l_pars = RooArgList(*pars);
TF1 * m_sig_asTF = unNormPdf->asTF(l_m_var, l_pars)
double left_edge = m_var->getMin(); //fitting range
double right_edge = m_var->getMax(); //fitting range
cout<<"min "<<min<<endl; //integration range
cout<<"max "<<max<<endl; //integration range
Double_t integ_full = m_sig_asTF->Integral(left_edge, right_edge);
Double_t integ_scaled = sigval*m_sig_asTF->Integral(min, max)/integ_full;
Double_t integ_err = m_sig_asTF->IntegralError(min, max, 0, fitRes->reducedCovarianceMatrix(*pars).GetMatrixArray()); //fitRes is the RooFitResult of my fit
Double_t integ_err_scaled = sigval*m_sig_asTF->IntegralError(min, max, 0, fitRes->reducedCovarianceMatrix(*pars).GetMatrixArray())/integ_full;
//Neither integ_scaled nor integ_err_scaled seem to return a plausible error