Geant4 Version: 11.2.1
_Operating System: Windows 10
_Compiler/Version: g++
_CMake Version: 3.29
In my simple adaptation of the B1 example, I would like to know how to count and then output the number of times a detector is hit by a particle. I assumed you had to turn a logical volume into a sensitive detector and then set up SensitiveDetector.hh and SensitiveDetector.cc files. Is this the wrong approach to something as simple as counting the number of times a detector is hit? I’ve attached my code below if that helps for anyone.
DetectorConstruction.hh:
DetectorConstruction.hh (2.5 KB)
DetectorConstruction.cc:
DetectorConstruction.cc (5.2 KB)
SensitiveDetector.hh:
SensitiveDetector.hh (529 Bytes)
SensitiveDetector.cc:
SensitiveDetector.cc (330 Bytes)