CloneTree with TChain

Sean Kelly (kelly@charm.physics.ucla.edu)
Mon, 12 Jul 1999 11:28:48 -0700 (PDT)


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
_____________________________________________