Re: TTree: Scan and Friends

From: Chris Roat <chris.roat_at_gmail.com>
Date: Thu, 9 Jun 2005 14:51:12 -0700


Hi Philippe,

Thanks for the response. The work around you suggest is close to what I do. The only problem one needs to be aware of is that when you CopyTree individually, you need to still make them friends first as well - so that you have access to both sets of variables in your cut.

Chris

On 6/9/05, Philippe Canal <pcanal_at_fnal.gov> wrote:
> 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:52:26 MEST

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