The use of avalanche photodiodes in high energy electromagnetic calorimetry