Actually we don't need to sort jets by mass, because it is less efficient then sorting by pT.

Plot shows efficiency for different matching. The blue one is the sorting by pt, grey one - by mass. So, use the previous sorting. It is the case for all masses (300, 400, 500, 600 GeV)