Problem 2260 - magnetic field does not take effect, trajectory keeps straight line
Summary: magnetic field does not take effect, trajectory keeps straight line
Status: RESOLVED REMIND
Alias: None
Product: Examples/Advanced
Classification: Unclassified
Component: purging_magnet (show other problems)
Version: 10.6
Hardware: PC Linux
: P4 major
Assignee: John Apostolakis
URL:
Depends on:
Blocks:
 
Reported: 2020-07-13 17:11 CEST by yyg_pku
Modified: 2021-09-13 19:19 CEST (History)
1 user (show)

See Also:


Attachments
Qt window of the application after /run/beamOn 1 (80.26 KB, image/png)
2020-07-13 17:11 CEST, yyg_pku
Details
Modified include and source files adding a new volume for the core of the field (60.50 KB, application/octet-stream)
2021-01-27 10:44 CET, John Apostolakis
Details

Note You need to log in before you can comment on or make changes to this problem.
Description yyg_pku 2020-07-13 17:11:38 CEST
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.
Comment 1 John Apostolakis 2021-01-27 10:41:54 CET
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.
Comment 2 John Apostolakis 2021-01-27 10:44:51 CET
Created attachment 662 [details]
Modified include and source files adding a new volume for the core of the field
Comment 3 John Apostolakis 2021-09-13 19:19:00 CEST
Hello.

Did this work? Can you please let us know if you are still experiencing problem(s) ?