Pion production near threshold on 40Ca: Energy dependence and angular distribution