RE: Error in <TKey::ReadObj>: Unknown class TTree

From: Reinhard Schwienhorst (schwier@mnhepw.hep.umn.edu)
Date: Mon Jan 31 2000 - 17:18:01 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.
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