[ROOT] Just _when_ is the TStreamerInfo written to disk?

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Wed May 30 2001 - 21:41:30 MEST


Hi ROOT'ers, 

I'm a bit puzzled about a when the TStreamerInfo object is written to
disk.  The documentation says: 

  Instead of generating the style of Streamer function shown above, a
  shorter Streamer is generated. ... 

  All the I/O is now managed automatically by TClass::WriteBuffer and 
  TClass::ReadBuffer. In turn these two functions invoke the services
  of a new class TStreamerInfo that is the real I/O manager of the new 
  version of Root.

So it seems like the TStreamerInfo object is written to disk when one
sends the message Write or indirectly when sending the Streamer
message. 

However, my problem is this: it seems that the TStreamerObject is
written to disk even if no object of that class is written to disk.
Here's a schematic of what I do: 

  1) Open a ROOT file (file1) and make a TTree in it. 
  2) cd back to old TDirectory (dir1). 
  3) Open another ROOT file (file2) and make histograms in it.  
  4) Loop over events
    a) Make objects of various non-ROOT - but derived from TObject, and
      using the '+' option - classes. 
    b) Fill histograms in file2
    c) Fill TTree in file1
  5) Write and Close file1
  6) Write and Close file2
  7) End of application. 

Now the idea of this, is that file1 will contain a TTree with all the
user defined classes, while file2 will contain diagnostics histograms
_and_nothing_else_.  However, when I open file2 with the interactive
ROOT, ROOT complains with lines like: 

  Warning in <TClass::TClass>: no dictionary for class <user class> is available
  Error: class,struct,union or type <user class> not defined  FILE:/tmp/filevBiSux_cint LINE:1

That is, somehow there's some information in that file pertaining to
the user defined class, though there's no objects of those classes in
the file. 

This is ofcourse not the intent.  I found out, that by explicitly
changing directory to the file where the TTree is (file1) before doing
the Fill, everything works as it should.  Schematically, I replaced
4.c above with 

    c) change directory to file1
    d) Fill TTree in file1
    e) restore old directory

So it seems that some how, the TStreamerInfo object is written as a
consequnce of TTree::Fill, and it's written to current directory or
something.  

I have not been able to reproduce this in a simple way, so I guess you
have to take my word for it.  My feeling is, that it has something to
do with the period flushing of buffers or something, but that's just a
thought. 

I think that the behaviour I outlined above is wrong (or I have
misundertood something), so I tought you sould know. 

Yours, 

Christian  -----------------------------------------------------------
Holm Christensen                             Phone:  (+45) 35 35 96 91 
  Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
  DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
  Denmark                                    Email:       cholm@nbi.dk



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