[ROOT] TTree, TRef and TProcessID for tree update

From: Dirk Geppert (Dirk.Geppert@cern.ch)
Date: Wed May 08 2002 - 12:17:11 MEST


Dear Rooters,

attached you may find a simple program with two classes A and B, 
where B has an attribute pointing to an instance of A via TRef.
Both classes are written to two branches of a tree.

Running the program ONCE works as expected:
- no error messages
- one TProcessID object is written out,  listed via 
  a) hfile->GetListOfProcessIDs()->Print()
  b) hfile->GetNProcessIDs()
  c) loop over all TKeys in the created file with ClassName TProcessID

However, updating the tree, i.e. running the program again, 
- an error message appears in tree->Fill() (only when B is written out): 
  Error in <TObjArray::At>: index 2 out of bounds 
                       (size: 2, this:0x08493030)
- the number of listed TProcessIDs is inconsistent:
  via a)     twice the number of created B objects, 
             with all the same Name and Title (of TProcessID) 
  via b & c) same as a) plus 1 (from first run)

Version 3.03/05 on Linux RH 6.1 with gcc 2.95.2

My questions are:
- Why does the error message appear? Is there something wrong in the way 
  the tree/branches are updated?
- Why for n>1 runs of the program not only one process ID for each time
  the program is run is written to the file?
- Why are in TFile::ListOfProcessIDs only the new TProcessIDs stored 
  while TFile::NProcessIDs gives the correct answer?

Thanks for you help,
Dirk







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