RE: [ROOT] [TROOT] Making TChain and TTree friends

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Apr 22 2003 - 21:27:41 MEST


Hi Caius,

You do not specify which version of ROOT you are using.  A problem that
seems similar was fixed in ROOT v3_05_03.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Caius Howcroft
Sent: Tuesday, April 22, 2003 8:34 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] [TROOT] Making TChain and TTree friends




Hi,


I have a chain (ch_reco) of 4 files that I run over with some MakeClass
code to preoduce another tree of calculated variables (calctree).  I then
want
to make the original chain and the output tree.  So I do:

 ch_reco->AddFriend("calctree", "newtree.root")

however when I try draw

ch_reco->Draw("newvar:oldvar")

thinigs look a little odd, it seem to be that then ch_reco gets to the end
of the first file and instead of just carrying on calctree starts again
from the first entry. Like so:

(to demonstrate this I copied the run/event number into the new tree then
compaired with the old)

root [3] ch_reco->Scan("evthdr.run:new.run:evthdr.snarl:new.snarl", "")
************************************************************
*    Row   * evthdr.ru *   new.run * evthdr.sn * new.snarl *
************************************************************
*        0 *     14218 *     14218 *        10 *        10 *
*        1 *     14218 *     14218 *        57 *        57 *
*

ch_reco->Scan("evthdr.run:new.run:evthdr.snarl:new.snarl",
"evthdr.run!=new.run || evthdr.snarl!=new.snarl")

************************************************************
*    Row   * evthdr.ru *   new.run * evthdr.sn * new.snarl *
************************************************************
*     5070 *     14220 *     14218 *         3 *        10 *
*     5071 *     14220 *     14218 *        10 *        57 *
*


When I try to make ch_reco a friend of the new tree, root just segv's

I'm sure that people want to calculate new variables from an existing
tree then plot the new and old  all the time, so there must be an easy
way of doing this.

What am I doing wrong?


Caius
________________________________________
-           CAIUS HOWCROFT             -
-  +44 (0)1223 764 128      UK(office) -
========================================


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



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