Indexing a root tree

Hello All,
I have a question about indexing a tree. There are several events with the same eventID in the hits tree. How do I get all these events corresponding to a single eventID selected from another tree bufferedcoincidences. As implied, no of entries in bufferedcoincidences << no of entries in Hits.

Thanks for your help.

Karthik.

My code (to help you understand the question further) is as follows:

... TTree *Coincidences =(TTree*)gDirectory->Get("bufferedcoincidences"); TTree *Hits = (TTree*)gDirectory->Get("Hits"); Coincidences->AddFriend(Hits); Hits->BuildIndex("eventID","0"); ... Hits->GetEntryWithIndex(eventID1); ......

The problem with this code is that I just get one entry with the same eventID amongt the many that have the same eventID.