averageTarget function for Histogram