Description
Magnetic fields present in the Universe and interactions with the cosmic radiation backgrounds play an important role in shaping the flux of the ultrahigh energy cosmic rays reaching the Earth. To account for these processes we include in the SimProp cosmic ray propagation code the effect of a turbulent magnetic field through a stochastic deflection term in the trajectories. We compute the suppression of the spectrum due to the magnetic horizon effect, both for primary nuclei and for the (secondary) nuclei resulting from the photodisintegration of the primary ones. We provide analytic parameterizations of this effect as a function of the magnetic field parameters, and of the density of cosmic ray sources. This allows us to obtain the expected spectra in the presence of the magnetic fields from the one that would be obtained in their absence. We also discuss how the discreteness of the distribution of sources affects the spectrum of cosmic rays at the highest energies.