1. An apparatus for measuring inelastic scattering from an object comprises: a semiconductor single-photon avalanche detector, and a counter; the detector being configured to perform detections of single photons of optical radiation formed in an interaction between an optical excitation pulse and the object; the counter being configured to measure timing of each detection made in the detector with respect to the excitation pulse causing the detected photons, perform at least one of the following: forming a number of Raman detections in a Raman time window, forming a number of fluorescence detections in at least one fluorescence time window, the beginning moment of the at least one fluorescence window being after the beginning of the Raman window, where the counter is, related to the Raman detections, configured to form the number of the Raman detections by eliminating an estimate of a number of fluorescence photons in the Raman window, the estimate being formed on the basis of a number of the detections in the at least one fluorescence window, or the counter is, related to the fluorescence detections, configured to form the number of the fluorescence detections by eliminating an estimate of a number of Raman photons in the at least one fluorescence window, the estimate being formed on the basis of a number of the detections in the Raman window.