Hi Mike,
To answer your question, I must know the relationship between
your variable "EventNum" and the TTree entry number
in your two Trees. Solutions to this kind of problem are typically
using TEventList or TTree::BuildIndex
Rene Brun
On Tue, 24
Feb 2004, Mike Carson wrote:
>
> Dear Rooters,
>
> I've got two TTrees, tree1 and tree2, with the same variable list
> (EventNum X Y Z). I'd like to select those events in tree2 which have the
> same EventNum as the events in tree1. I can do this with a couple of for
> loops but it takes too long. I also tried this:
>
> Int_t numberOfEvents = tree1->GetEntries();
> Char_t myString[20];
>
> for (Int_t i=0; i<numberOfEvents; i++) {
> tree1->GetEvent(i);
> sprintf(myString,"\"EventNum == %d \"",EventNum);
> tree2->Draw(">>+eventList",myString);
> }
>
> but that didn't work. I tried a similar thing with a TCut object instead
> of myString...didn't work either. Any ideas?
>
> I'm using root version 3.10/02, gcc 3.2.2, RH9.0.
>
> Many thanks,
> Mike.
>
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET