TF1 linear fit (pol1): Fitted line is not smooth

Hi all, I’m trying to perform a linear fit over a selected region in my plot. The macro is running successfully and giving desirable output;
used something like this to FIT:

TF1 *fit2 = new TF1("fit2", "pol1");

However, the fitted line in the plot is not smooth instead it’s some sort of step line chart. Wanna know what is the reason for this and how to make it a smooth straight line? Attached is the plot for the same in case you wanna look at the fit.


Try to increase the number of points using TF1::SetNpx().

Add after the fit2 declaration the line



1 Like