Hi! Segmentation fault happened when I tried to get the translation of the PhysicsVolume where the thePostPoint() of a step pointed to in the UserSteppingAction. Like:
G4StepPoint* thePrePoint = step->GetPreStepPoint();
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
G4StepPoint* thePostPoint = step->GetPostStepPoint();
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
G4ThreeVector depos = thePrePV->GetTranslation();
This simulation wanted to track the energy deposition of a 511 keV gamma. I tried to output something like ProcessName, only “compt” was output for the first several events, but no “phot” was output before the segmentation fault happened. I added a line of code and then the error disappeared:
if(! thePrePV || ! thePostPV) return;
It seems that the postpoint of the final step (maybe phot is the final process) is not in any PV.
The Physicslist I used is G4EmStandardPhysics.
Thanks for your reply!
_Geant4 Version:_geant4-11-02
_Operating System:_Ubuntu 5.4.0-6ubuntu1~16.04.10
_Compiler/Version:_gcc 5.4.0
_CMake Version:_3.16.3