RE: [ROOT] trees, tclonesarrays, and indicies

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Jul 31 2002 - 16:20:51 MEST


Hi Roy,

This ought to work as you expect.  Could you please send a little test
program reproducing the problem?

Thanks,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Roy Lee
Sent: Wednesday, July 31, 2002 9:03 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] trees, tclonesarrays, and indicies


Hi,

I have the following situation when using indices in a TTree:

I have a class Event which contains 2 TClonesArrays:

class Event {
private:
  TClonesArray *strip; // array of Strip objects
  TClonesArray *track; // array of Track objects
}

Each Event contains multiple hit strips, and may contain multiple
tracks.  A track points to multiple strips (a strip may have
multiple tracks pointing to it).

The track TClonesArray has an index over the strip TClonesArray:

class Track {
private:
  Int_t nstrip; // number of strips in track
  Int_t *stp; //[nstrip]
  Int_t *plane; //[nstrip]
}

The variable length array stp is an index over TClonesArray *strip.
In addition to this Strip index, Track also contains an integer array
containing the plane information for each hit strip.  This
The Strip class is defined:

class Strip {
private:
  Int_t plane;
}

Now let's suppose that Event is output as a TTree with name event.
If I do a TTree::Scan() to find the plane of the first hit strip in the
first track, I get the result I expect:

event->Scan("track[0].plane[0]")

> 10 (for example)

I can also do

event->Scan("strip[track[0].stp[0]].plane")

> 10

which is the same as the plane information contained directly in Track.
I can also combine the two expressions in the same Scan command and get
the same result:

eventnt->Scan("track[0].plane[0]:strip[track[0].stp[0]].plane")

> 10 : 10

However, if I try to do something like

eventnt->Scan("track[0].plane[0]-strip[track[0].stp[0]].plane")

> N != 0

Alternatively, if I try to do a Draw() command:

eventnt->Draw("track[0].plane[0]:strip[track[0].stp[0]].plane")

I get 10 on one axis and N != 10 on the other.

If I replace the index "track[0].stp[0]" with the index (such as 2),
everything works:

eventnt->Scan("track[0].plane[0]-strip[2].plane")

> 0

The same goes for the Draw() command.

Anyone have any ideas what is going on here?  I am using ROOT 3.03/06
compiled with gcc 3.0 under intel redhat 7.1.

Roy


----------------------------------------------------------------------------
--
Roy Lee / rlee@physics.harvard.edu / Department of Physics, Harvard
University



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:02 MET