Re: [ROOT] Adding to a tree.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 11 2002 - 11:06:03 MEST


Hi Patrick,

Assuming an existing Tree "T" in myfile.root. You want to continue filling it
in a new process. do:
   TFile f("myfile.root","update");
   TTree *T = (TTree*)f.Get("T");
   //set the branch(es) address, eg
   Event *event=0;
   T->SetBranchAddress("event",&event);

   while(something) {
      fill your event object
      T->Fill();
   }


   T->Write();

Rene Brun

Patrick Murray wrote:
> 
> Hi All,
> 
> If I have an existing tree file, how do I add to it new events? Do I read
> the file in, add to that and then recreate a new tree or can I just
> directly add to the existing file?
> 
> Thank you,
> 
> Pat



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:49 MET