Hi,
I have two RooFit question which I have not been able to solve.
- Is it at all possible to obtain from a RooAddPdf one of its RooAbsPdf components and then intergate under this curve; after performing a fit to data?
From the following Code:
RooRealVar sigmean("#mu","mass", fpar, fmin, fmax);
RooRealVar sigwidth("#sigma","width",fw, fwmin, fwmax);
RooGaussian sig("sig","signal", fit_var,sigmean,sigwidth);
// --- Build Expo background PDF ---
RooRealVar a("#tau_{bkg}", "a", -1e-3, -1.0, 0.0);
RooExponential bkg("bkg", "expo", fit_var, a);
// --- Construct composite PDF ---
RooRealVar nsig("nS","number of signal events",500, 0.,15000);
RooRealVar nbkg("B","number of background events",(exsig), 0.,15000);
RooAddPdf sum("sum","gauss",RooArgList(sig, bkg),RooArgList(nsig, nbkg));
RooFitResult* r = sum.fitTo(*data,"ehr");
r->Print();
Is it possible to then get the sig pdf like:
RooAbsPdf *signal = sum.Component->Find(“sig”);
And then integrate it:
signal->Integrate(fit_var_min, fit_var_max); ???
Aside:
Not at all obvious to me how you integrate a RooAbsPdf?
With a RooCurve, on a RooPlot, it was easy to obtain the integral, since the curves value at a given point, could be extracted with Eval() and then the integration could proceed using a simple integration method.
- Is there a way of obtaining the bin content of a RooPlot. If I do
my_plot->GetBinContent(bin_i)
Im returned zero?
Any help is appreciated.
Thanks,
Colin.