I’m trying to use the sum of TF1’s to do a fit with a piecewise function on ROOT Cern. Here is the important part of the code.
TCanvas *cvi = new TCanvas("V(i)","V(i)",200,10,600,400); TGraphErrors *gvi = new TGraphErrors(27,i,V,si,sV); TF1 *vi1 = new TF1("vi1","*log(x*+1)"); gvi->Fit(vi1,"MR+"); TF1 *vi2 = new TF1("vi2","*x+",0.005,0.012); gvi->Fit(vi2,"MR+"); TF1 *vitot = new TF1("vi1+vi2","vi1+vi2"); gvi->Fit(vitot,"MR+");
The fitting with vi1 and vi2 are fine, but, as you see, vi2 has a range, therefore the fit with vtot should be the function
Nevertheless the programm does not respect the range I gave for vi2 when it does the fit vitot. That is, it does the fit vitot as if I gave no range at all.
How can I force ROOT to fit vtot taking into account the range I gave for vi2?
I cannot set a range directly on vitot because it would fit only that part of data, while I’m trying to fit all the data with different functions.
I already gave the option “R” in the fits, as you see, but that does not seem enough.