One has to decide what the observable to measure is, and expand the state onto its eigenstates accordingly.
In your example one wants to measure the position of the particle, hence it is convenient to expand the state $|\psi\rangle$ as
$$
|\psi\rangle = \int \textrm{d}x'\,|x'\rangle\langle x'|\psi\rangle.
$$
In order to measure the possible position of the particle we need to have a detector (meaning any possible device) interact with it. We place the detector at $|x_{\textrm{det}}\rangle$ (assuming this makes sense, for simplicity) and start performing measurements in any possible way (for example, the detector scatters photons all around in the universe waiting for them to be scattered back by the particle). The particle is now in its initial state, but because of this measurement being performed (i. e. the photons being scattered) its state gets modified and broken into $|x_{\textrm{pos}}\rangle$. Therefore we have
$$
|\psi_{\textrm{init}}\rangle = \int \textrm{d}x'\,|x'\rangle\langle x'|\psi\rangle \quad \xrightarrow{\textrm{photons}}\quad |x_{\textrm{pos}}\rangle
$$
and we define $|x_{\textrm{pos}}\rangle$ as the outcome of the measurement.
In your example you want the measurement to be placed at the position of the detector, as we want the particle to pass through. Consequently: either the state collapses into $|x_{\textrm{pos}}\rangle = |x_{\textrm{det}}\rangle$ at some point in time (namely the particle hits the detector) or it does not; in the latter case the particle state is still a superposition of all possible other states, since no measurement has been performed that would make it collapse.