Electron trajectory stops upon entering electric field

_Geant4 Version:_11.2.2
Operating System: Linux (5.15.0-124-generic)
_Compiler/Version:_GCC-12.3.0
_CMake Version:_3.26.3

Hello,
I have an electric field in my model (field created from reading a file) and as soon as an electron enters this field, the trajectory seems to stop (see attached picture). If instead, I create a uniform field, then the trajectory is OK. I have changed the defined field so that it is also uniform (in case I was creating some Nans in my field), but the electron still just stops before entering the region where the field is defined. I put the verbose level to 5 for the tracking and also put some debug statements in code where the field is returned in the GetFieldValue routine (see below -if you feel inclined! - for a rather extensive output). Can anyone suggest what the problem might be, or what else I might try to debug the problem.

Thanks in advance
Chris

image

G4WT0 > >>AlongStepDoIt (process by process): Process Name = Transportation
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 0
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 0-1.590641956799041e-11
G4WT0 > Momentum Direct - y : 0 0.1080616431326018
G4WT0 > Momentum Direct - z : 1 0.9941441954180903
G4WT0 > Momentum - x (MeV/c): 0-3.0490807791576e-11
G4WT0 > Momentum - y (MeV/c): 0 0.2071419514815622
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905662015894729
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620395
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620395
G4WT0 > Velocity (mm/ns) : 18.72789736601522 18.72789736601522
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 0
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 > !Note! Safety of PostStep is only valid after all DoIt invocations.
G4WT0 >
G4WT0 > ++G4ParticleChange Information
G4WT0 > -----------------------------------------------
G4WT0 > G4VParticleChange Information
G4WT0 > TrackID : 1
G4WT0 > ParentID : 0
G4WT0 > Particle : e-
G4WT0 > Kinetic energy (MeV): 0.001
G4WT0 > Position (mm) : (0,-40,-60)
G4WT0 > Direction : (0,0,1)
G4WT0 > PhysicsVolume : World
G4WT0 > Material : Vacuum
G4WT0 > -----------------------------------------------
G4WT0 > # of secondaries : 0
G4WT0 > -----------------------------------------------
G4WT0 > Energy Deposit (MeV): 0
G4WT0 > NIEL Energy Deposit (MeV): 0
G4WT0 > Track Status : StopAndKill
G4WT0 > TruePathLength (mm) : 35.088282
G4WT0 > Stepping Control : 0
G4WT0 > First step in volume
G4WT0 > Mass (GeV) : 0
G4WT0 > Charge (eplus) : 0
G4WT0 > MagneticMoment : 0
G4WT0 > = : 0*[e hbar]/[2 m]
G4WT0 > Position - x (mm) : 0.00044167727
G4WT0 > Position - y (mm) : -40.000114
G4WT0 > Position - z (mm) : -24.951257
G4WT0 > Time (ns) : 1.8721232
G4WT0 > Proper Time (ns) : 1.8684667
G4WT0 > Momentum Direct - x : -1.590642e-11
G4WT0 > Momentum Direct - y : 0.10806164
G4WT0 > Momentum Direct - z : 0.9941442
G4WT0 > Kinetic Energy (MeV): 1.4728296
G4WT0 > Velocity (/c) : 0.062469541
G4WT0 > Polarization - x : 0
G4WT0 > Polarization - y : 0
G4WT0 > Polarization - z : 0
G4WT0 > Touchable (pointer) : 0x7fd069c9f1a0
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0
G4WT0 >
G4WT0 > >>AlongStepDoIt (process by process): Process Name = msc
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 0
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 01.43039763975254e-06
G4WT0 > Momentum Direct - y : 0 0.1080658198709856
G4WT0 > Momentum Direct - z : 1 0.9941437414044135
G4WT0 > Momentum - x (MeV/c): 02.741910542017017e-06
G4WT0 > Momentum - y (MeV/c): 0 0.207149957816785
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905661145601846
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620395
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620395
G4WT0 > Velocity (mm/ns) : 18.72789736601522 18.72789736601522
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 0
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 > !Note! Safety of PostStep is only valid after all DoIt invocations.
G4WT0 >
G4WT0 > ++G4ParticleChange Information
G4WT0 > -----------------------------------------------
G4WT0 > G4VParticleChange Information
G4WT0 > TrackID : 1
G4WT0 > ParentID : 0
G4WT0 > Particle : e-
G4WT0 > Kinetic energy (MeV): 0.001
G4WT0 > Position (mm) : (0,-40,-60)
G4WT0 > Direction : (0,0,1)
G4WT0 > PhysicsVolume : World
G4WT0 > Material : Vacuum
G4WT0 > -----------------------------------------------
G4WT0 > # of secondaries : 0
G4WT0 > -----------------------------------------------
G4WT0 > Energy Deposit (MeV): 0
G4WT0 > NIEL Energy Deposit (MeV): 0
G4WT0 > Track Status : StopAndKill
G4WT0 > TruePathLength (mm) : 35.088282
G4WT0 > Stepping Control : 0
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0
G4WT0 >
G4WT0 > >>AlongStepDoIt (process by process): Process Name = eIoni
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 7.352296106959119e-16
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 01.43039763975254e-06
G4WT0 > Momentum Direct - y : 0 0.1080658198709856
G4WT0 > Momentum Direct - z : 1 0.9941437414044135
G4WT0 > Momentum - x (MeV/c): 02.741910542017016e-06
G4WT0 > Momentum - y (MeV/c): 0 0.2071499578167849
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905661145601845
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620394
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620394
G4WT0 > Velocity (mm/ns) : 18.72789736601522 289.6763777177531
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 0
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 > !Note! Safety of PostStep is only valid after all DoIt invocations.
G4WT0 >
G4WT0 > ++G4ParticleChange Information
G4WT0 > -----------------------------------------------
G4WT0 > G4VParticleChange Information
G4WT0 > TrackID : 1
G4WT0 > ParentID : 0
G4WT0 > Particle : e-
G4WT0 > Kinetic energy (MeV): 0.001
G4WT0 > Position (mm) : (0,-40,-60)
G4WT0 > Direction : (0,0,1)
G4WT0 > PhysicsVolume : World
G4WT0 > Material : Vacuum
G4WT0 > -----------------------------------------------
G4WT0 > # of secondaries : 0
G4WT0 > -----------------------------------------------
G4WT0 > Energy Deposit (MeV): 7.3522961e-16
G4WT0 > NIEL Energy Deposit (MeV): 0
G4WT0 > Track Status : StopAndKill
G4WT0 > TruePathLength (mm) : 0
G4WT0 > Stepping Control : 0
G4WT0 > -----------------------------------------------
G4WT0 > G4ParticleChangeForLoss proposes:
G4WT0 > Charge (eplus) : -1
G4WT0 > Kinetic Energy (MeV): 0.001
G4WT0 > Momentum Direct - x : 0
G4WT0 > Momentum Direct - y : 0
G4WT0 > Momentum Direct - z : 0
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0
G4WT0 >
G4WT0 > >>AlongStepDoIt (after all invocations):
G4WT0 > ++List of invoked processes
G4WT0 > 1) Transportation
G4WT0 > 2) msc
G4WT0 > 3) eIoni
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 7.352296106959119e-16
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 01.43039763975254e-06
G4WT0 > Momentum Direct - y : 0 0.1080658198709856
G4WT0 > Momentum Direct - z : 1 0.9941437414044135
G4WT0 > Momentum - x (MeV/c): 02.741910542017016e-06
G4WT0 > Momentum - y (MeV/c): 0 0.2071499578167849
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905661145601845
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620394
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620394
G4WT0 > Velocity (mm/ns) : 18.72789736601522 289.6763777177531
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 24.41171788958084
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secondaries = 0
G4WT0 >
G4WT0 > >>PostStepDoIt (process by process): Process Name = Transportation
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 7.352296106959119e-16
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 01.43039763975254e-06
G4WT0 > Momentum Direct - y : 0 0.1080658198709856
G4WT0 > Momentum Direct - z : 1 0.9941437414044135
G4WT0 > Momentum - x (MeV/c): 02.741910542017016e-06
G4WT0 > Momentum - y (MeV/c): 0 0.2071499578167849
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905661145601845
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620394
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620394
G4WT0 > Velocity (mm/ns) : 18.72789736601522 289.6763777177531
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 24.41171788958084
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 >
G4WT0 >
G4WT0 > ++G4ParticleChange Information
G4WT0 > -----------------------------------------------
G4WT0 > G4VParticleChange Information
G4WT0 > TrackID : 1
G4WT0 > ParentID : 0
G4WT0 > Particle : e-
G4WT0 > Kinetic energy (MeV): 1.4728296
G4WT0 > Position (mm) : (0.00044167727,-40.000114,-24.951257)
G4WT0 > Direction : (1.4303976e-06,0.10806582,0.99414374)
G4WT0 > PhysicsVolume : World
G4WT0 > Material : Vacuum
G4WT0 > -----------------------------------------------
G4WT0 > # of secondaries : 0
G4WT0 > -----------------------------------------------
G4WT0 > Energy Deposit (MeV): 0
G4WT0 > NIEL Energy Deposit (MeV): 0
G4WT0 > Track Status : StopAndKill
G4WT0 > TruePathLength (mm) : 35.088282
G4WT0 > Stepping Control : 0
G4WT0 > First step in volume
G4WT0 > Mass (GeV) : 0
G4WT0 > Charge (eplus) : 0
G4WT0 > MagneticMoment : 0
G4WT0 > = : 0*[e hbar]/[2 m]
G4WT0 > Position - x (mm) : 0.00044167727
G4WT0 > Position - y (mm) : -40.000114
G4WT0 > Position - z (mm) : -24.951257
G4WT0 > Time (ns) : 1.8721232
G4WT0 > Proper Time (ns) : 1.8684667
G4WT0 > Momentum Direct - x : -1.590642e-11
G4WT0 > Momentum Direct - y : 0.10806164
G4WT0 > Momentum Direct - z : 0.9941442
G4WT0 > Kinetic Energy (MeV): 1.4728296
G4WT0 > Velocity (/c) : 0.062469541
G4WT0 > Polarization - x : 0
G4WT0 > Polarization - y : 0
G4WT0 > Polarization - z : 0
G4WT0 > Touchable (pointer) : 0x7fd069c9f218
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0
G4WT0 >
G4WT0 > **PostStepDoIt (after all invocations):
G4WT0 > ++List of invoked processes
G4WT0 > 1) Transportation (Forced)
G4WT0 > 2) e-_G4MicroElecSurface (Forced)
G4WT0 >
G4WT0 > ++G4Step Information
G4WT0 > Address of G4Track : 0x7fd069ce3580
G4WT0 > Step Length (mm) : 35.08828211041916
G4WT0 > Energy Deposit (MeV) : 7.352296106959119e-16
G4WT0 > -----------------------------------------------------------------------
G4WT0 > StepPoint Information PreStep PostStep
G4WT0 > -----------------------------------------------------------------------
G4WT0 > Position - x (mm) : 00.0004416772673549957
G4WT0 > Position - y (mm) : -40 -40.00011373748431
G4WT0 > Position - z (mm) : -60 -24.95125732597501
G4WT0 > Global Time (ns) : 0 1.872123201542468
G4WT0 > Local Time (ns) : 0 1.872123201542468
G4WT0 > Proper Time (ns) : 0 1.868466703130113
G4WT0 > Momentum Direct - x : 01.43039763975254e-06
G4WT0 > Momentum Direct - y : 0 0.1080658198709856
G4WT0 > Momentum Direct - z : 1 0.9941437414044135
G4WT0 > Momentum - x (MeV/c): 02.741910542017016e-06
G4WT0 > Momentum - y (MeV/c): 0 0.2071499578167849
G4WT0 > Momentum - z (MeV/c): 0.03198433710427652 1.905661145601845
G4WT0 > Total Energy (MeV) : 0.51199891 1.983828468620394
G4WT0 > Kinetic Energy (MeV): 0.001 1.472829558620394
G4WT0 > Velocity (mm/ns) : 18.72789736601522 289.6763777177531
G4WT0 > Volume Name : World World
G4WT0 > Safety (mm) : 0 24.41171788958084
G4WT0 > Polarization - x : 0 0
G4WT0 > Polarization - y : 0 0
G4WT0 > Polarization - Z : 0 0
G4WT0 > Weight : 1 1
G4WT0 > Step Status : Undefined AlongStep Proc.
G4WT0 > Process defined Step: Undefined Transportation
G4WT0 > -----------------------------------------------------------------------
G4WT0 >
G4WT0 > ++List of secondaries generated (x,y,z,kE,t,PID): No. of secodaries = 0
G4WT0 > [Note]Secondaries from AlongStepDoIt included.
G4WT0 >
G4WT0 > ++G4Track Information
G4WT0 > -----------------------------------------------
G4WT0 > G4Track Information
G4WT0 > -----------------------------------------------
G4WT0 > Step number : 1
G4WT0 > Position - x (mm) : 0.000442
G4WT0 > Position - y (mm) : -40
G4WT0 > Position - z (mm) : -25
G4WT0 > Global Time (ns) : 1.87
G4WT0 > Local Time (ns) : 1.87
G4WT0 > Momentum Direct - x : 1.43e-06
G4WT0 > Momentum Direct - y : 0.108
G4WT0 > Momentum Direct - z : 0.994
G4WT0 > Kinetic Energy (MeV): 1.47
G4WT0 > Polarization - x : 0
G4WT0 > Polarization - y : 0
G4WT0 > Polarization - z : 0
G4WT0 > Track Length : 35.1
G4WT0 > Track ID # : 1
G4WT0 > Parent Track ID # : 0
G4WT0 > Next Volume : World
G4WT0 > Track Status : StopAndKill
G4WT0 > Vertex - x (mm) : 0
G4WT0 > Vertex - y (mm) : -40
G4WT0 > Vertex - z (mm) : -60
G4WT0 > Vertex - Px (MomDir): 0
G4WT0 > Vertex - Py (MomDir): 0
G4WT0 > Vertex - Pz (MomDir): 1
G4WT0 > Vertex - KineE (MeV): 0.001
G4WT0 > Creator Process : Event Generator
G4WT0 > -----------------------------------------------
G4WT0 >
G4WT0 > #Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
G4WT0 > 1 0.000442 -40 -25 1.47 7.35e-16 35.1 35.1 World Transportation


OutputTrackingUniformField_v1.txt (522.4 KB)
OutputTrackingDefinedField_v1.txt (55.2 KB)

Further to my previous post of more than 2 weeks ago, I decided to modify my code so that there was a weak electric field everywhere, so my code that returns the electric field looks like this:

void PurgMagTabulatedEField3D::GetFieldValue(const double point[4],
double *BEfield ) const
{
BEfield[3] = 0.0;
BEfield[4] = 0.0;
BEfield[5] = 1.0E-9;
return;

so the field is uniform everywhere with strength 1E-9 T in the z direction
I then run one electron and the output is given in OutputTrackingDefinedField_v1.txt. I then changed the field to be a uniform field (so it doesn’t need to call GetFieldValue) with an identical strength and direction and run with one electron. The output is given in file OutputTrackingUniformField_v1.txt. I find that there is a difference at line 485 where on the first run a step length of about 3 mm is chosen whereas for the second run, a step length of 54 mm is chosen. Shortly after, on line 532, run 1 has StopAndKill for the track status whereas for run 2 I still have Alive for the track status. Prior to this, I don’t see too much difference between the 2 runs (some small difference in x and y momenta), so I am struggling to understand why on the first run the electron is stopped and killed and on the second the electron carries on.
Does anyone have any advice on what I might try to determine the source of the problem ?

Thanks
Chris