Fitting in ROOT is based on the TMinuit class. See in particular Basic Concepts of Minuit . The user has the choice of using directly the TMinuit class, as illustrated in the last section below or use specialized functions provided in the histogram class TH1 or the graph classes TGraph and TGraphErrors . The Minuit package acts on a multiparameter Fortran function FCN .
Fit command is invoked.
The value of FCN will in general depend on one or more variable parameters. If not, the error computed is the square root of the bin content. As an example, the following command will fit histogram object hist with a gaussian. By default, the fitting function object will be added to the histogram structure and it will be drawn in the current pad. For pre-defined functions, there is no need to set initial values for the parameters.