RE: TTree: Scan and Friends

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 09 Jun 2005 16:14:41 -0500


Hi Chris,

TTree::Scan does support Friends ... however the '*' notation is Scan does not properly print all the leaves of the friends. (We should fix this!)

So for now you need to explicit list the friends data that you want to see.

For CopyTree you need to copy individually the 2 trees and make the copy friend of each other (after removing the original friend).

It might indeed make sense to copy/merge the friend trees when copying .. I'll check.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Chris Roat
Sent: Thursday, June 09, 2005 2:02 PM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] TTree: Scan and Friends

Hi ROOTers,

Is it possible to have TTree::Scan (and even TTree::CopyTree) pay attention to friends? For example,

// get 2 catalogs and make them friends
  TFile catFile("step2.catalogs/catalogs.root");   TTree *cat= (TTree*)catFile.Get( "STEP2_psfA_shear01" );   TFile resFile("data/STEP2/psfA/psfA_shear01_res.root");   TTree *resCat= (TTree*)resFile.Get("STEP2_psfA_shear01_res");   cat->AddFriend(resCat);

// this does not show any information from friend
  cat->Scan("*","","",25);  

// trim the tree with some cuts

   TTree *finalCat= cat->CopyTree("res_e2*res_e2+res_e1*res_e1<0.95 && res_covQual==3");

   // still no friend information
   finalCat->Scan("*","","",25);

   // cut had no effect on friend -- entries that were cut during CopyTree still present
((TFriendElement*)finalCat->GetListOfFriends()->At(0))->GetTree()->Scan("*", "","",25);

Cheers,
Chris Received on Thu Jun 09 2005 - 23:18:49 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET