The flux of cosmic rays is tiny. While it is not completely impossible to use them to get some net force, a device as simple as your sketch doesn't work - for every particle deflected in one direction you would also have particles deflected in other directions. And if you try to stop those, you stop the other particles as well.Here is an extremely inefficient approach that generates net thrust: Make your spacecraft out of (ideal) material that absorbs all incoming particles that hit it anywhere. Have a single curved tunnel go through the spacecraft , with a uniform magnetic field parallel to the curvature vector, the magnetic flux return happens somewhere inside the spacecraft . The spacecraft absorbs radiation uniformly apart from two exceptions: (a) electrons with a specific velocity entering at one side, passing through the tunnel and getting deflected towards the center of curvature, and (b) ions entering at the other side with a type-dependent specific velocity, passing through the tunnel and getting deflected in the same way.
If the spacecraft is in a frame with isotropic flux, it produces a bit of net thrust: half of the momentum change in the tunnel (the other half is balancing the lack of absorbing particles coming from a particular direction).
If the spacecraft has some speed relative to the frame of isotropic flux already, then the absorption will slow the spacecraft , and the flux of particles going through the tunnel goes down a bit - the spacecraft has some limited maximal speed that depends on its geometry and details of the particle flux. Note that during the acceleration process, in the frame of isotropic flux, the spacecraft slows down some particles (those going through the tunnel) that fly in the direction of the spacecraft more than simple absorption would, which provides both energy and momentum.
The overall forces are completely negligible.