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.