Interaction in the target

Hello, I should get the beam interaction in the target, then following this post Getting coordinates for first interaction

I defined in the DetectorConstruction

fScoringVolume = AChamber20nepLog;

and in the SteppingAction

  if (!fScoringVolume) { 
    const DetectorConstruction* detectorConstruction = static_cast<const DetectorConstruction*> (G4RunManager::GetRunManager()->GetUserDetectorConstruction());
    fScoringVolume = detectorConstruction->GetScoringVolume();  
  }
// get the status of the pre step point
   G4StepStatus PreStepStatus = aStep->GetPreStepPoint()->GetStepStatus();
// get the volume of the post step point
  G4LogicalVolume* PostStepPoint = aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume();
// Check if
  if ((PreStepStatus == fGeomBoundary) && (PostStepPoint == fScoringVolume)){
    G4cout<< " Position z" << aStep->GetPostStepPoint()->GetPosition().z() << G4endl;
   }

I don’t have errors during the compiling, but it crashes when I run it

This is the error


### CAUGHT SIGNAL: 11 ### address: 0x10,  signal =  SIGSEGV, value =   11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=6465, TID=-1][ 0/18]> /nfs/luna02/xxxxxx/Simulazioni_fatte/Prova/SimLuna() [0x45e6a8]
[PID=6465, TID=-1][ 1/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4tracking.so(_ZN17G4SteppingManager8SteppingEv+0x56e) [0x7f7b6a3e562e]
[PID=6465, TID=-1][ 2/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4tracking.so(_ZN17G4TrackingManager15ProcessOneTrackEP7G4Track+0x118) [0x7f7b6a3fae58]
[PID=6465, TID=-1][ 3/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4event.so(_ZN14G4EventManager12DoProcessingEP7G4Event+0x893) [0x7f7b6a63cd23]
[PID=6465, TID=-1][ 4/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4run.so(_ZN12G4RunManager11DoEventLoopEiPKci+0xaf) [0x7f7b6a8f9c6f]
[PID=6465, TID=-1][ 5/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4run.so(_ZN12G4RunManager6BeamOnEiPKci+0x5e) [0x7f7b6a8f78ae]
[PID=6465, TID=-1][ 6/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4run.so(_ZN14G4RunMessenger11SetNewValueEP11G4UIcommand8G4String+0x5a2) [0x7f7b6a92e0c2]
[PID=6465, TID=-1][ 7/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x780) [0x7f7b663f8f20]
[PID=6465, TID=-1][ 8/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0xdb1) [0x7f7b664179d1]
[PID=6465, TID=-1][ 9/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN9G4UIbatch11ExecCommandERK8G4String+0x1d) [0x7f7b663e8c4d]
[PID=6465, TID=-1][10/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN9G4UIbatch12SessionStartEv+0x66) [0x7f7b663e9d46]
[PID=6465, TID=-1][11/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN11G4UImanager16ExecuteMacroFileEPKc+0x3c) [0x7f7b664194bc]
[PID=6465, TID=-1][12/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN20G4UIcontrolMessenger11SetNewValueEP11G4UIcommand8G4String+0x23a) [0x7f7b6640628a]
[PID=6465, TID=-1][13/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x780) [0x7f7b663f8f20]
[PID=6465, TID=-1][14/18]> /nfs/luna02/GEANT4/geant4-v11.0.0-install/lib64/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0xdb1) [0x7f7b664179d1]
[PID=6465, TID=-1][15/18]> /nfs/luna02/xxxxxx/Simulazioni_fatte/Prova/SimLuna() [0x419a19]
[PID=6465, TID=-1][16/18]> /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f7b64db5c05]
[PID=6465, TID=-1][17/18]> /nfs/luna02/xxxxxx/Simulazioni_fatte/Prova/SimLuna() [0x41d82f]

: Segmentation fault (Address not mapped to object [0x10])
/var/lib/torque/mom_priv/jobs/5299784.xmaster.lngs.infn.it.SC: line 12:  6465 Aborted                 (core dumped) /nfs/luna02/xxxxxx/Simulazioni_fatte/Prova/SimLuna /nfs/luna02/xxxxxx/Simulazioni_fatte/Prova/run.mac seed=$SEED

DetectorConstruction.cc (8.5 KB)
DetectorConstruction.hh (1.6 KB)
SteppingAction.cc (4.1 KB)
SteppingAction.hh (408 Bytes)

1 Like