Passive quenching, signal shapes, and space charge effects in SPADs and SiPMs