As soon as I arrived at the airport, I realized I had forgotten my ticket.

Literal

Airport [to-に] arriving [as-soon-as-とすぐ] ticket [object-を] forgot thing [to-に] noticed.

着くとすぐ uses と conditional for immediate sequence. 切符を忘れたことに気が付いた means 'noticed that I forgot my ticket.' ことに気がつく is the standard pattern for realizing something.