[RooStats] significance with conditional observable

Hi all,

I have a pdf with a conditional observable (I’m doing a mass fit with a per-event error resolution) and I would like to evaluate the significance of the signal hypothesis given some data.

I’m trying to do this with RooStats but it seems to me it doesn’t use the ConditionalObservables(var) option when doing the fits on my pdf.

Right now I use the ProfileLikelihoodCalculator and the ProfileLikelihoodTestStat test statistics.
I tried setting the ModelConfig with option


but the result does not change if I set or unset it.
And anyway the result is wrong: doing a likelihood ratio “by hand” I obtain one significance value.
If I remove the ConditionalObservables(var) option in my code, I obtain the wrong result obtained by ProfileLikelihoodCalculator

Is there a way to tell RooStats to do the fits with the ConditionalObservables(var) option?

Thank you,

Can you please attach to the forum your workspace file, so I can look in detail at this problem and in case fix the ProfileLikelihoodCalculator class,

Thank you


Ciao Lorenzo,

thank you very much for helping.
I send my workspace.

The pdf is called “pdf_ext_total”, as a function of variable “Mass” and conditional to “MassRes”.
The parameters of interest are “N_bs” and “N_bd”, which, for the null hypothesis, are equal to zero.
The conditional observable is “MassRes”.
So I would like RooStats fit the pdf with this command somehow:

ws->pdf("pdf_ext_total")->fitTo(*data, ConditionalObservables(*ws_->var("MassRes")));

Can you take a look?
Thank you,
ws.root (26.3 KB)


Is the data set to fit in the workspace ? Which one is it ? Will be easier also if the ModelConfig is imported in the workspace so the information on the pdf, observables, poi, etc… is saved in the workspace


Ciao Lorenzo,

in the attachment there is a workspace containing also a random RooDataSet, named global_data and the ModelConfig, called model.

By hand, I obtain a significance of 1.4954 sigma.
If I run the ProfileLikelihoodCalculator I obtain 1.6797 sigma, which I obtain if I don’t use the ConditionalObservables(*ws_->var("MassRes")) option in fitTo.

I hope this helps you in implementing this option.
Actually I need it implemented in the ProfileLikelihoodTestStat class too.

conditionalws.root (36.3 KB)


Thank you for your example. I have now fixed in the RooStats code the calculators to correctly deal with the global observables.
You can try in the current trunk (after SVN revision 46081). I will commit this fix also in the 5.34 patches

Best Regards


Ciao Lorenzo,

thank you very much, I’ve just tested with 5.34/02 and ProfileLikelihoodCalculator::SetConditionalObservables(RooArgSet) works as expected.

I have a little question on ProfileLikelihoodTestStat.
I can set the Conditional Observables with


but also within the two models I use:


The two ways print different test statistic evaluated on data:
the first:

  • Test statistic evaluated on data: 2.24513

the second:

  • Test statistic evaluated on data: 7.25213

I presume the first is the correct one.
Is this a bug or do they mean different things?


Hi Luca,

Setting in the ModelConfig is not sufficient, you need also to set also in the ProfiledLikelihoodTestStat class, since the test statistic class it is not built from the ModelConfig, but directly passing the model pdf instance. So the first one, as you presumed, should be the correct one.