  The chemical composition of the highest-energy cosmic rays, namely the atomic
number $Z$ of rays with energies $E\gtrsim40~\mathrm{EeV}$, remains to date
largely unknown. Some information on the composition can be inferred from the
deflections that charged ultra-high-energy cosmic rays experience while they
traverse intervening magnetic fields. Indeed, such deflections distort and
suppress the original anisotropy in the cosmic ray arrival directions; thus,
given a source model, a measure of the anisotropy is also a measurement of the
deflections, which in turn informs us on the chemical composition. In this
work, we show that, by quantifying ultra-high-energy cosmic ray anisotropies
through the angular cross-correlation between cosmic rays and galaxies, we
would be able to exclude iron fractions $f_{\rm Fe}\geq{\cal O}(10\%)$ assuming
a fiducial hydrogen map at $2\,\sigma$ level, and even smaller fractions in the
reverse case of hydrogen on an iron map, going well below $f_{\rm
H}\approx10\%$ when we mask the Galactic Centre up to latitudes of $40^\circ$.
This is an improvement of a factor of a few compared to our previous method,
and is mostly ascribable to a new test statistics which is sensitive to each
harmonic multipole individually. Our method can be applied to real data as an
independent test of the recent claim that current cosmic-ray data can not be
reproduced by any existing model of the Galactic magnetic field, as well as an
additional handle to compare any realistic, competing, data-driven composition
models.
