CEPA Home

Extracting Subsets from an Ntuple File

24 Jan. 1996

A question that arises fairly frequently is that of how to extract a selected subset from an existing ntuple file.

The answer is slightly different for the older row-wise ntuples and for the newer column-wise ntuples but the general strategy is the same. Below are links to two PAW macros that do the job - with one significant caveat. For some reason unknown to me, the ID's of the input and output ntuples may not be the same. This can be very annoying when one already has a set of macros with the ntuple ID embedded in them.

Interested users may freely download either or both of these macros for their own use. Note that each macro includes a small COMIS function which does the selection. That function will need to be modified for each subset selection as needed. Otherwise, these macros are self-contained and the required arguments are described in the comments at the top of the text.

Note that both macros begin with a command to close all currently open files. Something of the sort is necessary because the macros open files to use internally but has the unfortunate side effect that any previously opened files are closed. If that offends you, feel free to remove that line from your copy.

In both cases, select "Save as ..." from the File menu after displaying the code.


Fermilab at Work ]  [ Computing Division ]  [ CEPA ] [ APS ] [ ESE ]  [ OAA ] [ PSM ]
John Marraffino
This file last modified Thursday, 04-Mar-2004 17:11:30 CST
Security, Privacy, Legal Fermi National Accelerator Laboratory