A simulation of a beam line particle sorter