Example experiment n-tuple (10 minutes)

I’ve created a sample ROOT n-tuple for you. Quit ROOT. Copy the example file:

> cp ~seligman/root-class/experiment.root $PWD

Start ROOT again. Start a new browser with the command

[] TBrowser b

Click on the folder in the left-hand pane with the same name as your home directory. Double-click on experiment.root. There’s just one object inside: tree1, a ROOT TTree (or n-tuple) with 100,000 simulated physics events.

Note

There’s no real physics associated with the contents of this n-tuple. I created it to illustrate ROOT concepts, not to demonstrate physics with a real detector.

Right-click on the tree1 icon, and select Scan. You’ll be presented with a dialog box; just hit OK for now. Select your ROOT window, even though the dialog box didn’t go away. At first you’ll notice that it’s a lot of numbers. Take a look at near the top of the screen; you should see the names of the variables in this ROOT Tree.1

You can hit Enter to see more numbers, but you probably won’t learn much. Hit q to finish the scan. You may have to hit Enter a couple of times to see the ROOT prompt again.

Note

Let’s break down this simple example:

  • A particle is traveling in a positive direction along the z-axis with energy ebeam.

  • It hits a target at z=0, and travels a distance zv before it is deflected by the material of the target.

  • The particle’s new trajectory is represented by px, py, and pz, the final momenta in the x-, y-, and z-directions respectively.

  • The variable chi2 (\(\chi^2\)) represents a confidence level in the measurement of the particle’s momentum after deflection.

  • The variable event is just the event number (0 for the first event, 1 for the second event, 2 for the third event… 99999 for the 100,000th event).

experiment sketch

Figure 14: Sketch of the experiment and variables.

Note

Did you notice what’s missing from the above description? Answer: units. I didn’t tell you whether zv is in millimeters, centimeters, inches, yards, etc. Such information is not usually stored inside an n-tuple; you have to find out what it is and include the units in the labels of the plots you create.2 For this example, assume that zv is in centimeters (cm), and all energies and momenta are in GeV.

There’s something else that’s missing, but you wouldn’t have noticed it unless you’ve performed a scientific analysis before: time. Any real experiment would have several variables relating to time (the time of the event, the time that the particle interacted in the detector, etc.) I haven’t included any time-related variables in this n-tuple, with the possible exception of the event number, mainly because they wouldn’t illustrate what I want to teach you in this tutorial.

xkcd dimensions

Figure 15: https://xkcd.com/1524/ by Randall Munroe


1

If the names “stutter” (e.g., you see px.px instead of just px), don’t be concerned.

The name of the package is ROOT, an n-tuple is a type of Tree, and the individual variables are “leaves” on the Tree. ROOT has “branches” as well: if you remember that spreadsheet model I showed you during the lecture, branches correspond to entire columns.

In the scan, ROOT displays both the name of the branch and the name of the leaf within the branch. For an n-tuple, each branch only has one leaf, but TTree::Scan() has no way of knowing that, so it displays everything.

2

Advanced note: There is a way of storing comments about the contents of a ROOT tree, which can include information such as units. However, you can’t do this with n-tuples; you have to create a C++ class that contains your information in the form of comments and use a ROOT “dictionary” to include the additional information. This is outside the scope of what you’ll probably be asked to do this summer.

If you’re interested in the concept, it’s described in Chapter 15 of the ROOT User’s Guide. There’s an example in the Expert Exercises.