I have been following the Geant4 tutorials by Mustafa Schmidt but after implementing a sensitive detector (tutorial 7) I keep receiving the segmentation fault shown below:
Checking overlaps for volume physTarg:0 (G4Tubs) ... OK!
Checking overlaps for volume physScint:0 (G4Box) ... OK!
Checking overlaps for volume physDet:0 (G4Box) ... OK!
[1] 57973 segmentation fault ./scat
I have managed to identify the source of this issue to be the line in construction.cc where I set the detector logical volume to a sensitive detector:
logicDet->SetSensitiveDetector(sensDet);
Im attaching the construction source and header files (as a new member I can only attach 2 links): construction.cc (3.0 KB) construction.hh (852 Bytes)
Okay, so look at your Construct() function, and make sure that somewhere in there you have a line logicDet = new G4LogicalVolume(.....).
Also, in your .hh file, ConstructSDandField() should be public, not private – it is called from the RunManager in each worker thread, so it has to be available to them.