Fetching details from the dictionary...
to pull oneself together; to collect oneself (after a failure); to regain control (of oneself)