Characterization of quantum non-demolition measurements in optics