Dear ROOT expert,
In my code, I’m cloning a TTree into a second tree. Then the original TTree is deleted. How can I keep the correct branch addresses after that? Here is a piece of code to illustate my problem:
[code]{
TTree *T = new TTree(“test”,“test”);
int myvar;
T->Branch(“myvar”, &myvar, “myvar/I”);
myvar=0; T->Fill();
myvar=1; T->Fill();
myvar=2; T->Fill();
TTree *T2 = T->CloneTree();
delete T;
for(int t=0; t<3; t++){
T2->GetEntry(t);
cout<<myvar<<endl;
}
}[/code]
This prints “2,2,2” and I want it to print “0,1,2”.
Thank you.