Performance of a balloon-borne magnet spectrometer for cosmic ray studies