Exercise 6: Plotting a derived variable (10 minutes)

Revise AnalyzeVariables.C to make a histogram of the variable pt. Don’t forget to label the axes; remember that the momenta are in GeV.

Note

If you want to figure out what the bin limits of the histogram should be, I’ll permit you to “cheat” and use the following command interactively:1

tree1->Draw("sqrt(px*px + py*py)")

1

If you compare this command with the computation of pt on the previous page, you may be either confused or irritated: When using C++ you have to access the n-tuple variables using pointer notation like “(*px)”, while when using ROOT directly you can get away with just using the variable names like px. This is one of the reasons many folks prefer Python.