  This work examines optimized strategies for the preparation of single
molecular ions in well-defined rotational quantum states in an ion trap with
the example of the molecular nitrogen ion N2+. It advances a two-step approach
consisting of an initial threshold-photoionization stage which produces
molecular ions with a high probability in the target state, followed by a
measurement-based state purification of the sample. For this purpose, a
resonance-enhanced threshold photoionization scheme for producing N2+ in its
rovibrational ground state proposed by Gardner et al. [Sci. Rep. 9, 506 (2019)]
was characterized. The molecular state was measured using a recently developed
quantum-non-demolition state-detection method finding a total fidelity of
38(7)% for producing ground-state N2+ under the present experimental
conditions. By discarding ions from the trap not found to be in the target
state, essentially state-pure samples of single N2+ ions can be generated for
subsequent state-specific experiments.
