# Problem with the fit in ranges

Hello,

I need to fit in a range which is the union between two regions. I have seen in the documentation and posts that the right way to do this would be :

(numbers are just for the example)

x.setRange(“R1”, 0., 1.);
x.setRange(“R2”,2., 3.);

model->fitTo(data, Range(“R1,R2”));

When I try to do so, my fit doesn’t converge (it does when fitting in the whole region of course). I then tried to see if the reason was that I was excluding too big a region and I defined the two ranges to be complementary:

x.setRange(“R1”, 0., 2.);
x.setRange(“R2”,2., 3.);

but the fit still doesn’t converges. So I defined a range which is the whole definition range of the variable. This time the fit converges but the result is completely different with respect to what I get fitting in the same region but without specifying it with the “Range” option, and is surely wrong. I attach here the two plots in one case and the other.

I have the doubt that the problem might be that I am using per event errors in my pdf…

Can someone help me with this?

Thank you very much,

c

it actually might be important that I am using the per event error, so when I plot the fit I use the projwdata option. this could explain the bad normalization in the plot in the whole mass range (is there a solution to this?), but I don’t see how this can explain the non-converging fit when I restrict the fit range.

cheers,

c