I try to fill the same histogram using two different methods ie.,
the " histogram fill option "
h2->Fill(y,x);
“the set bin content of the histogram”
h3->SetBinContent(i,x);
(please see the attached macro.)
Now I try to fit the two histograms h2 and h3 using the same user-defined fit function. Even though the same histogram is filled in two different ways, what I see is that the fit results are different and I don’t understand the reason why ? As far as I understand both should have same fit results but its not what I get, can someone help me understand why ?
Here I attach the necessary macro and output for your consideration.
So even if I don’t plot my errors (just use HIST FOR PLOTTING HISTOGRAM), root still considers the errors before fitting it and that’s why I have different fit results…
And I see that if I propagate the errors and assign it to each bin points in both the histograms I have the same results fo the fit…
Also as seen from your plot of h3, the errors in h3 are meaningless, yes as you suggested I used
h3->Sumw2(kFALSE); before drawing it, but I don’t really understand like what it does…
Here if I plot h2 after filling its bins with estimated error (and fill each bins using SetBinError), and plot using the histogram drawing option “E” to visualize the errors I see it plots the errors for both the X and Y. How is this so, as far as I understand I had only assigned errors to the Y-values for h2. And if I want to assign errors to X I need convert the same histogram into TGraphErrors right ? if this is so :
What does the error bars on X correspond to, and how is it estimated by root ? (see attachment
Regarding the errors plotted along the X and Y. I see that if I make a histogram and fill it using random numbers and plot with histogram drawing option “E”, I see that the errors are plotted for both X and Y. I am really confused now, what does this errors along X correspond to and how is it estimated in root ?
from my understanding, the bins of a histogram define ranges on the X axis. The error bar represents the uncertainty of the x value (x can take any value within the range).