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