A magnetic spectrometer for cosmic ray studies