# How can one calculate the gamma-ray energy spectrum for proton-proton collisions?

How does one calculate the the energy spectrum of gamma-rays produced by a proton-proton collision? I'm at a complete loss.

Most gamma rays from $pp$ collisions come from neutral pions ($p+p\to p+p+\pi^0$), you'd first have to do some relativistic momentum & energy conservation to determine the energy of the neutral pion. It's easiest if you consider the two subsequent reactions: $$p+p\to p+\Delta^+ \\ \Delta^+\to p+\pi^{0}$$ (it's up to you to figure out the kinematics). The $\pi^0$ quickly decays (with $\langle\tau\rangle\sim10^{-16}\,{\rm s}$) into two photons: $\pi^0\to2\gamma$.
Fortunately, the source function of pions is symmetric about $\frac12m_{\pi^0}\simeq70\,{\rm MeV}$ ($c=1$ units) so that the pion source function for a power-law distribution, $n(E)\sim\mathbf n_pE_i^{s-1}E^{-s}$, is given by Edmon et al (2011) (cf. Section 3.3.3), \begin{align} q_{\pi^0}&\approx\frac{\sigma_{pp}c}{m_pc^2}2^{2-s}\frac{4}{3s}\left(\frac{m_\pi}{m_p}\right)^{-s}\\ &\qquad\times\left[\left(\frac{2E_\gamma}{m_\pi c^2}\right)^\delta+\left(\frac{2E_\gamma}{m_\pi c^2}\right)^{-\delta}\right]^{-s/\delta}n\left(s-1\right)E_i^{s-1}\mathbf n_p \end{align} where $\sigma_{pp}\sim3\times(0.96+\exp\left[4.4-2.4s\right])\times10^{-26}$ cm$^2$ is the cross-section, $E_i$ the cosmic ray proton energy, $\delta=0.14s^{-1.6}+0.44$, and $n$ is the number density of thermal protons. This has asymptotic limits of
$$q_{\pi^0}\left(E_\gamma,\mathbf{r}\right)\propto K_{\pi^0}\left(\mathbf{r}\right)\begin{cases}\left(E_\gamma/m_{\pi^0}\right)^{s} & \quad E_\gamma\ll m_{\pi^0} \\ \left(m_{\pi^0}/E_\gamma\right)^{s} & \quad E_\gamma\gg m_{\pi^0} \end{cases}$$ if you are interested in only those limits.
Once you have this source function, you need to integrate it over all-space to get the differential flux of $\gamma$-rays (the energy spectrum most people see) is found via: $$\frac{dN}{dt\,dE_\gamma\,d\Omega}=\frac{1}{4\pi}\int dr\,q_{\pi^0}\left(E_\gamma,\mathbf{r}\right)$$
For more in-depth covering of $\gamma$-ray spectrum from $pp$ reactions, see pretty much anything by Charles Dermer (especially his manuscript, High Energy Radiation from Black Holes: Gamma Rays, Cosmic Rays, and Neutrinos) or Reinhard Schlickeiser (especially his book Cosmic Ray Astrophysics). The aforementioned Edmon et al paper covers all $\gamma$-ray emissions from cosmic rays (inverse-Compton & bremsstrahlung). Kamae et al (2006) discusses the $\gamma$-ray and neutrino signals from the p-p collisions.