Gravar-mail: An analytical model of the effects of pulse pileup on the energy spectrum recorded by energy resolved photon counting x-ray detectors