Apparatus for monitoring, sorting or marking