RE: [ROOT] filling tree with objects

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Jul 03 2003 - 18:18:12 MEST


Hi Paul,

I am surprised that your dictionary generation succeeded.  I would expect that you need to have (in that order):

class V0 : public TObject {
(...)
ClassDef(V0,1);
};
....
#ifdef __MAKECINT__
#pragma link C++ namespace recocert;
#pragma link C++ class recocert::V0+;
#endif

__AND__ 

have either an empty linkdef file or at least a linkdef file with NO 'pragma link off'

Cheers,
Philippe.


-----Original Message-----
From: Paul Balm [mailto:r45@nikhef.nl]
Sent: Thursday, July 03, 2003 10:42 AM
To: Philippe Canal
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] filling tree with objects


Hi Philippe,

In the header file that defines the V0 class, I (now) have:

#pragma link C++ namespace recocert;
#pragma link C++ class recocert::V0+;

and later on:

class V0 : public TObject {
(...)
};

When I run the program, it says:

Error in <TTree::Bronch>: Cannot find class:recocert::V0

So I think the answer to your question is yes, but...

Thanks-

Paul


Philippe Canal wrote:

>Hi Paul,
>
>This should work.
>
>Did you create a dictionary for the namespace recocert?
>	#pragma link C++ namespace recocert;
>
>
>Cheers,
>Philippe.
>
>-----Original Message-----
>From: owner-roottalk@pcroot.cern.ch
>[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Paul Balm
>Sent: Wednesday, July 02, 2003 8:07 AM
>To: roottalk@pcroot.cern.ch
>Subject: [ROOT] filling tree with objects
>
>
>Hello,
>
>I'm trying to fill a TTree with objects of a class "V0", declared in a
>namespace "recocert". I do this:
>
>TTree* _mytree = new TTree("V0tree","secondary vertices");
>V0* _myV0 = new V0();
>
>_mytree->Branch("V0s", "recocert::V0",&_myV0);
>
>This gives me an error message:
>
>Error in <TTree::Bronch>: Cannot find class:recocert::V0
>
>At first I was creating the branch like this:
>
>_mytree->Branch("V0s", "V0",&_myV0);
>
>(i.e. omitting the "recocert::"), this gave me the same error message,
>but, without "recocert::".
>
>In the same file where I create the tree and the branch, I have "using
>namespace recocert;"
>
>Any idea what the problem is here? Is this just not supported? Are there
>ways to work around it?
>
>I'm using this root version:
>/D0/ups/root/Linux-2-4/v3_05_00bKCC_4_0-exception-opt-thread
>On Red Hat 7.1.
>
>Thanks!
>
>Paul
>
>  
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET