Recombination in the end regions of pin diodes