Re: [ROOT] Problem with a Branch whose "buffer variable" is a pointer

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Feb 07 2002 - 15:00:54 MET


Hi David,

In order to organize the branches, ROOT has to build a detailed dictionary
for all the classes involved (top level classes, but also all referenced
classes). To build the dictionary, one has to build an instance of a class
and invoke the class ShowMembers function.
If the pointer specified to TTree::Branch is not null, ROOT will use
the corresponding object to build the dictionary, otherwise it will call
the class default constructor and will return the created object
at the pointer address. You can use this object if you like or delete it.
You can force your own object (created may be by a non-default constructor
before calling TTree::Branch.


Rene Brun



David Chamont wrote:
> 
> Hi,
> 
> Given the following code :
> 
>   int main()
>    {
>     TROOT root("dummy","dummy") ;
>     TFile file("dummy.root","recreate") ;
>      int split = 99 ;
>      int bufsize = 16000 ;
>      RtSimHit * hit = 0 ;
>      TTree tree("T","CMS demo tree");
>      tree.Branch("hit","RtSimHit",&hit,bufsize,split) ;
>   ...
> 
> I observe that after the last call, the pointer hit
> is not any more null. Is it on purpose ? If so, why ?
> 
> David C.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET