celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/user/index.html
Other
62 stars 32 forks source link

Add particle scintillation data to `ScintillationParams`; Add `ScintillationPreGenerator` #1153

Closed stognini closed 5 months ago

stognini commented 5 months ago

This PR is tied to issue #886 and is a follow-up from PR #1151 , focusing on 2 new features:

Caveats

To avoid making this PR too large, we can only sample optical photons from scintillation based on material information. Therefore, follow up work will have to expand the current scintillation physics to:

Beyond the sampling per particle type, the importing of G4OpticalParameters will be necessary. For now, there is just a placeholder in ImportParameters.hh.

All these tasks marked with // TODO: comments.

stognini commented 5 months ago

we might want to make sure we can build the ScintillationParams from the imported data without any issue when scintillation_by_particle is enabled.

This is tested in the Scintillation particle_scint_params test, which pulls data from the lar-sphere.gdml. I did not import that boolean from G4 in the GeantImporter yet, but the hard part, which is having the params being constructed accordingly, at least is (allegedly) working.

Since electrons are the only one of the scintillation particle types currently supported in Celeritas, how do we plan to use this to do the particle-dependent sampling?

The particle sampling should happen both in the pre-generator and generator. The pre-generator will 1) use the ParticleId (from ParticleTrackView) to verify if the particle is a scintillation particle; 2) check if scintillation by particle is enabled (from ScintillationData); 3) verify if the data is correctly assigned through an operator bool (which will throw an assertion failure if it is not); and 4) sample the mean number of photons accordingly. The generator will have a similar behavior, depending on both particle and material id (the particle id will have to be added to OpticalDistributionData so we correctly fetch particle+material data during the sampling in the generator.

If we're getting the scintillation distribution data in an integrated Geant4 app, would we need to also store the incident particle type in the distribution data, and import all of those scintillation particle types in our ParticleParams?

The ScintillationData::pid_to_scintpid is taking care of that. So whatever scintillation particle data is imported by the GeantImporter (which is limited by Geant4's small list defined by their enums) ends up being constructed in the ScintillationParams and has a ScintillationParticleId assigned to it. Of course, if Celeritas does not transport that particle (e.g. an ion or a proton), we for now will have the data in-memory in ScintillationData, but the pre-generator and generator will never sample those, since we will never fetch said ParticleId from ParticleTrackView (since there is no ParticleTrackView for a proton or ion being constructed during the main loop). I thought about ignoring these extra particles if they did not exist in Celeritas, but seemed an extra complication that would probably make very little difference, given the small total size of the data.