Detection mechanism of superconducting nanowire single-photon detectors