Exercise 5: Scatterplot

(10 minutes)

Now add another plot: a scatterplot of chi2 versus ebeam. Don’t forget to label the axes!


Remember back in Exercise 1, I asked you to figure out the name TF2 given that the name of the 1-dimensional function class was TF1? Well, the name of the one-dimensional histogram class is TH1D, so what do you think the name of the two-dimensional histogram class is? Check your guess on the ROOT web site.

To fill a one-dimensional histogram, e.g., chi2hist, you use a Fill command with a single argument:


How do you think you might fill a two-dimensional histogram? Check your answer on the ROOT web site.

xkcd linear_regression

Figure 39: https://xkcd.com/1725/ by Randall Munroe