Pull Yourself Together

What does the idiom “Pull Yourself Together” mean?

Definition:

Control your emotions; recover from a strong emptional upset

For example:

“I know it was hard seeing your ex-boyfriend at the bar, but you need to pull yourself together so we can go home.”