C++ Exercise 2: Adding error bars to a histogram (5 minutes)

We’re still plotting the chi2 histogram as a solid curve. Most of the time, your supervisor will want to see histograms with errors. Revise the Analyze::Terminate method in Analyze.C to draw the histograms with error bars.


Look back at Working with Histograms.


The histogram may not be immediately visible, because all the points are squeezed into the left-hand side of the plot. We’ll investigate the reason why in a subsequent exercise.

After you make a change to Analyze.C, you have to restart ROOT before you run tree1->Process("Analyze.C") again. Don’t forget the up-arrow key!

chi2 histogram

Figure 24: What I get when I plot chi2 with errors bars turned on.


See this note in the Python tutorial for how I made this plot.