[ROOT] ReadKey() question

From: KOSU_FOKIN@garbo.lucas.lu.se
Date: Thu Oct 19 2000 - 20:27:27 MEST


Hi Rene,
TDirectory::ReadKeys() says
//-----
  Every directory has a linked list (fKeys). This linked list has been
  written on the file via WriteKeys as a single data record.
  It is interesting to call this function in the following situation.
  Assume another process1 is connecting this directory in Update mode
    -Process1 is adding/updating objects in this directory
    -You want to see the latest status from process1.
  Example Process1:
    obj1.Write();
    obj2.Write();
    gDirectory->SaveSelf();
  Example Process2
    gDirectory->ReadKeys();
    obj1->Draw();
  This is an efficient way (without opening/closing files) to view
  the latest updates of a file being modified by another process
  as it is typically the case in a data acquisition system.

// ----

In my application I do
            fTree->Write("CHICSiTree",TObject::kOverwrite);
            EventFile->SaveSelf();
            EventFile->Flush();

on the writer side and

            fEventFile->ReadKeys();
            fNEvent = Int_t(fTree->GetEntries());

on the reader side. It does not work as expected, i.e. the number of
events stays the same all the time. On the other hand if on the reader
side I add

  delete fTree;
  fTree = (TTree*) fEventFile->Get("CHICSiTree");

it works even without having SaveSelf() on the writer side.

Could you explane this ReadKeys() behavior and how I can avoid deleting and 
reading the tree back?


Regards,
Anton



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET