  We study the abundance of star-forming and quiescent galaxies in a sample of
21 massive clusters at 0.5<z<0.7, detected with the Planck satellite. We
measure the cluster galaxy stellar mass function (SMF), which is a fundamental
observable to study and constrain the formation and evolution of galaxies. Our
measurements are based on homogeneous and deep multi-band photometry spanning
u- to the Ks-band for each cluster and are supported by spectroscopic data from
different programs. The galaxy population is separated between quiescent and
star-forming galaxies based on their rest-frame U-V and V-J colours. The SMF is
compared to that of field galaxies at the same redshifts, using data from the
COSMOS/UltraVISTA survey. We find that the shape of the SMF of star-forming
galaxies does not depend on environment, while the SMF of quiescent galaxies
has a significantly steeper low-mass slope in the clusters compared to the
field. We estimate the environmental quenching efficiency (f_EQ), i.e. the
probability for a galaxy that would normally be star forming in the field, to
be quenched due to its environment. The f_EQ shows no stellar-mass dependence
in any environment, but it increases from 40% in the cluster outskirts to ~90%
in the cluster centres. The radial signature of f_EQ provides constraints on
where the dominant quenching mechanism operates in these clusters and on what
timescale. Exploring these using a simple model based on galaxy orbits obtained
from an N-body simulation, we find a clear degeneracy between both parameters.
For example, the quenching process may either be triggered on a long (~3 Gyr)
time scale at large radii (r~8R_500), or happen well within 1 Gyr at r<R_500.
The radius where quenching is triggered is at least r_quench> 0.67R_500
(95%CL). The ICM density at this location suggests that ram-pressure stripping
of the cold gas is a likely cause of quenching. [Abridged]
