RooFit ProtoData: correct use?

Hi,

I would like to make a distribution for a discrete observable. Normally Root assigns equal weights to each type, but I would like to change this. For example to 25% B + 25% Bbar + 50% untagged. Reading the available material about discrete observables it seems the way to go is to use ProtoData when generating events: make a small set for the RooCategory and put in there (for the example) 4 events (1 B, 1Bbar and 2 untagged).

However, when plotting my model this seems to mess up my data points; they no longer lie on top of the PDFs. So, what am I doing wrong?

More about the problem:

  • It seems to happen with Root 5.28 but not with Root 5.24
  • Everything is fine when not using ProtoData
  • I have tried to isolate the problem in the code in the attachment. It is still quite long, but it seems the minimum to me: The model consists of mass PDF(m) X time PDF(t,tag) with tag the RooCategory that causes the problems when plotting the mass PDF.

Thanks,
Kristof
Test.C (10.2 KB)
Test_output.pdf (16.7 KB)