Walkthrough: A 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:
[] tree1->Draw("ebeam:px")
A 2D plot
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?
Correlations
If you see a shapeless blob on the scatterplot, the variables are likely
to be uncorrelated; for example, plot px
versus py
. If you see a
pattern, there may be a correlation; for example, plot pz
versus
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
the target.
Let’s create a “cut” (a limit on the range of a variable):
[] tree1->Draw("zv","zv<20")
Look at the x-axis of the histogram. Compare this with:
[] tree1->Draw("zv")
Axis range
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:
[] tree1->Draw("ebeam","zv<20")
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")