Wiktionary
pull oneself together
vb. (context idiomatic English) To become mentally focused after a period of being unfocused.