Monte Carlo simulation of carrier dynamics in terahertz quantum cascade lasers