Modifying a Gaussian Fit

ROOT Version: v6_42_00
Platform: Not Provided
Compiler: Not Provided


I am trying to fit a gaussian to a specific range in my histogram. Here is my code

   TF1 *g_u1 = new TF1("m1","gaus",120, 145);
    TCanvas c1;;

here is what i get:

is there a way to modify the parameters of the gaussian or maybe changing the fit option, to have my fit peak at the same height was my data? The blue line is the fit and the markers are the original signal


I have three suggestions for you,

  • Use also the also option ā€œLā€, in this way you perform a Likelihood fit, is more correct for an histogram
  • Try to use a smaller interval, like [127,138]
  • Use g_u1->SetParameter(10000,132,5), in this way you set the parameters of the fit, quite close to the right values, and the fit will probably give a more correct estimation of the gaussian peak.

the third and the second one will give the major improvement according to me.


it definitely did. thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.