Keep one`s wits about one

To stay calm when there is trouble or danger.

There was a fire in the building but the security guard was able to keep his wits about him and help everybody to safety.