Use Case I: Summary Ntuple
This section provides detailed procedures to open and view a summary ntuple, create TCuts, and create an ASCII file containing ntuple contents.
Open and View a Summary Ntuple
- To download an example summary ntuple ROOT file, go to:
ftp://ftp-glast.slac.stanford.edu/glast.u07/mcenery/systests/GlastRelease/v6r2p8/AllGamma/linux/
Download the AllGamma_Merit.root file and save it in yourWork directory.
Troubleshooting Tip: Make sure that, if you have not set up a permanent environment for ROOT analysis, your temporary environment is set up correctly. (Refer to Set Root Environment Variables: Linux or Windows.)
- Start up ROOT then, in sequence, enter the following commands:
TFile f("AllGamma_Merit.root", "READ") |
f.ls() |
TTree *MeritTuple = (TTree*)f.Get("MeritTuple") |
MeritTuple->StartViewer() |
Your ROOT session should look similar to the following:

and the Tree Viewer should look similar to:

- To create a simple 1-Dimensional histogram:
double-click on McX0
A histogram similar to the following should appear on a new ROOT Canvas:
- To create a simple 2-Dimensional histogram:
- Left-click and hold the mouse button over Tkr1X0 and drag it to
.
- Left-click and hold the mouse button over Tkr1Y0 and drag it to
.
-
Click the Histogram button (located in the lower left corner of the TreeViewer)
A new 2-Dimensional histogram should appear:

Creating TCuts to Use in TTree Viewer
- To creat a simple TCut, drag a leaf name (e.g., TkrNumTracks) to the
Scissors button.
This results in a cut of TkrNumTracks !=0 .
- To create a more complex expression, right-click on the Scissors button and select
EditExpression.
The Expression editor GUI will appear:
- Set the cut to be:
TkrNumTracks > 0 && CalEnergySum < 500
- Set the Alias name to:
MyCut

- Click on the Done button.
Observe that the Scissors display is now ~MyCut and the Status bar displays: Content: TkrNumTracks
- To create a cut at the command line and use it in the TreeViewer, first enter:
TCut c("TkrNumTracks > 0 && CalEnergySum < 500")
then enter:
MeritTuple->SetAlias("MyCut", c)
- In the TreeViewer, right-click on the Scissors and select EditExpression.
- In the Selection data entry field, enter: MyCut

- In the Alias field, enter a name to reference this cut, e.g., currentCut.
- Click on the Done button.
Note: Once a cut is defined in the Scissors icon, that cut will be applied the next time a histogram is generated via the TreeViewer.
Create An ASCII File Containing Ntuple Contents
- Drag all leaves you want to store in an ASCII file to the TreeViewer

- Click on the Scan check box:

- Right-click on the
, and select: Scan
Note: For Scan to work cannot be empty although it does not appear to affect the scan.
Reference:
ROOT User Guide Chapter 12 ftp://root.cern.ch/root/doc/chapter12.pdf
Owned by: Heather Kelly
Last updated by: Chuck Patterson
04/20/2005 |
|
|