Re: Subclasses in TBranch: Browsing / arrays

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 19 1999 - 19:14:43 MEST


Ingo,
The user interface for TTree is in the TTree class itself.
Do not try to use classes such as TBranchObject, TBranch, TLeaf yourself
unless you understand deeply the TTree mechanism. All what you need
is in TTree. In your example below, do:

   TH1F *f =  new TH1F(.....
   TTree T("T","test")
   T.Branch("TH1F","TH1F",&f,64000,1)
   T.Print()

This particular example does not make too much sense. A TH1 object, in
general,
should not be split !

Rene Brun


Ingo Froehlich wrote:
> 
> On Thu, 19 Aug 1999, Rene Brun wrote:
> 
> > Ingo wrote:
> > > But it would be difficult for me to switch to TClonesArray (like it is
> > > done in the Event example). Does anybody know a workaround? Or did I made
> > > something wrong?
> >
> > The workaround consists in creating the branches yourself instead of
> > using the automatic split algorithm.
> >
> 
> Hi Rene,
> 
> as I understand yo, I have to put a TBranchObject in my class which points
> to my subclass (analog to tree->Branch). I did this but this doesn't
> work (a segmentation fault if I construct a TBranchObject. To test this I
> used CINT:
> 
> CINT/ROOT C/C++ Interpreter version 5.14.10, Jul 20 1999
> root [0] TH1F *f =  new TH1F();
> root [1] TBranchObject *b = new TBranchObject("TH1F","TH1F",&f,64000,1,1);
> 
>  *** Break *** segmentation violation
> 
> Is this a normal behaviour (a mistake myself?) or a problem of the system?
> (linux 2.2)
> 
> Thanks, Ingo
> 
> --
> Ingo Froehlich, II. Physikalisches Institut, Universitaet Giessen
> Heinrich-Buff-Ring 16, D-35392 Giessen           |  Tel.: 0641 - 99 33250
> EMail: Ingo.Froehlich@exp2.physik.uni-giessen.de |  Fax : 0641 - 99 33209
> Sekretariat II. Physik: 0641 - 99 33261          |                    :-)



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET