Joke:What is a joke?
"Doctor, Doctor I feel like a pair of curtains."
"Well pull yourself together then."
When we open or shut curtains, we use the verb pull. So to pull the curtain is to open or shut the curtains.
Pull yourself together means get control of yourself.