root2hdf5: loop on sorted trees