Dynamics of an atomic wave packet in a standing-wave cavity field: A cavity-assisted single-atom detection