refactor the NewTreeTopology to use nTasks instead maxID