I am new to geant4 and am trying to create a simulation of an integrating sphere with liquid (currently water) and a detector inside it.

The structure of the geometry is almost fully completed. My idea is to fire a certain number of particles (fParticleGun already implemented) from the edge of one of the two conduits and count the number of bounces of the optical photon on the surface of the sphere, the number of photons reaching the yellow detector and the time it takes for the photon to reach that detector.

As far as the two surfaces (sphere and detector) are concerned, I think I have already made them sensitive:

G4MultiFunctionalDetector* SferaIntegratrice_SD = new G4MultiFunctionalDetector("SferaIntegratrice_SD");
G4SDManager::GetSDMpointer()->AddNewDetector(SferaIntegratrice_SD);
//G4VPrimitiveScorer* primitiv1 = new G4PSDoseDeposit("dose");
//SferaIntegratrice_SD->RegisterPrimitive(primitiv1);
SetSensitiveDetector("SferaIntegratriceLV",SferaIntegratrice_SD);
G4MultiFunctionalDetector* SiPM_SD = new G4MultiFunctionalDetector("SiPM_SD");
G4SDManager::GetSDMpointer()->AddNewDetector(SiPM_SD);
//G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
//SiPM_SD->RegisterPrimitive(primitiv2);
SetSensitiveDetector("SiPMLV",SiPM_SD);

Correct me if I am wrong. To count the number of bounces, for simplicityâ€™s sake letâ€™s consider firing a single optical photon, I think we need to use the class G4PSSphereSurfaceCurrent.hh (reading from the developerâ€™s manual). I couldnâ€™t find any examples on it unfortunatelyâ€¦

So I ask, how can I count the number of bounces, the number of photons that reach the yellow detector and then disappear, and the time it takes for the photon to reach that detector once it has been fired?

alternatively, you can attach the scorers via commands/macro. there you can also dump results after each run. think you will find suitable examples for that

Edit: sorry, missed that it is a sphereâ€¦ not so sure about that then

but as mentioned, the SphereSurfaceCurrent is not in the list of available primitive scorers for command based scoring, as you will see when you study that page

an idea could be to define an additional hollow sphere, and attach the volumeFlux scorer to it?