From 66a46a7cf5e3e0b2326a9cf4984af0fed00e39fa Mon Sep 17 00:00:00 2001 From: majacquet Date: Fri, 19 Apr 2024 15:22:43 +0200 Subject: [PATCH] Bug correction --- .../GateKillNonInteractingParticleActor.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/opengate_core/opengate_lib/GateKillNonInteractingParticleActor.cpp b/core/opengate_core/opengate_lib/GateKillNonInteractingParticleActor.cpp index b71198e0e..bd264d37b 100644 --- a/core/opengate_core/opengate_lib/GateKillNonInteractingParticleActor.cpp +++ b/core/opengate_core/opengate_lib/GateKillNonInteractingParticleActor.cpp @@ -40,6 +40,16 @@ void GateKillNonInteractingParticleActor::PreUserTrackingAction(const G4Track* t void GateKillNonInteractingParticleActor::SteppingAction(G4Step *step) { + G4String logNameMotherVolume = G4LogicalVolumeStore::GetInstance()->GetVolume(fMotherVolumeName)->GetName(); + G4String physicalVolumeNamePreStep = step->GetPreStepPoint()->GetPhysicalVolume()->GetName(); + if ((step->GetTrack()->GetLogicalVolumeAtVertex()->GetName() != logNameMotherVolume) && (fIsFirstStep)){ + if ((fPassedByTheMotherVolume == false) && (physicalVolumeNamePreStep == fMotherVolumeName) && (step->GetPreStepPoint()->GetStepStatus() == 1)){ + fPassedByTheMotherVolume =true; + fKineticEnergyAtTheEntrance = step->GetPreStepPoint()->GetKineticEnergy(); + ftrackIDAtTheEntrance = step->GetTrack()->GetTrackID(); + } + } + G4String logicalVolumeNamePostStep = step->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName(); if ((fPassedByTheMotherVolume) && (step->GetPostStepPoint()->GetStepStatus() == 1)){ if (std::find(fListOfVolumeAncestor.begin(), fListOfVolumeAncestor.end(),logicalVolumeNamePostStep ) !=fListOfVolumeAncestor.end()){ @@ -50,16 +60,6 @@ void GateKillNonInteractingParticleActor::SteppingAction(G4Step *step) { } } } - - G4String logNameMotherVolume = G4LogicalVolumeStore::GetInstance()->GetVolume(fMotherVolumeName)->GetName(); - G4String physicalVolumeNamePreStep = step->GetPreStepPoint()->GetPhysicalVolume()->GetName(); - if ((step->GetTrack()->GetLogicalVolumeAtVertex()->GetName() != logNameMotherVolume) && (fIsFirstStep)){ - if ((fPassedByTheMotherVolume == false) && (physicalVolumeNamePreStep == fMotherVolumeName) && (step->GetPreStepPoint()->GetStepStatus() == 1)){ - fPassedByTheMotherVolume =true; - fKineticEnergyAtTheEntrance = step->GetPreStepPoint()->GetKineticEnergy(); - ftrackIDAtTheEntrance = step->GetTrack()->GetTrackID(); - } - } fIsFirstStep = false; }