Re: [ROOT] class used in a branch

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Aug 09 2000 - 09:37:36 MEST


Hi Xavier,
   
In general, with CINT you could not create an interpreted class
deriving from a precompiled class. Mixing the virtual table of pointers
between CINT and the compiler is highly machine and compiler dependent.
In the latest version of CINT 5.14.45 part of Root 2.25/01 released yesterday
there is some progress in this area. The CINT release notes say:
 "- True virtual function resolution in mixed interpreted/precompiled-class
   environment is supported by STUB.  Base class and interface of derived 
   class have to be precompiled and derived class member function can be 
   interpreted. Please find example in demo/makecint/Stub2 directory."

and when you run your example with the new version of Root, you get the
following warning:
   root [0] .L MyClass.C
Warning: precompiled class TNamed inherited from interpreted class TMyClass
FILE:MyClass.C LINE:1
There are some limitations regarding compiled/interpreted class inheritance

We intend to make use of this new CINT facility in the Root environment
and release the current restriction when creating branches of a Tree
in a future version of Root.

Rene Brun

GENTIT Francois-Xavier DAPNIA wrote:
> 
>    Dear Rooters,
>    If I define the following file "MyClass.C" :
> 
> class TMyClass : public TNamed {
> public:
>   Int_t    fRun;       //run number
>   TRunResults() { ; }
>   TRunResults(Text_t *,Text_t *);
> };
> TMyClass::TMyClass(Text_t *name,Text_t *title):TNamed(name,title)
> {
>   fRun = 0;
> }
> 
>    and the following file "testa.C" :
> 
> {
>   TTree *tree = new TTree("T","Tree for GLAST");
>   TMyClass *p;
>   p = new TMyClass("runstat","runstat");
>   tree->Branch("RunBranch","TMyClass",&p,64000,1);
> }
> 
>    and if I do :
> 
> root[0]> .L MyClass.C
> root[1]> .x testa.C
> 
> I get the error message, after the line tree->Branch(...)  :
> 
> Error in <TTree::BranchObject>: Cannot find class:TMyClass
> 
> Is it so that one cannot use class defined in CINT, but only compiled class
> in a branch ?
> I am using ROOT 2.25 on Windows NT. Thanks very much for your help.
> 
>           F.X. Gentit
>           DAPNIA/SPP CEN Saclay
>           tel : 01 69 08 30 38     fax : 01 69 08 64 28
>           web : http://home.cern.ch/~gentit/
>  <<MyClass.C>>  <<testa.C>>
> 
>   --------------------------------------------------------------------------------
> 
>    MyClass.C   Name: MyClass.C
>                Type: unspecified type (application/octet-stream)
> 
>    testa.C   Name: testa.C
>              Type: unspecified type (application/octet-stream)



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