Problems fitting in a range with RooFit using pyroot

Dear RooFit Experts,
I have a dataset defined on two variables x[0,100],y[0,10] and I would like to fit it in a bin of the varible y.
I tried to do it using these lines of code:

minEdge = 0
maxEdge = 2
fitmodel.fitTo(DataComb, RooFit.Range('myRange'), RooFit.Save())

But it fits in the full range and not in the sub-range “myRange”.

What am I doing wrong?

In the attachment you have my simple test case with:

  1. Fit on the full range (results on Canvas 1)
  2. Fit on the bin from the reduced dataset (results on Canvas 2)
  3. Fit on the bin setting the range at the level of the fit (results on Canvas 3)
    The problem is that the results of 3 are the same of 1 instead of being the same of 2.

Thanks a lot,

Barbara (2.18 KB)