Re: [ROOT] sub-branch SetAddress/GetEvent behavior question

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 04 2001 - 18:55:04 MEST


Hi Kate,

Yes, you can set individual branch addresses and read only one or a few
branches. The problem in your case is that you seem to have a branch
with an int*. You cannot read this branch alone. You also need the
accompanying branch holding the length of the array.
Currently, I assume that both the counter and the array are in the same class.

Rene Brun

Kate Scholberg wrote:
> 
> > If you have a top level branch corresponding to Event* event,
> > you need to set the top level branch address only. The address of all the sub
> > branches will be automatically set, eg:
> >
> >   Event *event = 0; //important to set teh pointer to 0;
> >   myTree->SetBranchAddress("event",&event);
> >
> >   myTree->GetEntry(0); This will fill your Event object. You can now use
> >                        normal C++ to navigate in your Event object.
> > This procedure is the same if you use split mode or not.
> >
> 
> Yes, I know this works.
> 
> But I have reasons to go directly to the sub-branch *without* setting
> the top-level address (due to existing code structure).  But I guess
> this is not expected to work (which was my question), so I'll work
> things around it.
> 
> Thanks,
> Kate.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:51 MET