RPID — A new digital particle identification algorithm for CsI(Tl) scintillators