Partially turning off a process

Hello I’m running Geant4.10.2 and I have a question regarding turning off the Ionization process of protons with galactic material

I have the physics volume constructed by some real materials, and Galactic as vacuum. In my simulation I have the following in physics list:

G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.1, 20*um);
ph->RegisterProcess(hIoni, particle);

Which turns on the ionization process of proton with all types of material. Is there a way to only turn the ionization process between proton and Galactic material off but leave the ionization with other materials on?

Could you show a case (with tracking/verbose) where ionization process is triggered in Galactic ?

Here is the last step of tracking:

#Step# X Y Z time KineE dEStep StepLeng TrakLeng Volume Process
136 8.703672821 mm -9.071861838 mm -3.259660783 cm 568.6426522 ns 20.86660391 eV 1.504909866e-18 eV 1 mm 13.6 cm World Transportation

AlongStepDoIt (after all invocations):
++List of invoked processes

  1) Transportation
  2) msc
  3) hIoni

++G4Step Information
  Address of G4Track    : 0x363c1b0
  Step Length (mm)      : 1
  Energy Deposit (MeV)  : 8.131399874110373e-07
  -----------------------------------------------------------------------
    StepPoint Information               PreStep            PostStep
  -----------------------------------------------------------------------
     Position - x (mm)   :    8.703672820864366   8.647490655945786
     Position - y (mm)   :   -9.071861838462349  -8.975887953742012
     Position - z (mm)   :   -32.59660783136188   -31.6431096651177
     Global Time (ns)    :    568.6426521861978   595.5453548752172
     Local Time (ns)     :    568.6426521861978   595.5453548752172
     Proper Time (ns)    :    568.6424629359808   595.5451650267004
     Momentum Direct - x :  -0.1838719048261112  0.6183049424532435
     Momentum Direct - y :   0.1271131262361636   0.361131955295985
     Momentum Direct - z :    0.974696555731109  0.6980563795296121
     Momentum - x (MeV/c):  -0.0363848545113194                   0
     Momentum - y (MeV/c):  0.02515334035917926                   0
     Momentum - z (MeV/c):   0.1928744492340971                   0
     Total Energy (MeV)  :    938.2720338666039          938.272013
     Kinetic Energy (MeV): 2.086660390507446e-05                   0
     Velocity (mm/ns)    :  0.06322621713836427                   0
     Volume Name         :                World               World
     Safety (mm)         :   0.5946075585454702   7.555655543128523
     Polarization - x    :                    0                   0
     Polarization - y    :                    0                   0
     Polarization - Z    :                    0                   0
     Weight              :                    1                   1
     Step Status         :           Geom Limit          Geom Limit
     Process defined Step:       Transportation      Transportation
  -----------------------------------------------------------------------

++List of secondaries generated (x,y,z,kE,t,PID):  No. of secodaries = 0

**PostStepDoIt (after all invocations):
++List of invoked processes
1) Transportation
2) msc
3) SEE

++G4Step Information
  Address of G4Track    : 0x363c1b0
  Step Length (mm)      : 1
  Energy Deposit (MeV)  : 8.131399874110373e-07
  -----------------------------------------------------------------------
    StepPoint Information               PreStep            PostStep
  -----------------------------------------------------------------------
     Position - x (mm)   :    8.703672820864366   8.647490655945786
     Position - y (mm)   :   -9.071861838462349  -8.975887953742012
     Position - z (mm)   :   -32.59660783136188   -31.6431096651177
     Global Time (ns)    :    568.6426521861978   595.5453548752172
     Local Time (ns)     :    568.6426521861978   595.5453548752172
     Proper Time (ns)    :    568.6424629359808   595.5451650267004
     Momentum Direct - x :  -0.1838719048261112  0.6183049424532435
     Momentum Direct - y :   0.1271131262361636   0.361131955295985
     Momentum Direct - z :    0.974696555731109  0.6980563795296121
     Momentum - x (MeV/c):  -0.0363848545113194                   0
     Momentum - y (MeV/c):  0.02515334035917926                   0
     Momentum - z (MeV/c):   0.1928744492340971                   0
     Total Energy (MeV)  :    938.2720338666039          938.272013
     Kinetic Energy (MeV): 2.086660390507446e-05                   0
     Velocity (mm/ns)    :  0.06322621713836427                   0
     Volume Name         :                World               World
     Safety (mm)         :   0.5946075585454702   7.555655543128523
     Polarization - x    :                    0                   0
     Polarization - y    :                    0                   0
     Polarization - Z    :                    0                   0
     Weight              :                    1                   1
     Step Status         :           Geom Limit          Geom Limit
     Process defined Step:       Transportation      Transportation
  -----------------------------------------------------------------------

++List of secondaries generated (x,y,z,kE,t,PID):  No. of secodaries = 0
  [Note]Secondaries from AlongStepDoIt included.

#Step# X Y Z time KineE dEStep StepLeng TrakLeng Volume Process
137 8.647490656 mm -8.975887954 mm -3.164310967 cm 595.5453549 ns 0 eV 0.8131399874 eV 1 mm 13.7 cm World Transportation

======================== run summary ======================

The particle is in the mateiral of Galactic, defined this way:

density = universe_mean_density;
pressure = 3.e-19pascal;
temperature = 2.73
kelvin;
new G4Material(“Galactic”, z=1, a=1.01*g/mole,density,
kStateGas,temperature,pressure);

The AlongStepDoIt hIoni was triggered and the simulation was stopped.
This proton was moving in a E field against its momentum direction, which caused a decrease in its kinetic energy. We want to see it to be reflected by the E field, but when it’s KE get’s low, the ionization process just killed it.

Those two actions are not connected. Ionisation, as a G4VContinuousProcess, is always invoked to compute the energy loss along the step. It doesn’t stop the track. The “Process defined Step:” entry for the Post-step Point tells you which process stopped the track. In your case, that was Transportation. Why is explained below.

Geant4 doesn’t currently support electric field reflection, nor does it support an E-field accelerating a new particle from rest.

When a track gets to zero energy, it is killed by Transportation, by setting the fStopAndKill track status. For the case of tracks which can decay (radioisotopes, for instance), the fStopButAlive state is set, and only AtRest processes are invoked to handle the decay.

1 Like

Thank you so much!
I finally solved the problem by reverting the protons at the stopping place manually, and it actually worked pretty well!

Nice! I wonder if a more general option, an “At Rest” process (G4VRestProcess) could do this by looking for fStopButAlive charged tracks, and if the current vacuum volume has an E-field, set the track to have a small momentum (like a microeV or something) along the field direction, and reset its status back to fAlive.

This isn’t something you could do in complete generality, I don’t think, since for a track stopping in a dense material, it wouldn’t and shouldn’t get re-accelerated.

Yes! I also thought about this (without knowing the existence of “At Rest” process though), but I really would like to preserve the energy and some other quantities of the particle so I tried the manually revert method first since I have a good control of all the quantities for the particle. And luckily it worked well!

Thank you so much for your help, it actually helped me a lot in understanding what’s actually happening so that I found a way to solve it!!

Hi Mike,

if you do not want many steps of particles which leave your setup and waste time for stepping in vacuum - it is one story. In that case, the most effective solution - implement your own killer of unwanted particles.

If the situation is more complicate - you cannot kill, then you need somehow consistently suppress step limitation from both ionization and multiple scattering. As a minimum, you need to define “Simple” step limitation inside G4Region of vacuum.

VI