leafList = branch->GetListOfLeaves();
int entries = leafList->GetEntriesFast();
for (int i = 0; i < entries; i++) {
leaf = (TLeaf*) leafList->UncheckedAt(i);
// stuff
}
Cheers, Fons.
Sean Kelly wrote:
>
> Hi Rooters
>
> My question is with regards to the correct way to implement nested
> iterators.
>
> In the code fragment below, it seems that inner loop iterator is
> created many times, when all I really want to do is to reset it to
> the new value of leafList.
>
> Thanks for any advice.
>
> Sean Kelly
>
> TObjArray *branchList = ntuple->TTree::GetListOfBranches();
> TObjArray *leafList;
>
> TIter nextBranch(branchList);
> while ( branch = (TBranch*) nextBranch() ) {
> leafList = branch->GetListOfLeaves();
> TIter nextLeaf(leafList);
> while ( leaf = (TLeaf*) nextLeaf() ) {
>
> // stuff
>
> }
> }
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910