Add weight vector to ZDefinitionTree

Instead of having two hardcoded weight fields, ZDefinitionTree now has a
variable size array that is filled. The new "total weight" is the
product of all the weights in the array.