Home | News | Documentation | Download

createIntegral from RooWorkspace

Hello,
I am trying to calculate integral of a pdf funtion in a given range. I have saved the function in a RooWorkspace and I am able to load the pdf and the variable as below -

RooWorkspace w = (RooWorkspace )SR->Get(“pol2”);
RooAbsPdf
pol2SR = w->pdf(“pol2”);
RooRealVar
normSR = w->var(“norm”);
RooRealVar* massSR = w->var(“mass”);
massSR.setRange(“bin1”,14., 15. );

auto shape = pol2SR->createIntegral(massSR, RooFit::NormSet(massSR), RooFit::Range(“bin1”));

However, since massSR is not of the form RooArgSet& as required by NormSet, it is not working. Is there a way to fix this issue ?

Thanks !
Best,
Shreya

Hi ,
You can create a RooArgSet from one or many RooAbsArg objects (i.e. also a RooRealVar). Just do:

auto shape = pol2SR->createIntegral(massSR, RooFit::NormSet(RooArgSet(*massSR)), RooFit::Range(“bin1”));

Lorenzo

Thank you very much ! I will try it out now :slight_smile:
Best,
Shreya