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

ParticleHandler: account for modified stepping actions, where tracking… #1046

Merged
merged 4 commits into from
Jan 20, 2023

Conversation

andresailer
Copy link
Member

@andresailer andresailer commented Jan 18, 2023

… of a particle could be paused and later restarted.

Pick up the particle information that we have stored and go on from there

BEGINRELEASENOTES

  • ParticleHandler: account for modified stepping actions, where tracking of a particle could be paused and later restarted.

ENDRELEASENOTES

For #1036 I get this for 2 events now

root [2] EVENT->Scan("sqrt(MCParticles.psx^2 + MCParticles.psy^2 + MCParticles.psz^2 + MCParticles.mass^2):MCParticles.reason:MCParticles.pdgID:MCParticles.mask", "MCParticles.mask==1")
***********************************************************************
*    Row   * Instance * sqrt(MCPa * MCParticl * MCParticl * MCParticl *
***********************************************************************
*        0 *        0 *     10000 *       158 *        11 *         1 *
*        1 *        0 *     10000 *       158 *        11 *         1 *
***********************************************************************
==> 2 selected entries
(long long) 2

So the energy is the same as the initial one (10000) as opposed to some smaller number.

@andresailer
Copy link
Member Author

@MarkusFrankATcernch Does this look sensible to you?

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Jan 19, 2023

If the tracking action is the first call to the particle handler after the restacking, this should be correct.
However, I have the suspicion that all properties of the existing "currentTrack" may all somehow lost, because this
track and its properties is not yet saved away to the collection possibly be kept in the output record.

Hence the question is: Whan does the restacking happen? before or after a couple of steps were already processed?

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Jan 19, 2023

if before the restacking the member

void Geant4ParticleHandler::end(const G4Track* track)

is called this approach should be correct. Be aware that this track may be in both collections:

  • Geant4ParticleHandler::m_equivalentTracks and
  • Geant4ParticleHandler::m_particleMap

in Geant4ParticleHandler::endEvent(const G4Event* event) preference must be given to Geant4ParticleHandler::m_particleMap when rebasing the tracks.

@andresailer andresailer force-pushed the restartTracking branch 2 times, most recently from d8950e4 to 2fbf233 Compare January 19, 2023 15:41
@andresailer
Copy link
Member Author

I implemented the treatment also for particles that might not be in the particleMap before they are suspended. It looks fine to me, but that code is never actually run so far.

@andresailer
Copy link
Member Author

I am adding a test

@andresailer andresailer changed the title ParticleHandler: account for modified stacking actions, were tracking… ParticleHandler: account for modified stepping actions, were tracking… Jan 19, 2023
@andresailer
Copy link
Member Author

Added a test that exercises the suspendedPM related code

… of a particle could be paused and later restarted.

Pick up the particle information that we have stored and go on from there
…re suspended

This logic only incurs a runtime overhead of two if checks if no particles are ever suspended.
Store non-primary particles that are suspended in a different map to pick their initial information up later again.
If we do not already store particles that become important'ish later we get a fatal error because the equilavent finding might not be able to find this particle
@andresailer andresailer enabled auto-merge (rebase) January 20, 2023 09:17
@andresailer andresailer changed the title ParticleHandler: account for modified stepping actions, were tracking… ParticleHandler: account for modified stepping actions, where tracking… Jan 20, 2023
@andresailer andresailer merged commit 76e43b6 into AIDASoft:master Jan 20, 2023
@andresailer andresailer deleted the restartTracking branch July 13, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with MCParticles folder produced in the root output of ddsim?
2 participants