C++ Walkthrough: Simple analysis using the Draw command, part 2 (10 minutes)
Instead of just plotting a single variable, let’s try plotting two variables at once:
This is a scatterplot, a handy way of observing the correlations between
two variables. The
Draw command interprets the variables as
(“y:x”) to decide which axes to use.
It’s easy to fall into the trap of thinking that each (x,y) point on a scatterplot represents a pair of values in your n-tuple. The scatterplot is a grid; each square in the grid is randomly populated with a density of dots proportional to the number of values in that square.
Try making scatterplots of different pairs of variables. Do you see any correlations?
If you see a shapeless blob on the scatterplot, the variables are likely
to be uncorrelated; for example, plot
py. If you see a
pattern, there may be a correlation; for example, plot
zv. It appears that the higher
pz is, the lower
zv is, and
vice versa. Perhaps the particle loses energy before it is deflected in
Let’s create a “cut” (a limit on the range of a variable):
Look at the x-axis of the histogram. Compare this with:
Note that ROOT determines an appropriate range for the x-axis of your histogram. Enjoy this while you can; this feature is lost when you start using analysis macros.
A variable in a cut does not have to be one of the variables you’re plotting:
Try this with some of the other variables in the tree.
The symbol for logical AND in C++ is “&&”. Try using this in a cut, e.g.:
 tree1->Draw("ebeam","px>10 && zv<20")