[ROOT] room to read a ROOT Tree

From: GENTIT Francois-Xavier DAPNIA (GENTIT@dapnia.cea.fr)
Date: Tue Mar 20 2001 - 15:58:43 MET


  Dear Rooters,
  I got confused reading the ROOT documentation on the subject "How to read
a Tree".

   -  If you look at the example given in "ROOT Overview", page 49, chapter
"How to read a Tree", the space for the pointer "event" is not allocated, we
have simply the line :
    Event *event = 0;    no "new" anywhere.

   -  If you look at the example given in "ROOT Tutorials", page 45,
"Reading all events of a ROOT Tree", (or on the web at
http://root.cern.ch/root/html/examples/eventa.cxx.html ) the pointer "event"
is allocated, you have the line :
   Event *event = new Event();

  I have made tests, and to my surprise, both solution are working ! How is
it possible ? What is the recommanded way of doing ?
  Thanks a lot in advance.

          F.X. Gentit
          DAPNIA/SPP CEN Saclay
          tel : 01 69 08 30 38     fax : 01 69 08 64 28
          web : http://home.cern.ch/~gentit/



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET