I have a histogram which I am trying to fit with a sum of two RooPDFs, and I define
RooRealVar b("b", "Number of background events", 0, 5000);
RooRealVar s("s", "Number of signal events", 0, 500);
How does one make an educated guess about the number of background and signal events in general?
For example, for the given histogram
The best guess is to integrate the function. For a binned distribution, this is just summing the entries in the bins. Fortunately, ROOT prints in the top corner that the number of entries is 7039.
If you have a extended RooAddPdf, you can use expectedEvents for each of the component of the two pdfs. Or you can specify the normalization coefficients you have defined with the constructor
RooAddPdf (const char *name, const char *title, const RooArgList &pdfList, const RooArgList &coefList, Bool_t recursiveFraction=kFALSE).
Could you explain why you use recursiveFraction(s?) with the RooAddPdf? At any rate, I get an error when I add this to my code.
error: use of undeclared identifier 'recursiveFractions'
...RooAddPdf fullModel("fullModel", "CxB + bg_bern", RooArgList(c_BW, bg_bern), RooArgList(s, b), recursiveFraction...
Hi, I’m just copying the function form, the parameter name, etc. You can leave the recursiveFraction argument as blank, i.e. it will take kFALSE, the default value.
However, your error is due to that you didn’t define
recursiveFractions. c++ is different from python in that when calling function, the name of parameters are not specified.