What(): SPlot input argument is not of type RooRealVar/RooLinearVar

Dear RooFit experts

I want to do a sPlot with a RooFomularVar parameter:

RooFormulaVar nbkg("nbkg", "@0/@1", RooArgList(n ,ratio));
sData = new RooStats::SPlot(“sData”,“An SPlot”, *dataset, 
                            totalpdf, RooArgList( *nsig, *nsig2 ,*nbkg) );

But the sPlot need a RooRealVar:

what(): SPlot::SPlot(sData) input argument nbkg is not of type RooRealVar/RooLinearVar

What can I do?

Thank you

Here is my way, though I don’t know if it’s right.
And actually it runs successfully.

Before do the sPlot, fit firstly and get the estimation value of the variable nbkg.
Then stop at here.

Modify program and define the RooFormulaVar variable as a RooRealVar variable:

// RooFormulaVar nbkg("nbkg", "@0/@1", RooArgList(n ,ratio));
RooRealVar nbkg("nbkg", "bkg", mynumber);

Then we can do the splot successfully.

Hi @realTay_John,

What you did seems like a possible approach, although I will invite @jonas to the topic as he may be able to suggest something more straightforward.


Thank you. I found the official solution:
ratios as yield parameters

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