TGraphErrors does not coincide with a theoretically identical custom bin histogram

Hi, I’m exercising with a relatively trivial macro: i just want to draw a histogram overlayed to a TGrapherrors.
To do that I take the graph points from a .txt file and then I fill the bincontent of the histogram with the y value of the correspondding point in the graph. Same for the error. Then I draw the histo with “L E2” option and the graph with the “P” option.
I should obtain a set of points with some colored error bands in correspondence of the error. This happens only for the first two bins and for the last one.
Where is the mistake?
I’m appending both the macro and the .txt file

P.S. It may be necessary to change the path to read the .txt file, actually it is examples/file.txt

Analysis_eff_jets_1.C (3.6 KB) dati_eff_bjets_MV2c10.txt (112 Bytes)

Add “gr->Sort();” right after you create it.

1 Like

Thank you very much!

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