ACS imaging of star clusters in M 51 : II. The luminosity function and mass function across the disk