  This paper proposes and discusses a test of the chemical composition of
ultra-high energy cosmic rays that relies on the anisotropy patterns measured
as a function of energy. In particular, we show that if one records an
anisotropy signal produced by heavy nuclei of charge Z above an energy E_{thr},
one should record an even stronger (possibly much stronger) anisotropy at
energies >E_{thr}/Z due to the proton component that is expected to be
associated with the sources of the heavy nuclei. This conclusion remains robust
with respect to the parameters characterizing the sources and it does not
depend at all on the modelling of astrophysical magnetic fields. As a concrete
example, we apply this test to the most recent data of the Pierre Auger
Observatory. Assuming that the anisotropy reported above 55EeV is not a
statistical accident, and that no significant anisotropy has been observed at
energies <10EeV, we show that the apparent clustering toward Cen A cannot be
attributed to heavy nuclei. Similar conclusions are drawn regarding the
apparent excess correlation with nearby active galactic nuclei. We then discuss
a robust lower bound to the magnetic luminosity that a source must possess in
order to be able to accelerate particles of charge Z up to 100EeV,
L_B>10^{45}Z^{-2}erg/s. Using this bound in conjunction with the above
conclusions, we argue that the current PAO data does not support the model of
cosmic ray origin in active radio-quiet or even radio-loud galaxies. Finally,
we demonstrate that the apparent clustering in the direction of Cen A can be
explained by the contribution of the last few gamma-ray bursts or magnetars in
the host galaxy thanks to the scattering of the cosmic rays on the magnetized
lobes.
