To measure the precise position of beam strike on the front and back chamber and the number of beams passed through the middle block

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information, it will take longer to help with your problem!

_Geant4 Version:_geant4-v11.2.0
_Operating System:_Ubuntu 22.04.3 LTS
Compiler/Version:
_CMake Version:_3.17


Please guide me on how I can count the flux through the orange box and the position on the red box.


For measuring the flux, one of the primitive scorers will likely be suitable here, and it should just be a case of attaching that to the volume and then processing results as required.

For position on the other box, I think a dedicated sensitive detector and hit class will be needed. The ProcessHits(G4Step*) member function would then need to be written to query the G4Step to see if it is entering the volume, and then record the PreStepPoint which would be the entry point.


Sir, I want to calculate this flux through the NaI scintillator detector

Then one of the “Current and Flux Scorers” documented in the Application Developer’s Guide will probably be suitable. See the Basic Examples B3a/B3b for use of primitive scorers.

Sir, after this, I want to generate a plot for gamma photon count vs energy for the NaI scintillator detector.

Scoring per event or in histograms is covered in the Analysis section of the Application Developer Guide, with example use in, for instance, Basic Example B3 and Example B4