Cosmic rays provide one of our few direct samples of matter from outside the solar system.
The magnetic fields of the Galaxy, the solar system, and the Earth have scrambled the flight paths of these particles so much that we can no longer point back to their sources in the Galaxy. If you made a map of the sky with cosmic ray intensities, it would be completely uniform. So we have to determine where cosmic rays come from by indirect means. All of the natural elements in the periodic table are present in cosmic rays, in roughly the same proportion as they occur in the solar system. Measuring the quantity of each different element is relatively easy, since the different charges of each nucleus give very different signatures.