Skip to content

Improve the optical photon stacking action #476

@gipert

Description

@gipert

At the moment, we send optical photons to the waiting stack and track them at the end only if there is an energy deposition in germanium with the desired energy:

std::optional<G4ClassificationOfNewTrack> RMGGermaniumOutputScheme::StackingActionClassify(
const G4Track* aTrack,
int stage
) {
// we are only interested in stacking optical photons into stage 1 after stage 0 finished.
if (stage != 0) return std::nullopt;
// defer tracking of optical photons.
if (fDiscardPhotonsIfNoGermaniumEdep &&
aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
return fWaiting;
return std::nullopt;
}
std::optional<bool> RMGGermaniumOutputScheme::StackingActionNewStage(const int stage) {
// we are only interested in stacking optical photons into stage 1 after stage 0 finished.
if (stage != 0) return std::nullopt;
// if we do not want to discard any photons ourselves, let other output schemes decide (i.e. not
// force `true` on them).
if (!fDiscardPhotonsIfNoGermaniumEdep) return std::nullopt;
const auto event = G4EventManager::GetEventManager()->GetConstCurrentEvent();
// discard all waiting events, if there was no energy deposition in Germanium.
return ShouldDiscardEvent(event) ? std::make_optional(false) : std::nullopt;
}

Still, just stacking itself seems to slow down the simulation quite a bit. We should try to understand if we can be even smarter and avoid stacking photons in some situations. For example, if the energy deposited in argon is above a certain threshold far enough from any other surface.

All of this should of course carefully validated. Any other idea?

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions