presence of mind

To calmly think about a situation and make the best decision rather than act on emotion

She had the presence of mind to call 911 immediately after the accident.