Modelling superconducting nanowire single photon detectors in a waveguide cavity.