celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Define new detector params class for managing Geant4 SD callbacks

Open sethrj opened this issue 8 months ago • 2 comments

This will (eventually) replace some components of the GeantSd and HitProcessor classes and prepare them for optical detectors. It should also replace part of the SimpleCalo class (basically could start as a refactoring of it). This should be used for #1746 and, more immediately, #1397.

Construction will be with list of canonical volume IDs and geo interface

DetectorParamsData:

  • Collection<DetectorId, W, M, VolumeId> detector_ids

Class interface:

  • class DetectorParams : public ParamsDataInterface<DetectorParamsData>
  • Member function to return DetectorId -> VolumeId
  • Lives in celeritas/user

Then:

  • Add to optical core params
  • CoreParamsData would have a DetectorParamsData<Ownership::const_reference, M> detectors

Future work:

  • Add to global core params
  • Add thread-local DetectorId -> G4SD* mapping
  • Replace components in GeantSd

sethrj avatar Apr 17 '25 17:04 sethrj

See #1764

sethrj avatar Jul 10 '25 09:07 sethrj

Add detectors to the inp::Model:

  • Detector struct
  • DetectorId moves to geocel/Types
  • GeantGeoParams defines G4SD* id_to_geant(DetectorId) and geant_to_id functions (use code from GeantSd::setup_volumes to map)
  • Add tests to GeantGeo.test.cc (model testing is implemented in GenericGeoResults.{hh,cc}
  • Update SDParams to take inp::Detectors
  • Construct SDParams in setup::model
  • Add SDParams to global CoreParams::Input and store in CoreParams
  • Copy to optical core params via OpticalCollector
  • Look up post-volume crossing in optical PostBoundaryExecutor, log and absorb if detector found
struct Detector
{
    Label label;
    std::vector<VolumeId> volumes;
};

sethrj avatar Sep 02 '25 18:09 sethrj