Dear Rooters I would like to fill many trees at once, i.e. a list of trees, with data and tried the following code: //------------------------- // Create trees and store in list TTree *tree = 0; MyClass *mycl = 0; fList->Clear(); for (Int_t i=0; i<numtrees; i++) { tree = new TTree(name[i], ""); mycl = new MyClass(); tree->Branch("MyBr", "MyClass", &mycl, 64000, 99); fList->Add(tree); SafeDelete(mycl); }//for_i // Fill trees with data for (Int_t id=0; id<numentries; id++) { for (Int_t i=0; i<numtrees; i++) { tree = (TTree*)fList->At(i); mycl = 0; TBranch *br = tree->FindBranch("MyBr"); br->SetAddress(&mycl); // tree->SetBranchAddress("MyBr", &mycl); mycl->SetData(data[id][i]); br->Fill(); }//for_i }//for_id // Write trees to file for (Int_t i=0; i<numtrees; i++) { tree = (TTree*)fList->At(i); // mycl = 0; // tree->SetBranchAddress("MyBr", &mycl); // write tree to file tree->Write("", TObject::kOverwrite); tree->Delete(""); //delete tree from memory tree = 0; }//for_i //------------------------- Although I do not get any error message, the trees are never written to the root file, and trying to open the file with TBrowser results in a bus error. Can you tell me what is wrong with my code and how to fill many trees at once? (I am running root 3.04/01 on MacOS X 1.1.2) Thank you in advance for your help. Best regards Christian _._._._._._._._._._._._._._._._ C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a V.i.e.n.n.a A.u.s.t.r.i.a _._._._._._._._._._._._._._._._
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:24 MET