add object counts to the output tree, clean up some variable names (prepend truth_ to truth vars)
cleanup: remove unused code, use more preprocessor macros for branch creation