Added gamma photon counting code. NB this is very much subject to testing/changing.