Possible bug in EmLivermore and optical photon generation

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11.2.2
_Operating System:_macOS Sonoma 14.6
_Compiler/Version:_gcc 15.0.0
_CMake Version:_3.29.4


Dear experts,

I have been conducting some simulations of 1MeV electrons in a liquid scintillator (LAB) using Geant4 v11.2.2 and found some discrepancies when adding or not the optical processes while using the EmLivermore physics list.

I am only using the EmLivermore physics list to generate the electromagnetic processes as well as G4OpticalPhysics to generate the optical processes (Scintillation and Cerenkov). However, during the energy loss steps, the processes seems to change drastically when one add or not the optical processes.

Here is a few distributions that highlight the issue I am facing (10 000 electrons of 1 MeV).

I also noticed that most eIoni processes disappeared from the list of processes when the optics is added.
Most processes are now msc when we used to have only 1 msc without the optics.
I observed this feature using LIV, and EMZ (option 4) EM physics lists but default (option 0) and EMY (option 3) EM physics lists do not have this type of issues.

I was wondering if there were some potential conflict between, msc models and optical photon generation

You can see below an output of Geant4 for one event

No optics:


  • G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0

Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 0 0.612 0 0 0 pTarget initStep
1 0.000149 -0.000252 -0.000725 0.612 7.87e-05 0.000782 0.000782 pTarget msc
2 0.119 -0.206 -0.586 0.499 0.113 0.701 0.701 pTarget eIoni
3 0.199 -0.426 -1.03 0.369 0.129 0.563 1.26 pTarget eIoni
4 0.117 -0.343 -1.37 0.27 0.099 0.415 1.68 pTarget eIoni
5 0.32 -0.434 -1.51 0.206 0.0643 0.312 1.99 pTarget eIoni
6 0.508 -0.467 -1.45 0.153 0.0534 0.25 2.24 pTarget eIoni
7 0.519 -0.343 -1.37 0.0968 0.0557 0.199 2.44 pTarget eIoni
8 0.539 -0.31 -1.3 0.0158 0.081 0.137 2.58 pTarget eIoni
9 0.54 -0.311 -1.3 0 0.0158 0.00604 2.58 pTarget eIoni

With optics:


  • G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0

Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 0 0.612 0 0 0 pTarget initStep
1 0.000305 -0.000514 -0.00148 0.612 0.00017 0.0016 0.0016 pTarget msc
:----- List of 2ndaries - #SpawnInStep= 1(Rest= 0,Along= 0,Post= 1), #SpawnTotal= 1 ---------------
: 0.000116 -0.000196 -0.000564 2.78e-06 opticalphoton


  • G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0

Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
1 0.000305 -0.000514 -0.00148 0.612 0 0 0.0016 pTarget initStep
2 0.0413 -0.0857 -0.197 0.554 0.0575 0.217 0.219 pTarget msc
:----- List of 2ndaries - #SpawnInStep=566(Rest= 0,Along= 0,Post=566), #SpawnTotal=566 ———————


  • G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0

Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
2 0.0413 -0.0857 -0.197 0.554 0 0 0.219 pTarget initStep
3 0.0753 -0.168 -0.364 0.526 0.0287 0.189 0.408 pTarget msc
:----- List of 2ndaries - #SpawnInStep=271(Rest= 0,Along= 0,Post=271), #SpawnTotal=271 ———————

About 90 steps are similar to these ones (only msc processes).

Thank you in advance !

Here is the dE distribution

Dear @Matthieu_Lecocq

Welcome to Geant4 forum.

I guess that Optical processes may limit the step length, leading to more steps (first plot), and therefore smaller energy deposits (second plot). In case of Cherenkov effect, there is a parameter called setMaxBetaChange that limit the step explicitly. See documentation here.

Regarding the frequency of MSC, I am not sure if it derives from the step limit caused by the optical processes. @civanch @dsawkey can you confirm that MSC is not affected by optical physics?

Thank you for your time.

Best,
Alvaro

Dear All,

I have investigated this issue and I would like to add some information:

I found out that this behavior is due to the different msc model used in the Livermore and option4 physics lists: G4GoudsmitSaundersonMscModel vs G4UrbanMscModel

This is extracted from the source code of the model (lines 513 +):

 // Possible optimization : if the distance is samller than the safety -> the
 // particle will never leave this volume -> dispalcement
 // as the effect of multiple elastic scattering can be skipped
 // Important : this optimization can cause problems if one does scoring
 // in a bigger volume since MSC won't be done deep inside the volume when
 // distance < safety so don't use optimized-mode in such case.
if (gIsOptimizationOn && (distance<presafety)) {
     // Indicate that we need to do MSC after transportation and no dispalcement.
     fIsMultipleSacettring = true;
     fIsNoDisplace = true;
  } else if (steppingAlgorithm==fUseDistanceToBoundary) {
   ...
  } else if (steppingAlgorithm==fUseSafetyPlus) { // THE ERROR_FREE stepping alg.
   ...
  } else {
    // This is the default stepping algorithm: the fastest but the least
    // accurate that corresponds to fUseSafety in Urban model. Note, that GS
    // model can handle any short steps so we do not need the minimum limits
   ...
  }

I found out that:

  • When the optical physics is not registered (or the particle is tracked inside a volume with no optical properties) the “presafety” variable is equal to the distance of the particle from the boundary of the volume so, in the posted example, the condition is True and the first block of the IF is executed.
    In this case, msc does not limit the steps and the total number of steps is small.
  • When the optical physics is registered, the “presafety” variable is always 0 so, in the posted example, the condition is False and the “fUseSafetyPlus” code is executed, according to the default value of the steppingAlgorithm. In this case, msc limits the steps and the total number of steps is high.
  • If the optical physics is registered and the steppingAlgorithm is set to “fUseSafety” the last code of the if-else block is executed with the Urban-like model and again the msc does not limit the steps (like in the option 0 Em PL)

In conclusion, it seems that the activation of the optical physics modifies the computation of the presafety parameters.

Now, my question is: Why and how is this value affected by the activation of optical physics? Is that right?

I hope this can help find a motivation or solution to this behavior.

Best,
Andrea

Dear @atolosad

Thank you for your answer. Sorry for the delay, I was trying various things to understand this behaviour.
I tired playing with the parameter you mentioned (setMaxBetaChange) by setting different values (0%, 10%, 50%, 100%) but I see no changements on my distributions.
I also tried turning off the Cerenkov processes and leaving only Scintillation but it doesn’t have a big impact on my number of step. I only noticed a decrease of 0.5% in my step number when removing Cerenkov processes.

On average, the ratio of steps produced by msc (msc/tot_processes) is around 92% when the optical processes are activated and only 9% when there is no optics. The Cerenkov processes amount to around 3% when optics is enabled.

I don’t understand this sudden increase in step number and why the msc process is dominating when the optical processes are activated.

If you have any hints or other suggestions I’ll be happy to test them.

Thank you in advance !

Best,
Matthieu

Hi,

First note that neither step size, nor the process that limits the step, are physically meaningful. They are artifacts of the way the simulation works. If these change, but the physics result don’t, there may not be a problem.

Also note that msc and eIoni will be active every step. The process reported by /tracking/verbose is only the process that limits the step size. Every process that should be active, is active.

It is still a valid question to ask what is changing the step size or limiting process. If you run a few particles with /tracking/verbose 3 [I think; try different values] for each step, all the active processes, and the proposed step limit for each, will be printed out. This might give us a clue to what is going on.

Aside from step size, I don’t any mechanism for which enabling optical processes would affect msc.

Another question, do you observe the same behaviour with the example extended/optical/OpNovice2?

Dear @dsawkey,

Thank you for your comment !
I followed your suggestion and tried with extended/optical/OpNovice2 and I have something very different from my simulation. I find no differences with and without the optical processes enabled.

However I tried extend/optical/LXe, since it’s similar to my simulation of a scintillator, and I observed something similar when I simulate a 1MeV electron at the center:

  • Without optics on there is 1 msc process followed by 15 eIoni processes.
  • If I enable optics, I go from 16 steps to 24 steps and all step-limiting process become msc

I don’t understand how the number of steps changes and why the eIoni process doesn’t limit the step anymore but it’s now done by msc.

I think @Andrea made an interesting comment on how the msc parameters are handled in the different models, is there something to understand from this?

Best,
Matthieu

Interesting. OpNovice2 has scintillation as well (try macro electron.mac).

Could you please try

/tracking/verbose 3

which will give a list of all active processes, and each proposed step limit, for each step. Knowledge of the process that limits the step is only a partial picture.

I don’t know how or what could be affecting msc. Optics doesn’t explicitly modify the safety.

My previous test was using electron.mac.
With our without the optical process enabled the step is limited by msc. In the list of all active process I can see either msc, eIoni or eBrem but most of the steps are limited by msc.

I looked a bit in the source code and changed msc1 definition from G4GoudsmithSaundersonMscModel to G4UrbanMscModel in G4EmLivermorePhysics and I have now dE distributions that matches well

The list of process doesn’t change anymore when I enable the optical processes.

Is there something interfering with the process list in G4GoudsmithSaundersonMscModel and thus increasing the step when optical processes are enabled?