Skip to content

Refactor AdePT into 2 libraries 1: remove AdePTG4Integration from AdePTTransport#517

Merged
SeverinDiederichs merged 1 commit intoapt-sim:masterfrom
SeverinDiederichs:remove_AdePTG4Integration_from_AdePTTransport
Mar 18, 2026
Merged

Refactor AdePT into 2 libraries 1: remove AdePTG4Integration from AdePTTransport#517
SeverinDiederichs merged 1 commit intoapt-sim:masterfrom
SeverinDiederichs:remove_AdePTG4Integration_from_AdePTTransport

Conversation

@SeverinDiederichs
Copy link
Collaborator

@SeverinDiederichs SeverinDiederichs commented Mar 18, 2026

This PR belongs the the refactor of AdePT described in #516.

Currently, there is one AdePTTrackingManager per G4Worker. Each AdePTTrackingManager points to the global instance of the AdePTTransport. The AdePTTransport owns an array over the G4Worker number of the AdePTGeant4Integration. Then, when the AdePTTrackingManager needs to access the AdePTGeant4Integration, it has to pass the correct threadId to the AdePTTransport to receive its corresponding AdePTGeant4Integration object.

This diagram illustrates the previous ownership and access pattern (blue resides in the AdePT g4integration library, orange in the AdePT core library):
Screenshot 2026-03-18 at 13 21 41

This PR cleans this to (blue resides in the AdePT g4integration library, orange in the AdePT core library):
Each AdePTTrackingManager owns a pointer to the global AdePTTransport and the its own AdePTGeant4Integration directly. For calls inside the AdePTTransport that currently still rely on the AdePTG4Integration (which in the future, it shouldn't anymore), the integration object is passed to the transport.

So the new ownership / access pattern looks like this:
Screenshot 2026-03-18 at 13 22 05

This change is important to separate the AdePTTransport (which will reside in the AdePT core library) from the AdePTGeant4Integration (which will reside in the AdePT g4integration library).

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 18, 2026
@phsft-bot
Copy link

Can one of the admins verify this patch?

Copy link
Contributor

@agheata agheata left a comment

Choose a reason for hiding this comment

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

Thanks for the design cleanup!

@SeverinDiederichs SeverinDiederichs merged commit be4384b into apt-sim:master Mar 18, 2026
4 checks passed
@SeverinDiederichs SeverinDiederichs deleted the remove_AdePTG4Integration_from_AdePTTransport branch March 18, 2026 12:40
SeverinDiederichs added a commit that referenced this pull request Mar 18, 2026
…sport (#518)

This PR belongs the the refactor of AdePT described in #516.
It is based on #517 and should not be reviewed before that one is
merged.

In this PR, the B field is passed directly to the AdePTTransport, such
that it does not rely on the AdePTGeant4Integration to get the B field
value. In the end, the goal is to not pass the AdePTGeant4Integration to
AdePTTransport, to be able to separate the libraries.

It was verified that this PR
- [ ] Changes physics results
- [x] Does not change physics results
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