1. A method for analyzing elemental composition of a sample, the method comprising: a. irradiating the sample with x-rays; b. detecting x-rays fluoresced by the sample in response to irradiation, thereby generating detector signal pulses; c. preamplifying the detector signal pulses; d. processing the detector signal pulses subject to pulse processing parameters; e. determining energy resolution requirements based on analysis of sample composition; and f. setting at least one of the pulse processing parameters on the basis of the determined energy resolution requirements.