Description and performance of track and primary-vertex reconstruction with the CMS tracker