[RooFit] Conditional observables in yield variables

I have found what may be a bug. It came up when fitting to extract a yield from events where each event has a weight that is determined a priori. I’ve attached a macro that demonstrates the problem.

I’m basically doing is

RooFormulaVar Nf(“Nf”, “@0/@1”, RooArgList(N, wgt));
RooExtendPdf pdfN(“pdfN”, “pdfN”, pdf, Nf);

if I fix the wgt to a number then things look good. But when wgt is a conditional observable then they turn out badly. Am I implementing this incorrectly? I’m pretty sure I could write down a likelihood on paper if really pressed so I don’t think it is fundamentally flawed.

Any ideas?


p.s. the output from my code that shows the problem is this

RooDataSet::gNData[x] = 1999 entries
RooDataSet::wgtGData[wgt,x] = 1999 entries
9995 weighted events from fit to data.
1999 raw events from fit to data.
11937 weighted events with conditional fit.
10003.6 sum of weights in data2.
2385.34 raw events from conditional fit.
1999 sum of weights/ in data2
condAndWgtFitterTest.cc.gz (685 Bytes)


I was having a similar issue and was wondering if anybody had any ideas. :slight_smile:

Thanks! Charles


There was a bug in the handling of weights in the extended terms of likelihoods, which affected your example. This has been fixed for ROOT 5.28 (due tomorrow)


Hi Wouter,

I finally got around to trying this with 5.28. Same results as before. I don’t see any change. This is with RooFit v3.14.