Re: CloneTree with TChain

Rene Brun (Rene.Brun@cern.ch)
Mon, 12 Jul 1999 21:33:06 +0200 (METDST)


Hi Sean,
Use TChain::Merge to do what you intend to do below.
TChain::CloneTree should be redefined. The function from
the base class cannot do the job.

Rene Brun

On Mon, 12 Jul 1999, Sean Kelly wrote:

>
> Hi Rooters,
>
> I am having difficulty using the CloneTree method with a TChain object.
>
> The first of the 2 frags below generates a seg violation the second
> behaves as expected and copies 1 event from the tree e896mdst to the file
> newtree.root. Thanks for any help.
>
> Sean
>
>
>
> {
> TChain *e896mdst = new TChain("e896mdst");
> e896mdst->Add("/usr/e896disk1/e896/ana/tree/run3071a.root");
>
> // appropriate leave var. defs. and SetBranchAddress calls
>
> TFile *file = new TFile("newtree.root","RECREATE");
> TTree * = e896mdst->CloneTree(1);
> file->Write();
> file->Close();
> }
>
>
> {
> f = new TFile("/usr/e896disk1/e896/ana/tree/run3075b.root");
> TTree *e896mdst = (TTree*)gDirectory->Get("e896mdst");
>
> // appropriate leave var. defs. and SetBranchAddress calls ..
>
> TFile *file = new TFile("newtree.root","RECREATE");
> TTree * = e896mdst->CloneTree(1);
> file->Write();
> file->Close();
> }
>
>
>
>
>
>
>
> _____________________________________________
>
> Sean Kelly
> Dept. of Physics
> University of California Los Angeles
> office tel. (310)-825-6035
> fax (310)-206-4397
> voice mail (310)-259-3747
> _____________________________________________
>
>