Mass measurement using energy spectra in three-body decays