I am looking to do a piecewise continuous fit across regions 0 to 0.2, 0.2 to 0.4, and 0.4 to 0.5 (three different pol3s). I need it to be without discontinuities. So my question is how can I set one function to start where the previous one ends? Or in another way how can fit1(0.2)==fit2(0.2)?
Your approach has the disadvantage that the chi2 (or in general minimization goal) is not equally distributed across the different regions. If you want to find a global minimum, over the whole range, you need to provide a new minimization function. See tutorials/fit/fitExclude.C for an example doing something completely different (exclusion) that you can use here, too. In your case, the new minimization function is similar to fline() in the tutorial.
Then you need to cast the polynomials and parameters into a form that allows you to make the polynomials continuous (by having the second pol’s start point depend on the first pol’s end point, like you do). You might even want to require the derivative to be the same at the cross-over points…
None of that is trivial, but it’s not black magic either