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;
}