Problems with FIT


I am new with ROOT and I have some problems related with fitting histograms. First of all, I am trying to analysis the Z decays into pairs of muons, as well, I generate all the data and plotted it in a histogram.
The histogram has only one signal + background. Then I did the steps below:

  1. Fitted only the background
  2. Created a random histogram with the fitted background function
  3. Subtract the random background histogram from the total histogram

As expected the result was only the signal with a couple of points

With parameters:
3.6 width
90.8 peak

It isn’t a good result.
Someone can help me with another way to do this fit?


  1. To generate a random histogram I calculated the integral of the background fitted function (discovering the number of entries for the background)
  2. The code I used is attachecode.cpp (1.2 KB)

After subtract the background from total (log scale)

I really need help :frowning:
Thanks everyone!


in some sense I think this post is not related to ROOT or the fitting tools it provides.
The “goodness” of your result is probably due to the fact that your background subtraction procedure needs some attention and perhaps to the fact that the function you fit is not perhaps accurately describing the shape of the Z peak.


Dear Elison,

It looks like your fit function does not take into account the asymmetry of the peak, as in your code there is only a simple Lorentzian as the fit function. Looking at the graph, on the left the number of events is ~100, while on the right it is only ~1-2. Not sure how you fitted the background, but subtracting a randomly generated histogram does not sound right to me. To improve your results, it may be possible to just add a linear term to your fit function, but it might make more sense to look for the kinematic dependence (i.e., when the Z boson is not at rest) to correct your fit function appropriately if that’s what gives you this asymmetry. You may want to take a look at pages 27-33 of this document for more information. I hope that helps.

Here (section 9.1, page 54) is another source of information, where a combination of a convolution of a Lorentzian with a Gaussian (to account for detector resolution) and an exponential (for the background) is used. This is probably what you need to do in your analysis.

1 Like

Thanks Amadio, I will read and try to think in another way to do the background and also edit the lorentzian fit!

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