Super-K Code: Example 3

Super-K Code Example 3: Ntuples

This example is similar to the first two, except that you will now create an ntuple, and use the PAW program to view it. The PAW tutorial may help here, too.

Ntuples are quite a powerful feature of CERNlib HBOOK/PAW data analysis software: they allow you to look at the variables associated with a bunch of events, and plot any variable versus any other; you can also make selections using other variables. For instance, it is very easy to ask PAW to do something like: "plot a vs b for all events for which c is greater than 2".

This example uses a "quick and dirty" way to generate ntuples. The really proper way to do it is to create the ntuple file and write to it directly from HBOOK calls inside the Fortran source code. This is most efficient for processing a lot of data. However the method I find more convenient when you're just playing around with data, and developing analysis methods, is the following: I create a text file containing a list of events and the variables you are interested in. Next, I use a PAW kumac to create the ntuple and fill it from the text file, from inside PAW. This works fine for small amounts of data, and it's easy to make modifications.

Files for this example

Copy the following files from

into your working directory:

Take a look at the differences between example1.F and example3.F.

Compile and run this program in the same way as for examples 1 and 2. You should get less output to the screen (because the output goes to the file instead of the screen), but you should get a file called example3.out created. This contains the list of events and their variables.

Creating and working with the ntuple

Stuff to try

After you've gotten this working try some of the following: