Energy-selective optical excitation and detection in InAs/InP quantum dot ensembles using a one-dimensional optical microcavity