The MICE Grand Challenge lightcone simulation – II. Halo and galaxy catalogues