Energy deposition from photoelectrons in inhomogeneous materials