Hook event for tree generation