I am currently trying to do a simultaneous fit in several variables/distributions in order to extract the number of events of given processes.
The first example  I came up with uses two distributions (in this example they are identical):
histograms_1 & histograms_2.
Further for each distribution I have the observed data, a signal template/pdf and a background template/pdf.
I use the latter to construct two models. So far everything works.
Now I would like to combine the two observed data samples:
combined_data = deepcopy( roofit_histograms_1['data'] )
combined_data.add( roofit_histograms_2['data'] )
where roofit_histograms_2[‘data’] is a RooDataHist.
Next I try to fit to this combined data:
which fails with
[#0] ERROR:InputArguments -- RooTreeData::split(data) ERROR category sample doesn't depend on any variable in this dataset
[#0] ERROR:Fitting -- RooAbsTestStatistic::initSimMode(nll_simPdf_data) ERROR: index category of simultaneous pdf is missing in dataset, aborting
Obviously something is wrong with the way I create the combined data.
What is the correct way? How do I combine the two RooDataHist such that RooSimultaneous::fitTo is happy with it?
Thank you in advance.