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

  1. 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.)

  1. Start up ROOT then, in sequence, enter the following commands:
TFile f("AllGamma_Merit.root", "READ") open the Summary Ntuple file
f.ls() view its contents
TTree *MeritTuple = (TTree*)f.Get("MeritTuple") load the summar ntuple TTree
MeritTuple->StartViewer() start the TreeViewer

Your ROOT session should look similar to the following:

Tip: If you have set up a permanent environment for ROOT you can load a ROOT file from the command line, e.g., simply enter root -l AllGamma_Merit.root as you are launching ROOT; then start the TreeViewer as shown above, e.g., enter: MeritTuple->StartViewer() (See Easiest Way to load a ROOT File.)

The Tree Viewer should look similar to:

  1. To create a simple 1-Dimensional histogram:

    double-click on McX0

A histogram similar to the following should appear on a new ROOT Canvas:

  1. To create a simple 2-Dimensional histogram:
    1. Left-click and hold the mouse button over Tkr1X0 and drag it to .
    1. Left-click and hold the mouse button over Tkr1Y0 and drag it to .
  1. 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

  1. To creat a simple TCut, drag a leaf name (e.g., TkrNumTracks) to the Scissors button.

This results in a cut of TkrNumTracks !=0 .

  1. To create a more complex expression, right-click on the Scissors button and select
    EditExpression.

The Expression editor GUI will appear:

  1. Set the cut to be:

    TkrNumTracks > 0 && CalEnergySum < 500

  2. Set the Alias name to:

    MyCut

  3. Click on the Done button.

Observe that the Scissors display is now ~MyCut and the Status bar displays: Content: TkrNumTracks

  1. 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)

  2. In the TreeViewer, right-click on the Scissors and select EditExpression.
  1. In the Selection data entry field, enter: MyCut

  2. In the Alias field, enter a name to reference this cut, e.g., currentCut.
  3. 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

  1. Drag all leaves you want to store in an ASCII file to the TreeViewer
  1. Click on the Scan check box:
  1. 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/21/2005