  Quantum state preparation is important for quantum information processing. In
particular, in optical quantum computing with continuous variables,
non-Gaussian states are needed for universal operation and error correction.
Optical non-Gaussian states are usually generated by heralding schemes using
photon detectors. In previous experiments, the temporal resolution of the
photon detectors was sufficiently high relative to the time width of the
quantum state, so that the conventional theory of non-Gaussian state
preparation treated the detector's temporal resolution as negligible. However,
when using various photon detectors including photon-number-resolving
detectors, the temporal resolution is non-negligible. In this paper, we extend
the conventional theory of quantum state preparation using photon detectors to
the finite temporal resolution regime, analyze the cases of single-photon and
two-photon preparation as examples, and find that the generated states are
characterized by the dimensionless parameter $B$, defined as the product of the
temporal resolution of the detectors $\Delta t$ and the bandwidth of the light
source $\Delta f$. Based on the results, $B\sim0.1$ is required to keep the
purity and fidelity of the generated quantum states high.
