Calculation of string correlation functions on a hierarchical tree