Re: Tree Questions

From: S. P. Wakely (wakely@hep.umn.edu)
Date: Tue Jan 12 1999 - 18:49:48 MET


Rene Brun wrote:
>I agree that it would be nice to have a symetric behaviour if you
work
>in split mode or not. We are currently a few doing brainstorming
>on new requirements for TTrees. This point is being discussed.
>I take this opportunity to ask users to send now specific
requirements
>regarding TTrees. It is the right time.

Maybe it would clutter the class too much, but there might be a desire
to see an encapsulation of the TTree::SetBranchAddress() (which is
just
an interface to TBranch::SetAddress()) and the TTree::GetEvent()
methods,
which would provide single-line access to single objects (for lazy
people
like me).  Like so:

          or GetBranchEvent???
Int_t TTree::GetEventBranch(const Text_t *bname, void* add, Int_t
eventnum = 0,Int_t getall)
{
//*-*-*-*-*-*-*-*-*Set branch address*-*-*-*-*-*-*-*
//*-*              ==================
//
//      Performs the tasks of TTree::SetBranchAddress and
TTree::GetEvent,
//      for the lazy...

  TBranch *branch = GetBranch(bname);
   if (branch){
  branch->SetAddress(add);
} else {
  Error("SetBranchAddress", "Unknown TBranch -> %s\n", bname);
  return 0;
 }
   if (event < 0 || event > fEntries) return 0;
 Int_t i;
 Int_t nbytes = 0;
 fReadEvent = event;
   if (fActiveBranches && getall == 0) {
  TObjLink *lnk = fActiveBranches->FirstLink();
       while (lnk) {
             branch = (TBranch*)lnk->GetObject();
             nbytes += branch->GetEvent(event);
             lnk = lnk->Next();
       }
       return nbytes;
   }

   Int_t nb = fBranches.GetEntriesFast();
   for (i=0;i<nb;i++)  {
        anch = (TBranch*)fBranches.UncheckedAt(i);
        ytes += branch->GetEvent(event);
   }
   return nbytes;

}



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