The influence of upstream material on the performance of an electromagnetic calorimeter inside a magnetic field