If your pdf is extended, the simultaneous pdf can automatically find the data needs to generate for each category, using the category expected events.
Otherwise I think you can use the ProtoData option of RooAbsPdf::generate

If your pdf is extended, the simultaneous pdf can automatically find the data needs to generate for each category, using the category expected events.
Otherwise I think you can use the ProtoData option of RooAbsPdf::generate

Best Regards

Lorenzo[/quote]

Hello, thank you for your reply.

My pdf is not extended. Protodata seems to be a very strange way to generate day… I have to generate first data with the correct shape (N1 events for the first category, N2 for the second, …)

At the end I have solved as I said, fixing the problem (bug?)

Before:

data = ROOT.RooDataSet("data", "combined data", ROOT.RooArgSet(x, cat))
cat.defineType("cat1")
cat.setLabel("cat1")
data1.generate(100)
data1.addColumn(cat)
data.append(data1)
... same for data2 ...

now I define first all the categories:

data = ROOT.RooDataSet("data", "combined data", ROOT.RooArgSet(x, cat))
cat.defineType("cat1")
cat.defineType("cat2")
...
cat.setLabel("cat1")
data1.generate(100)
data1.addColumn(cat)
data.append(data1)
... same for data2 ...

I don’t know why the first approach crash, while the second works