Provide secondary vector in G4Step#488
Provide secondary vector in G4Step#488SeverinDiederichs wants to merge 4 commits intoapt-sim:masterfrom
Conversation
|
Can one of the admins verify this patch? |
6f1e0aa to
a3ba753
Compare
| std::abort(); | ||
| } | ||
|
|
||
| void AdePTGeant4Integration::ProcessGPUStep(GPUHit const *gpuStep, bool const callUserSteppingAction, |
There was a problem hiding this comment.
Why does gpuStep go from a reference to a raw pointer? If not strictly necessary we should keep the reference
There was a problem hiding this comment.
Because inside we are not processing just this step, but also the next numSecondary steps. So we later access them with const GPUHit *secHit = gpuStep + 1 + i;
But you are right, this is not optimal, instead, we should pass a span that includes all the hits that are processed here. Then the intend is much clearer and it is less error prone.
| G4ParticleDefinition *fPositronDef; | ||
| G4ParticleDefinition *fGammaDef; | ||
|
|
||
| std::aligned_storage<sizeof(G4DynamicParticle), alignof(G4DynamicParticle)>::type secDynStorage[kMaxTotalSecondaries]; |
There was a problem hiding this comment.
Probably should be moved after the declaration of dynParticleStorage[3];
| G4ParticleDefinition *fGammaDef; | ||
|
|
||
| std::aligned_storage<sizeof(G4DynamicParticle), alignof(G4DynamicParticle)>::type secDynStorage[kMaxTotalSecondaries]; | ||
| std::aligned_storage<sizeof(G4Track), alignof(G4Track)>::type secTrackStorage[kMaxTotalSecondaries]; |
| fElectronDef = particleTable->FindParticle("e-"); | ||
| fPositronDef = particleTable->FindParticle("e+"); | ||
| fGammaDef = particleTable->FindParticle("gamma"); |
There was a problem hiding this comment.
These are only used once during initialization, do we actually need to cache them?
| } | ||
|
|
||
| // call UserTrackingAction if required | ||
| if (gpuStep->fLastStepOfTrack && (callUserTrackingAction || callUserSteppingAction)) { |
There was a problem hiding this comment.
Should this be just gpuStep->fLastStepOfTrack && callUserTrackingAction ?
Note: this PR depends on #487 and is therefore based on it, as otherwise merge conflicts would arise. Only to be reviewed after rebase when #487 is merged!
This PR introduces a secondary vector in the G4Step. Thus, SD codes or UserActions that rely on the secondary vector will now not find only a secondary vector, but the correct secondaries produced in that step.
After the reordering #486, this PR changes the following:
For turning the userActions on, this PR slightly improves the run times over #487:
It was verified that this PR