Re: pyroot objects

From: <wlavrijsen_at_lbl.gov>
Date: Wed, 10 Aug 2011 11:03:51 -0700


Yngve,

TTree's already have a __iter__, but its implementation is differently from your choice: it iterates over entries, not over branches.

As for getting all entries into a numpy array, I can't think of anything faster, as one has to read them, but one optimization usually helps, which is to switch off any branches not used in the iteration (so that their values are not loaded during the loop) and/or to use those branches directly instead of the tree (the TTree::GetEntry loops over all branches, which is a waste if you're only interested in a few branches).

Best regards,

            Wim

-- 
WLavrijsen_at_lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net
Received on Wed Aug 10 2011 - 20:01:54 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 11 2011 - 17:50:02 CEST