How to consider uncertanities while fitting a histogarm

Dear Experts ,

I have a histogram and for each of its bins I have the uncertainties estimated using error propagation, now I would like to fit my histogram with errors. I have the following questions :

  1. If I draw my histogram using the drawing options “E1” and fit, will the uncertainties be considered in root by default if I fit it with a user defined function ?

  2. If not how to consider the uncertainties while making the fit"

Thank you!

Please read tips for efficient and successful posting and posting code

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

Dear Deby,

Thanks for the question.
The relevant piece of documentation can be found here.

The answer is yes, the uncertanties are taken into account unless you specify otherwise :slight_smile:

I hope this helps.


1 Like

Dear Danilo,

Thanks for the response!

But I am not sure whether I have understood you correctly.

Here I attach a macro in which I open a histogram and I want to find its first derivative (for which I do dy/dx, taking 7 bins). And I fit the first derivative in two ways :

  1. I draw histogram without errors and fit using the fit function defined (h2)
  2. I draw histogram with option E1 and fit using the fit function (h4)

And in both the cases I have the same fit results. Which I understand as root always calculates the errors automatically before fitting, Is this so ?

I attach my macro and result herewith for your consideration, thank you.

check4.C (5.1 KB)
h1.root (2.7 KB)


I think the way in which you decide to draw the histograms have no effect on the uncertainties on the bin content. But perhaps I am misunderstanding the question.


1 Like

I might be wrong, but it seems this thread is similar to this one. (sorry if not)

1 Like