Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Geant4 step limiter when ionization is disabled #920

Merged
merged 3 commits into from
Sep 5, 2023

Conversation

amandalund
Copy link
Contributor

@amandalund amandalund commented Sep 2, 2023

I believe the difference @mrguilima is seeing between Geant4 and Celeritas in the bremsstrahlung step length is because the step is only being limited by the distance to interaction (and not the range) in our Geant4 apps. When a process is registered to the physics list, the default process ordering is used (this specifies in what order the processes' at rest, along-step, and post-step GPIL/DoIt methods are called by the stepping manager, and whether any of them are inactive). The along-step methods for ionization are active and for bremsstrahlung are inactive by default, since the ionization dE/dx and range tables will contain the contributions from all energy loss processes. When ionization is missing, we need to activate the along-step for brems—that is done here in our GeantPhysicsList. I also added an option to set the default cutoff value (mainly for debugging).

@mrguilima could you update the geant validation app with this change and see if the brems results improve?

@amandalund amandalund added the external Dependencies and framework-oriented features label Sep 2, 2023
Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch @amandalund ! I will wait on @mrguilima or @stognini to compare the results before merging.

@@ -85,6 +86,7 @@ GeantPhysicsList::GeantPhysicsList(Options const& options) : options_(options)
em_parameters.SetMscEnergyLimit(100 * CLHEP::TeV);
}
em_parameters.SetApplyCuts(options.apply_cuts);
this->SetDefaultCutValue(options.default_cutoff * CLHEP::cm);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this forcefully override any cutoff value defined originally by the gdml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not positive about that... but at least I don't think it will change the current behavior: G4RunManagerKernel::InitializePhysics() calls physicsList->SetCuts(). The default SetCuts() method in G4VUserPhysicsList calls SetDefaultCutValue(), so since we don't have our own SetCuts() method it will be called either way. So all this should do is possibly change the default from 1 mm to something else.

Copy link
Member

@stognini stognini Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that means that we have to add the SetCuts() function in the near future, when we actually start using the secondary production thresholds correctly.

@sethrj
Copy link
Member

sethrj commented Sep 5, 2023

@stognini would this change have to be adapted to the separate validation code?

@stognini
Copy link
Member

stognini commented Sep 5, 2023

Here is the summary after some testings today and discussing the results with @amandalund:

  • Geant4 has a final step that streams the particle to the geometry boundary when it is below the interaction threshold. That led to results between G4 and Celeritas being in agreement for small steps, but with a discrepancy caused by the aforementioned final steps streaming out of the geometry.
  • After updating the processing order in the PhysicsList of the geant4-validation-app to be identical to the Celeritas' GeantPhysicsList, the along-step makes the electrons lose energy until they reach E = 0 and, thus, Celeritas and Geant4 results agree:

brems-g4-cel

@stognini
Copy link
Member

stognini commented Sep 5, 2023

@stognini would this change have to be adapted to the separate validation code?

Yes. I am pushing that update to the benchmarks repo in a bit.

@sethrj sethrj merged commit 53d983b into celeritas-project:develop Sep 5, 2023
@amandalund amandalund deleted the g4-brems-order branch September 5, 2023 19:42
@sethrj sethrj added the bug Something isn't working label Sep 6, 2023
@sethrj sethrj changed the title Activate brems along-step GPIL/DoIt in Geant4 when ionization is missing Fix Geant4 step limiter when ionization is disabled Sep 6, 2023
@sethrj sethrj added the backport Pull request duplicated across version branches label Sep 14, 2023
@sethrj sethrj added performance Changes for performance optimization and removed performance Changes for performance optimization labels Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Pull request duplicated across version branches bug Something isn't working external Dependencies and framework-oriented features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants