Walkthrough: A simple analysis using the Draw command
It may be that all the analysis tasks that your supervisor will ask you
to do can be performed using the tools you learned about in The Basics:
the Draw command, the
Treeviewer, the FitPanel, and other simple
techniques discussed in the early chapters of the ROOT Users
However, it’s more likely that these simple commands will only be useful
when you get started; for example, you can draw a histogram of just one
variable to see what the histogram limits might be in C++. Let’s start
with the same tasks you did with
If you didn’t copy the example n-tuple file, do so now:
> cp ~seligman/root-class/experiment.root $PWD
If you don’t already have the sample ROOT
TTree file open, open it with
the following command:
 TFile myFile("experiment.root")
You can use the
Scan command to look at the contents of the tree,
instead of using the
If you take a moment to think about it (a habit I strongly encourage),
you may ask how ROOT knows that there’s a variable named
when you didn’t type a command to create it.
The answer is that when you read a file containing ROOT objects (remember the second part of Saving your work?) in an interactive ROOT session, ROOT automatically looks at the objects in the file and creates variables with the same name as the objects.
This is not standard behavior in C++; it isn’t even standard behavior when you’re working with ROOT macros. Don’t become too used to it!
You can also display the
TTree in a different way that doesn’t show the
data, but displays the names of the variables and the size of the
Either way, you can see that the variables stored in the
Create a histogram of one of the variables. For example:
Using the Draw command, make histograms of the other variables.
I duplicate some of the descriptive material from the Treeviewer section, in case you decided to skip the quickie tools and get right into the programming.