added D1 and D2 functions for SME with photo detection