Dear Roofit experts,

I would like to ask you how can I implemet the following request. I have a dataset ds, with observables X and Y. From this dataset, I generate two subsamples with a cut on Y: ds_l (Y<ycut) and ds_h (Y>ycut). In this way, ds = ds_l + ds_h.

Then I want to fit each dataset with a sum of signal and background, using the shape of their distribution in X, which I know. Now I am performing 3 independent fits, and that works clearly fine. But I also would like to add the constraint that, both for signal and background, the sum of entries that I fit in ds_l and ds_h has to be compatible with the entries I fit in ds

Nsig (ds_l ) + Nsig(ds_h) = Nsig (ds)

Nbkg (ds_l ) + Nbkg(ds_h) = Nbkg (ds)

Do you have any suggestion about the most efficient and correct way to implement this?

Thank you very much for your help!

have a nice day,

Valerio