smthng: Re: Error in <TKey::ReadObj>: Unknown class TTree

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Sun Jan 30 2000 - 19:01:29 MET


> Hi Valery and Rene,
> I made the following modification to file MainEvent.cxx: I only removed the
> statements in the write case from the MainEvent.cxx file, everything between
> line 166 and line 225. As I had mentioned, I wanted to separate reading and
> writing trees into separate routines.
> I understand that the problem has to do with the dictionary and the shared
> libraries. I used Renes advice and include gSystem->Load("Root_Tree"); in my
> main routine. That solved my problem.
> As a response to Valery: My code had a reference to TTree (TTree *T;), but
> that did not seem to be enough to include the DLL.

  I reproduce your problem. To see what is going wrong I edited the line
of   ".rootrc" file 

# Show where item is found in the specified path
Root.ShowPath:           true


Then I started the stand-alone ROOT and got:
E:\users\root\test>root
 the current keyboard layout is 866
Which: root.exe = e:\users\root\bin\root.exe
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.23/11   27 January 2000   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

CINT/ROOT C/C++ Interpreter version 5.14.25, Nov 25 1999
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
Which: Root_Graf3d.dll = e:\users\root\bin\Root_Graf3d.dll
Which: Root_Tree.dll = e:\users\root\bin\Root_Tree.dll
Which: Root_Matrix.dll = e:\users\root\bin\Root_Matrix.dll
Which: Root_Minuit.dll = e:\users\root\bin\Root_Minuit.dll
Which: Root_Postscript.dll = e:\users\root\bin\Root_Postscript.dll
Which: Root_Html.dll = e:\users\root\bin\Root_Html.dll
--------------------
This shows every thing fine.

Now I launched "Event.exe" from the test subdirectory (with no "write"
branch and got no evidence ROOT did try to load TTree:

E:\users\root\test> Event  400      1    1     20
Error in <TKey::ReadObj>: Unknown class TTree


 Very likely MS loader does not map ALL entries for all
 DLL's unless one does this "by hand" via gSystem->Load().

 It sounds it does load the method TTree::GetBranch() and everything this 
 method needs to go ahead but missed the Root/Cint dictionary this way.
 (I wonder MS employs "ProcessLine" approach to call DLL functions as 
  ROOT does)

 So I guess on different UNIX flavors we can observe something like this too
 (or will see in future)

              Valery

> Thanks for your help,
> 
> Reinhard
> 
> 
> 
> -----Original Message-----
> From: Valeri Fine (Faine) [mailto:fine@bnl.gov]
> Sent: Sunday, January 30, 2000 10:05 AM
> To: Reinhard Schwienhorst
> Cc: Roottalk
> Subject: Re: Error in <TKey::ReadObj>: Unknown class TTree
> 
> 
> 
> > Hi Reinhard,
> > I do not know what you did in MainEvent.cxx.
> > If you remove all the references to TTree or classes in the libTree
> > library,
> 
>  I wonder one he can not do this. If one removes references how can he use
>  it from the compiled code ?
> 
> > TTree method
> > you must load explicitely the library at the library at the start of the
> > main program with gSystem->Load("libTree"). On NT, it is not sufficient
> > to specify the library in the list of libs when you link the program.
> 
>  If code has any reference to TTree it will be linked with Root_Tree.lib
> against of Root_tree.DLL with no extra effort.
>  If code has no refs to TTree it can not use TTree anyway on either
> platform.
> 
>  So it is a dictionary problem not the dynamic library. By some reason CINT
> Dictionary
>  reports it doesn't know "TTree" ?
>   Was there any change in the way the dictionaty is created  recently ?
> 
>   Valery
> 
> >
> > Rene Brun
> >
> >
> > Reinhard Schwienhorst wrote:
> > >
> > > Hi,
> > > I have run into a problem when reading trees from a file with a program
> > > rather than in a macro. I am using the event example from the test area
> and
> > > I have created the event.root file. I modified MainEvent.cxx and removed
> > > everything in the write case ( the "else {" part of "if read == 1)").
> > > I get the following output:
> > > bash.exe-2.02$ Event 100 0 0 20
> > > TFile**         Event.root
> > >  TFile*         Event.root
> > >   KEY: TH1F     htime;1 Real-Time to write versus time
> > >   KEY: TTree    T;1     An example of a ROOT tree
> > >   KEY: TH1F     hstat;1 Event Histogram
> > > Error in <TKey::ReadObj>: Unknown class TTree
> > >
> > > What is going on? How can TKey not know about TTrees?
> > > Reading the tree works fine with the unmodified MainEvent.cxx routine.
> That
> > > is puzzling, because I only removed parts that don't get called.
> > >
> > > I am running on Windows NT with ROOT 2.23/11.
> > >
> > > Thanks for any help,
> > >
> > > Reinhard
> >
> 
> 



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