A method for high resolution amplitude measurements in presence of noise and pile-up fluctuations