  Considering ultracold atoms traversing a high-Q Fabry-Perot cavity, we
theoretically demonstrate a quantum nondemolition measurement of the photon
number. This fully quantum mechanical approach may be understood utilizing
concepts as effective mass and group velocity of the atom. The various photon
numbers induce a splitting of the atomic wave packet, and a time-of-flight
measurement of the atom thereby reveals the photon number. While repeated
atomic measurements increase the efficiency of the protocol, it is shown that
by considering long interaction times only a few atoms are needed to resolve
the photon number with almost perfect accuracy.
