  When an incident light beam is scattered off a sample of ultracold atoms
trapped in an optical lattice, the statistical properties of the
retro-reflected field contain information about the quantum state of the atoms,
and permit for example to distinguish between atoms in a superfluid and a Mott
insulator state. This paper extends our previous analysis of this problem to
include the effects of cavity damping. We use a Monte Carlo wave function
method to determine the two-time correlation function and time-dependent
physical spectrum of the retro-reflected field in the case of a simple two-well
lattice. We also analyze quantitatively the entanglement between the atoms and
the light field for atoms in a Mott insulator and a superfluid state.
