Skip to content

Commit

Permalink
Merge pull request #40593 from mmusich/g4e_geominit_12_6
Browse files Browse the repository at this point in the history
[12.6.X] re-initialize geometry in g4e propagator as required at beginning of propagation and for each step
  • Loading branch information
cmsbuild authored Jan 24, 2023
2 parents 898cd23 + 31d2c4a commit 5616e07
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 5616e07

Please sign in to comment.