  Thorough control of quantum measurement is key to the development of quantum
information technologies. Many measurements are destructive, removing more
information from the system than they obtain. Quantum non-demolition (QND)
measurements allow repeated measurements that give the same eigenvalue. They
could be used for several quantum information processing tasks such as error
correction, preparation by measurement, and one-way quantum computing.
Achieving QND measurements of photons is especially challenging because the
detector must be completely transparent to the photons while still acquiring
information about them. Recent progress in manipulating microwave photons in
superconducting circuits has increased demand for a QND detector which operates
in the gigahertz frequency range. Here we demonstrate a QND detection scheme
which measures the number of photons inside a high quality-factor microwave
cavity on a chip. This scheme maps a photon number onto a qubit state in a
single-shot via qubit-photon logic gates. We verify the operation of the device
by analyzing the average correlations of repeated measurements, and show that
it is 90% QND. It differs from previously reported detectors because its
sensitivity is strongly selective to chosen photon number states. This scheme
could be used to monitor the state of a photon-based memory in a quantum
computer.
