Created attachment 634 [details] Qt window of the application after /run/beamOn 1 Hello, I'm trying to report a problem of the purging_magnet example. The trajectory of electron is not bended by magnetic field when I run this example. Step to reproduce: (1)Get geant4 virtual machine from <https://geant4.cenbg.in2p3.fr/>, geant4.10.06p02 installed in CentOS8. (2) build and run the Purging_magnet example, apply command "/run/beamOn 1" Result: A straight line appears, representing the electron trajectory. (By using "/tracking/verbose",the printed information shows the electron keeps its -z direction.) Other version or platform: geant4.10.06p02, Ubuntu20.04, gcc9.3, the problem is same. geant4.10.02p02, CentOS7, gcc4.8.5(also virtual machine downloaded), no this problem, the electron is bended ~35cm away from zero in y-axis, as the PDF introduction says. The screenshot of the Qt window is attached. I'm new to field setup in Geant4, pls let me know if there's any other information should be provided about this problem.
Thank you for the report. I have investigated on a different machine. The problem is likely due to the sampling of the length of interaction -- a random number is used. If the magnetic field is sampled only at points at which it is zero, the integration will proceed incorrectly in a manner similar to the one that you have indicated. We need to ensure that tracks always 'sense' the finite field. One way is to create a volume around the region of non-zero field - in particular the region in which the material is vacuum or a gas. ( In those regions the length to the next interaction is large. ) When we caused the track to stop at a volume boundary, it must sample the field at multiple points before that boundary in the step that leads to the boundary. And in the next steps also it will sample the magnetic field, and thus be deflected. As a first step I have created a modified version of the example, which uses the extent of the magnetic field (as read in). We cannot enclose the full region of the magnetic field in a new volume -- it overlaps with an existing volume of the setup (Gap1). So this first modification creates a volume around the central axis - along which the beam is sent. Future refinements could either identify the exact region of the field which is does not overlap with other volumes or else create a parallel geometry with a volume that fully encloses the magnetic field.
Created attachment 662 [details] Modified include and source files adding a new volume for the core of the field
Hello. Did this work? Can you please let us know if you are still experiencing problem(s) ?