celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Support scoring of optical photons by Geant4 host sensitive detectors

Open drbenmorgan opened this issue 1 year ago • 1 comments

Related to/broken out of #1351 on the general support for optical boundary processes.

Geant4's G4OpBoundaryProcess class provides a capability for user code to use the Sensitive Detector mechanism to score optical photons that are totally absorbed on a given optical surface. Celeritas should support this capability too, and a first implementation could be to follow what was done with EM scoring by sending G4Steps of absorbed photons back to the host and passing them to the appropriate user-defined sensitive detectors on the host. It's assumed here that diagnostic like information like number of steps, process counts, etc will be handled internally by Celeritas.

The basic algorithm used in Geant4 is within G4OpBoundaryProcess::PostStepDoIt with the key parts being (omitting quite a bit of detail!):

  • It will call G4OpBoundaryProcess::DoAbsorption when the photon is going to be absorbed on the surface.
    • This checks if the photon will be "detected" given the quantum efficiency of the surface.
    • If "detected" it sets the photon's status flag to G4OpBoundaryProcessStatus::Detection, and marks the track as fStopAndKill.
  • Right at the end of PostStepDoIt, if the photon's status is G4OpBoundaryProcessStatus::Detection, then G4OpBoundaryProcess::InvokeSD is called with the photon's G4Step
    • This adds the photon energy to the step's local energy deposition, then
    • Determines if the post step point has a Sensitive Detector (i.e. the Logical Volume of the post step point), calling its Hit member function if so.

That's pretty straightforward/obvious, but with some things to note (which we've also discussed today):

  1. That the SD invocation isn't part of Geant4's main loop looks to be due to the SD being located by the post step point rather than the pre step point used for volumetric scoring (see https://gitlab.cern.ch/geant4/geant4/-/blob/geant4-11.2-release/source/tracking/src/G4SteppingManager.cc?ref_type=heads#L251), but should be checked.
  2. It's not completely clear where the post step point is following a photon being Detectioned(!). We want to check this as it will impact how/where we look for attached sensitive detectors.
    • I'll put together a minimal G4 app to confirm what happens here.
    • In StepGatherExecutor.h, StepPoint::pre is used. This might be made configurable.

This'll probably also need some follow up with experiments to see how they've implemented optical photon scoring. It's also demonstrated in Geant4 through the stepping action invoking the SD itself, e.g.: https://gitlab.cern.ch/geant4/geant4/-/blob/geant4-11.2-release/examples/extended/optical/LXe/src/LXeSteppingAction.cc?ref_type=heads#L198

drbenmorgan avatar Sep 09 '24 17:09 drbenmorgan

Possible implementation pathway:

  • [ ] Using optical-sensitive regions, just kill the track and write a log message
  • [ ] Modify to be like a specialized StepGatherAction but only gathering post-step information and call HitProcessor

sethrj avatar Mar 04 '25 14:03 sethrj