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

[12.6.X] re-initialize geometry in g4e propagator as required at beginning of propagation and for each step #40593

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions TrackPropagation/Geant4e/src/Geant4ePropagator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "G4TransportationManager.hh"
#include "G4Tubs.hh"
#include "G4UImanager.hh"
#include "G4ErrorPropagationNavigator.hh"

// CLHEP
#include "CLHEP/Units/GlobalSystemOfUnits.h"
Expand Down Expand Up @@ -311,11 +312,18 @@ std::pair<TrajectoryStateOnSurface, double> Geant4ePropagator::propagateGeneric(

theG4eManager->InitTrackPropagation();

// re-initialize navigator to avoid mismatches and/or segfaults
theG4eManager->GetErrorPropagationNavigator()->LocateGlobalPointAndSetup(
g4InitPos, &g4InitMom, /*pRelativeSearch = */ false, /*ignoreDirection = */ false);

bool continuePropagation = true;
while (continuePropagation) {
iterations++;
LogDebug("Geant4e") << std::endl << "step count " << iterations << " step length " << finalPathLength;

// re-initialize navigator to avoid mismatches and/or segfaults
theG4eManager->GetErrorPropagationNavigator()->LocateGlobalPointWithinVolume(g4eTrajState.GetPosition());

const int ierr = theG4eManager->PropagateOneStep(&g4eTrajState, mode);

if (ierr != 0) {
Expand Down