Re: [ROOT] CopyTree and Single Object Branches

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Feb 25 2003 - 18:19:58 MET


Hi,

If you have created your Tree with one single top level branch (eg event), you
should set the address of this top level branch and not the address of one of
the sub-branches. I need to see your code to come with a better
diagnostic.

You are mentionning problems with rootcint with the more recent versions of
ROOT. Did you report these problems to somebody?

Rene Brun

Roger Moore wrote:
> 
> I have been using the CopyTree method, along with a TEventList, to select
> a subset of events and branches in a TChain to write out to a TTree. This
> works absolutely fine for TClonesArray branches. However for the single
> object branch in the TChain it fails miserably. The entire branch somehow
> gets converted into a single 'TObject' branch. Shown below is the result
> of a 'Print' of the original TChain branch:
> 
> root [5] TMBTree->GetBranch("Glob")->Print("")
> *Branch  :Glob                                                               *
> *Entries :    13865 : BranchElement (see below)                              *
> *............................................................................*
> *Br    1 :fUniqueID :                                                        *
> *Entries :    13865 : Total  Size=      68940 bytes  File Size  =       1414 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  39.59     *
> *............................................................................*
> *Br    2 :fBits     :                                                        *
> *Entries :    13865 : Total  Size=      68860 bytes  File Size  =       1400 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  39.99     *
> *............................................................................*
> *Br    3 :_evtno    :                                                        *
> *Entries :    13865 : Total  Size=      68880 bytes  File Size  =      49526 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=   1.13     *
> *............................................................................*
> *Br    4 :_runno    :                                                        *
> *Entries :    13865 : Total  Size=      68880 bytes  File Size  =       2602 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  21.50     *
> *............................................................................*
> *Br    5 :_store    :                                                        *
> *Entries :    13865 : Total  Size=      68880 bytes  File Size  =       2279 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  24.55     *
> *............................................................................*
> *Br    6 :_solpol   :                                                        *
> *Entries :    13865 : Total  Size=      68900 bytes  File Size  =       1418 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  39.46     *
> *............................................................................*
> *Br    7 :_torpol   :                                                        *
> *Entries :    13865 : Total  Size=      68900 bytes  File Size  =       1418 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  39.46     *
> *............................................................................*
> *Br    8 :_ticknum  :                                                        *
> *Entries :    13865 : Total  Size=      68920 bytes  File Size  =      17272 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=   3.24     *
> *............................................................................*
> *Br    9 :_lumblk   :                                                        *
> *Entries :    13865 : Total  Size=      68900 bytes  File Size  =       6973 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=   8.02     *
> *............................................................................*
> *Br   10 :_solcur   :                                                        *
> *Entries :    13865 : Total  Size=      68900 bytes  File Size  =       1980 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  28.26     *
> *............................................................................*
> *Br   11 :_torcur   :                                                        *
> *Entries :    13865 : Total  Size=      68900 bytes  File Size  =       2299 *
> *Baskets :       14 : Basket Size=       4000 bytes  Compression=  24.34     *
> *............................................................................*
> 
> and after CopyTree has done its work the branch in the output file is now:
> 
> *Branch  :Glob                                                               *
> *Entries :      326 : BranchElement (see below)                              *
> *............................................................................*
> *Br    0 :TObject   :                                                        *
> *Entries :      326 : Total  Size=      16976 bytes  File Size  =        526 *
> *Baskets :        1 : Basket Size=       4000 bytes  Compression=   5.95     *
> *............................................................................*
> 
> The original class, TMBGlob, is loaded and ROOT clearly recognises it
> since with the original branch I can decode and look at all the entries
> with the class loaded. When I set the branch address I use the command:
> 
>         SetBranchAddress("Glob",&_ptr);
> 
> where _ptr is of type "TMBGlob *" and points to a TMBGlob class instance.
> 
> The version of ROOT I am running is v3.03/09. I have tried compiling the
> code under both v03.04/02 and v03.05/00. However there are lots of
> problems with both version from rootcint and, after an initial attempt to
> fix them, I have come to the conclusiosn that this is several days effort
> which is time I don't currently have!
> 
> So is there a fix or workaround which I can use with v03.03/09?
> 
> Thanks,
> 
> Roger



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