Skip to content

Clean AdePTPhysics definition#497

Merged
SeverinDiederichs merged 6 commits intoapt-sim:masterfrom
SeverinDiederichs:clean_AdePT_physics_rebase
Mar 3, 2026
Merged

Clean AdePTPhysics definition#497
SeverinDiederichs merged 6 commits intoapt-sim:masterfrom
SeverinDiederichs:clean_AdePT_physics_rebase

Conversation

@SeverinDiederichs
Copy link
Collaborator

@SeverinDiederichs SeverinDiederichs commented Mar 2, 2026

This improves and clarifies the AdePTPhysics:

Previously, the AdePTPhysics were added as an additional physics constructor to the PhysicsList, right after the G4EmStandard physics. However, this gave the impression that one could add them similarly to other G4Em physics lists, but that is not the case, as the AdePTPhysics constructor was calling this:

  G4EmParameters *param = G4EmParameters::Instance();
  param->SetDefaults();
  param->SetVerbose(1);

resetting all parameters that other options might have set.

Thus, the clean way is to add the AdePTTrackingManager directly inside an G4EmStandardPhysics_AdePT and _HepEm. This can be done in a relatively clean way by deriving directly from the G4EmStandardPhysics.

Now, it is clear that the AdePTPhysics list only replaces the G4EmStandardPhysics and is not equivalent with any other physics constructors.
This could be extended to other physics constructors as well.

NOTE: This PR does change the physics output and therefore is marked as unstable in the drift test.
In fact, the new implementation uncovers the issues of the original approach:

In G4EmStandardPhysics the following flags are set:

UseGeneralProcess = true
FluctuationType = Urban

however, the param->SetDefaults(); from the previous AdePTPhysics sets it to

UseGeneralProcess = false
FluctuationType = Universal

The drift test passes again if those flags are enforced as a regression via:

/process/em/UseGeneralProcess false
/process/eLoss/setFluctModel Universal

in the macro.

It was verified that this PR

  • Changes physics results
  • Does not change physics results

@SeverinDiederichs SeverinDiederichs added the cleaning improves code clarity, readability or other label Mar 2, 2026
@phsft-bot
Copy link

Can one of the admins verify this patch?

Copy link
Collaborator Author

@SeverinDiederichs SeverinDiederichs left a comment

Choose a reason for hiding this comment

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

Improve comments

Copy link
Contributor

@JuanGonzalezCaminero JuanGonzalezCaminero left a comment

Choose a reason for hiding this comment

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

Thank you for the changes!

@SeverinDiederichs SeverinDiederichs merged commit 0ce0713 into apt-sim:master Mar 3, 2026
2 of 3 checks passed
@SeverinDiederichs SeverinDiederichs deleted the clean_AdePT_physics_rebase branch March 3, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleaning improves code clarity, readability or other

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants