Gain and transient photoresponse of quantum well infrared photodetectors: a detailed ensemble Monte Carlo study