Re: Question about TFile

From: Valery Fine (fine@mail.cern.ch)
Date: Thu Oct 30 1997 - 09:47:36 MET


On 30 Oct 97 at 8:40, Rene Brun wrote:

> You can have as many TFile objects as you want. The only thing
> to remember is that histograms and Trees are created by default in
> the current directory. When you open a TFile, the current directory
> is automatically changed to this file. You can change the current
> directory with TFile::cd(). When filling Trees, it is not necessary
> to change the current directory to the file associated with this
> Tree, ROOT will do it automatically for you. However, when you write
> the Tree header, you MUST cd to the right file. Do not worry! ROOT
> writes on the data base only objects for which you do object.Write.
> Here is an example of code dealing with 3 files.


   Rene, why we can't supply the second (may be only)  Write()
with TFile *file=0 as its second (last) parameter, namely:

  virtual void TObject::Write(const Text_t *name=0, TFile *file=0, Int_t bufsize=0);
         where  file=0 means - write  to the current file.
      
   Anyway I believe all cd() methods MUST return the previous "current" object.
   For multithread program it will be essential feature and it is easy for the user,
   otherwise he MUST learn all ROOT global variable names.
   
  The same would be correct for other "current" aware methods
(like Draw() for examples ). I mean

   TObject::Draw(Char_t *option,TPad *pad=0);

   With the same semantic, pad = 0 means - USE the current pad.

          Valery
Dr. Valeri Faine (Valery Fine)
    ------------ -------------   Phone: +41 22 767 4921
CERN                             FAX  : +41 22 767 7155
CH-1211 Geneva, 23               mailto:fine@mail.cern.ch 
Switzerland                      http://nicewww.cern.ch/~fine
                                 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET