A high speed gamma ray is projected at a nucleus of matter (e.g. a Lead nucleus). Each gamma ray photon loses its energy ( hf ), when it collides with the nucleus, producing an electron positron pair.
Some of the energy is converted into the mass of the electron and positron. The rest is the kinetic energy of the electron and the position.