buildTree function

Build and check tree data for subsequent use in BDAT Fortran subroutines