process leaves in treeprod