The first impulse of most physicists is to use TMinuit2 when a fit has to be done. Not so fast! If you are dealing with a linear fit, you can do better. For Minuit to be efficient, one has to specify the derivatives of the fitting function with respect to the parameters. Even then, Minuit can not take advantage of the fact that these derivatives are parameter independent in case of a linear fit.
In case we are dealing with a chi-square minimization, the problem can be reformulated as a set of linear equations. The solveLinear.C tutorial shows several ways how to solve these equations with the decomposition classes.