RooRealSumPDF components

Hello,

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:

https://root.cern.ch/doc/master/rf709__BarlowBeeston_8C.html

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:

model1.plotOn(frame, Components(p_ph_sig1), LineColor(kAzure));

So, I was wondering if there is an easy way to get a handle of this (or any) Component ?

Thanks a lot and bests,
Balint

Hello,

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:

 x.setRange("window",-20,20);
 RooAbsReal * integral_sig1 = p_ph_sig1.createIntegral(RooArgSet(x), RooArgSet(x), "window");
 Double_t Asig1val = Asig1.getVal();
 Double_t Asig1val_err = Asig1.getError();
 Double_t integval_sig1 = integral_sig1->getVal();
 Double_t dintegval_sig1 = integral_sig1->getPropagatedError(*result1, RooArgSet(x));
 cout << "Asig1 : " << Asig1val << " +/- " << Asig1val_err << endl;
 cout << "Signal Integral : " << integval_sig1  << " +/- " << dintegval_sig1  << endl;

 RooAbsReal * integral_bkg1 = p_ph_bkg1.createIntegral(RooArgSet(x), RooArgSet(x), "window");
 Double_t Abkg1val = Abkg1.getVal();
 Double_t Abkg1val_err = Abkg1.getError();
 Double_t integval_bkg1 = integral_bkg1->getVal();
 Double_t dintegval_bkg1 = integral_bkg1->getPropagatedError(*result1, RooArgSet(x));
 cout << "Abkg1 : " << Abkg1val << " +/- " << Asig1val_err << endl;
 cout << "Bkgr Integral : " << integval_bkg1  << " +/- " << dintegval_bkg1  << endl;

For the example with 50 signal and 1000 background events I get:

Asig1 : 0.850507 +/- 0.235778
Signal Integral : 80.026 +/- 11.3836
Abkg1 : 0.06138 +/- 0.235778
Bkgr Integral : 15999.6 +/- 160.01

And multiplying the corresponding factors’ best-fit values one gets indeed values back close to the original input values (50 [Sig] and 1000 [Bkgr]).

Cheers,
Balint

Hey,

yes, well done. :+1:

In words, this is:

  • Integrate the single components in the desired range after the fit. (After because you want to get the integral with the post-fit parameters.)
  • Multiply result with the scale factors of the RooRealSumPdf.

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