I am following the Barlow-Beeston example of RooFit to create template pdfs from bkg and sig MC, and to propagate the MC stat uncertainty into the fit:

It works nicely, however, I can’t figure out at the end of this example how does one extract the Signal component only from the RooRealSumPDF and integrate it with the errors propagated?

Do I have to recreate the Signal component PDF from the original template PDF and set the best fit parameters to it with the A coefficients and use the covariance matrix from the fit to get the propagated error? Or is this already done in RooFit under the hood? I am guessing yes, because the plotOn function can separately extract and plot the Signal component with errors:

at the end I think I have figured it out based on another Forum discussion. These lines I paste below seem to get the coefficients and the integrals of the functions in the RooRealSumPdf back correctly: