ntuples in root

From: Sean Stave (stave@lns.mit.edu)
Date: Fri Nov 02 2001 - 12:21:41 EST


Hello all:

I have a workaround for a problem I was having with ntuples in root and
Tim said it would be good to post it. NOTE: This bug appears in Root
2.23 and 2.25 but 3.00 appears fine.

First off, the problem: I am using the ntuple output from blastmc and
using h2root to convert it to a root file. Then, in root, I load up the
file normally with TFile f("events.root"); . Now, I want to plot some
variable but with a cut on the trnum variable. trnum is the number 1 to
10 of the track within a trigger. However, root behaves as if the cut
doesn't exist and just plots the uncut values. My old fix was to plot
trnum (i.e. h1->Draw("trnum");) and then my variable with the cut
(h1->Draw("smt5z","trnum==1");). This seems to work but has to be done
for different variables (Z also acts up).

So, what appears to work nicely is the following:
After loading the ntuple into memory, use the MakeCode command.
h1->MakeCode("filename.C");

This will create a skeleton analysis code for the ntuple. Then, go into
the file and uncomment the loop at the bottom. Then just .x filename.C .
Now, all the cuts I have done work properly (also agree with PAW). We
think this works because the loop forces root to look at the entire file.

As I said, this appears fixed in Root 3.00 but the MakeCode command is
still useful especially for quick calculations involving the ntuple
variables (sums, etc.)

Hope this is helpful to people.

-Sean



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST