Response of the magnetosphere to perturbation by storms and Alfven wave trains