Re: [ROOT] Adding one more element to a tree

From: Stanislav NESTEROV (Stanislav.Nesterov@cern.ch)
Date: Tue Sep 03 2002 - 18:53:51 MEST


    Hi Francois-Xavier,
    If you did everything right (and I think you did) then you have got
already all that you want: these names mean that you have several
versions of your tree, but you can use the whole tree anyway.

    Just use the name "T" (not "T;123"), and you will get all the entries.

   for example
                tree->GetEntries(); 
   will print all entries, and even

                tree->Draw("bla-bla-bla")
   draw all variables.

			Best regards,
					Stanislav.


> On Tue, 3 Sep 2002 16:19:32 +0200 
> GENTIT Francois-Xavier  DAPNIA <GENTIT@dapnia.cea.fr> wrote
> concerning "[ROOT] Adding one more element to a tree":
> >   Dear Rooters,
> >   What is the trick to add more elements to an already existing tree?
> >   To try to find it myself, I have taken the example "staff.C" in the
> > tutorials. I have split cernstaff.dat into cernstaff1.dat and
> > cernsatff2.dat, cernstaff1.dat being without the last element of
> > cernstaff.dat, and cernstaff2.dat containing only this last element.
> >   I have then run "staff.C", obtaining correctly a tree of 3353 elements.
> >   Then I have run a script "staff2.C", which is identical with staff.C,
> > except for these 3 lines:
> > 
> >    FILE *fp = fopen("cernstaff2.dat","r");
> > 
> >    TFile *f = new TFile("staff.root","UPDATE");     [instead of "RECREATE"]
> >    TTree *tree = (TTree *)f->Get("T");        [instead of new TTree]
> > 
> >   But instead of obtaining a tree with 3354 elements, I obtain 2 trees, the
> > first T;1 one with 3353 elements, and a second one, T;2 with 1 element!!
> > 
> >   Thanks for your help
> > 
> > François-Xavier Gentit
> > DAPNIA/SPP CEA Saclay
> > http://gentit.home.cern.ch/gentit/
> > 
> > 
> 



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