A method for detecting an operating state of an ejection unit during the printing of an object of a print job comprising one or more objects, wherein the ejection unit is arranged to eject droplets of a liquid and comprises a plurality of nozzles , a liquid duct connected to a nozzle , and an electro-mechanical transducer arranged to create an acoustic pressure wave in the liquid in the duct , the method comprising the steps of: a) actuating the electro-mechanical transducer to generate a pressure wave in the liquid; b) sensing a residual pressure wave in the liquid; c) measuring a resonance frequency of the sensed residual pressure wave; d) determining whether the ejection unit is in an operative state or in a malfunctioning state, wherein the ejection unit is determined to be in a malfunctioning state when the difference between the measured resonance frequency of the residual pressure wave and the resonance frequency of a reference residual pressure wave of a correctly functioning ejection unit exceeds a resonance frequency threshold amount; and e) if it is determined in step d) that the ejection unit is in a malfunctioning state, measuring the energy of the sensed residual pressure wave and determining that the ejection unit is in a malfunctioning state due to the presence of a dirt particle inside the duct if the measured energy of the residual pressure wave is lower than the energy of a reference residual pressure wave of a correctly functioning ejection unit by at least an energy threshold amount, and is in a malfunctioning state due to the presence of a dirt particle at/inside the nozzle if the measured energy of the residual pressure wave is higher than the energy of a reference residual pressure wave of a correctly functioning ejection unit by at least an energy threshold amount. a) actuating the electro-mechanical transducer to generate a pressure wave in the liquid; b) sensing a residual pressure wave in the liquid; c) measuring a resonance frequency of the sensed residual pressure wave; d) determining whether the ejection unit is in an operative state or in a malfunctioning state, wherein the ejection unit is determined to be in a malfunctioning state when the difference between the measured resonance frequency of the residual pressure wave and the resonance frequency of a reference residual pressure wave of a correctly functioning ejection unit exceeds a resonance frequency threshold amount; and e) if it is determined in step d) that the ejection unit is in a malfunctioning state, measuring the energy of the sensed residual pressure wave and determining that the ejection unit is in a malfunctioning state due to the presence of a dirt particle inside the duct if the measured energy of the residual pressure wave is lower than the energy of a reference residual pressure wave of a correctly functioning ejection unit by at least an energy threshold amount, and is in a malfunctioning state due to the presence of a dirt particle at/inside the nozzle if the measured energy of the residual pressure wave is higher than the energy of a reference residual pressure wave of a correctly functioning ejection unit by at least an energy threshold amount. <EOS>