Re: [ROOT] TTree friendship based on event numbers?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Feb 14 2003 - 22:09:43 MET


Hi Brett,

You can use TTree::BuildIndex in this case with
  tree.BuildIndex("Run","Event") (or any pair of variables in the Tree.
then, when you do#
  tree.GetEntryWithIndex(2200,456); this will internally call
TTree::GetEntry with the serial entry number corresponding to Run=2200
and Event=456.

You can alternatively call
  Int_t entry = tree.GetEntryNumberWithIndex(2200,456);
  tree.GetEntry(entry);
  friendtree.GetEntry(entry).

If the entry numbers between two Trees do not correspond, you cannot
use the friend mechanism, but you can still use the technique above, 
like:
   tree1.BuildIndex("Run","Event"); has N1 entries
   tree2.BuildIndex("Run,"Event");  has N2 entries
   tree1.GetEntryWithIndex(2200,456)
   tree2.GetEntryWithIndex(2200,456);

Rene Brun


On 
Fri, 14 Feb 2003, Brett 
Viren wrote:

> Hi,
> 
> Is there anyway for a TTree to befriend another via entries common to
> each (say, run number + event number)?
> 
> -Brett.
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET