TreeAnnot function

Returns the underlying annotation given a tree pattern.