Transverse momentum spectra at threshold for groomed heavy quark jets