Trying to fit two datahists simultaneously in roofit

I have two event types ‘a’ and ‘b’.
I have two independent variables ‘x’ and ‘y’.
I have a collection of 'a’s and 'b’s and fill histograms with each event’s ‘x’ and ‘y’.

I have models which describe how ‘a’ and ‘b’ should look in ‘x’ and ‘y’.

I can then perform an extended maximum likelihood fit with ‘x’ and ‘y’ separately and extract the number of 'a’s and 'b’s, but I’d like to fit both ‘x’ and ‘y’ histograms simultaneously since the number of 'a’s and 'b’s is the same between the two histograms. What’s the right way to do this?

I’ve already tried using a RooSimultaneous to combine the two pdf models for ‘x’ and ‘y’ into ‘a’ and ‘b’ simultaneous pdfs, and then use the RooDataHist constructor along with the Index and Import command to combine the two histogram datahists, however when the fitting is complete, the sum of the number of 'a’s and 'b’s is the sum of the number of events in each histogram, however I mentioned that each event contributes to each histogram.

Here is what I’ve tried:
template_toy_mc.C (5.46 KB)

I suppose I could just divide the fitted values for ‘a’ and ‘b’ by two, but I don’t think I can just divide the fit errors by two. So I’m thinking there has to be a more proper way to do this. Thoughts?

I’m using root 5.34.28.