RooChebychev not fitting properly when fitting in a range

Hi all,

I am trying to fit a RooChebychev to a RooDataSet. So this is an unbinned likelihood fit. The fit works great when I fit over the full range [-0.45, 0.45] but when I try to fit in a sub range like [-0.45, 0.2] or anything else the fit does not look so great. I have attached a simple code that produces a RooDataSet according to a Chebychev distribution using generate. I then fit with a polynomial in blue and a chebychev in red. And as you can see those fits look very different. The chebychev is just not fitting in ranges properly. Maybe I am missing something when I fit in a range. This is why I am posting this question here. Any help is greatly appreciated!

SimpleExample.C (2.45 KB)
SimpleExamplePlot.pdf (23.7 KB)