File indexing completed on 2026-11-07 10:11:35
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "celeritas/global/CoreTrackView.hh"
0011 #include "celeritas/mat/ElementView.hh"
0012 #include "celeritas/mucf/data/DTMixMucfData.hh"
0013 #include "celeritas/mucf/interactor/DDMucfInteractor.hh"
0014 #include "celeritas/mucf/interactor/DTMucfInteractor.hh"
0015 #include "celeritas/mucf/interactor/TTMucfInteractor.hh"
0016
0017 #include "detail/DDChannelSelector.hh"
0018 #include "detail/DTChannelSelector.hh"
0019 #include "detail/DTMixMuonicMoleculeSelector.hh"
0020 #include "detail/MuonicAtomSelector.hh"
0021 #include "detail/MuonicAtomSpinSelector.hh"
0022 #include "detail/MuonicMoleculeSpinSelector.hh"
0023 #include "detail/TTChannelSelector.hh"
0024
0025 namespace celeritas
0026 {
0027
0028 struct DTMixMucfExecutor
0029 {
0030 inline CELER_FUNCTION Interaction operator()(
0031 celeritas::CoreTrackView const& track);
0032
0033 NativeCRef<DTMixMucfData> data;
0034 };
0035
0036
0037
0038
0039
0040 CELER_FUNCTION Interaction DTMixMucfExecutor::operator()(
0041 celeritas::CoreTrackView const& track)
0042 {
0043 auto phys_step_view = track.physics_step();
0044 auto elcomp_id = phys_step_view.element();
0045 CELER_ASSERT(elcomp_id);
0046
0047 auto element = track.material().material_record().element_record(elcomp_id);
0048 CELER_ASSERT(element.atomic_number() == AtomicNumber{1});
0049
0050 auto rng = track.rng();
0051
0052
0053 real_type const decay_len{};
0054
0055
0056
0057 auto find = [&](PhysMatId matid) -> MuCfMatId {
0058 CELER_EXPECT(matid);
0059 for (auto i : range(data.mucfmatid_to_matid.size()))
0060 {
0061 if (auto const comp_id = MuCfMatId{i};
0062 data.mucfmatid_to_matid[comp_id] == matid)
0063 {
0064 return comp_id;
0065 }
0066 }
0067
0068 return MuCfMatId{};
0069 };
0070 auto const mucf_matid = find(track.material().material_id());
0071 CELER_ASSERT(mucf_matid);
0072
0073
0074 detail::MuonicAtomSelector form_atom(
0075 data.isotopic_fractions[mucf_matid][MucfIsotope::deuterium]);
0076 auto muonic_atom = form_atom(rng);
0077
0078
0079 detail::MuonicAtomSpinSelector select_atom_spin(muonic_atom);
0080
0081
0082
0083
0084
0085
0086
0087
0088 detail::DTMixMuonicMoleculeSelector form_muonic_molecule;
0089 auto muonic_molecule = form_muonic_molecule(rng);
0090
0091
0092 detail::MuonicMoleculeSpinSelector select_molecule_spin(muonic_molecule);
0093 auto const molecule_spin = select_molecule_spin(rng);
0094
0095
0096 auto const cycle_time
0097 = data.cycle_times[mucf_matid][muonic_molecule][molecule_spin];
0098 CELER_ASSERT(cycle_time > 0);
0099
0100
0101 real_type const mucf_len = cycle_time * track.sim().step_length();
0102 if (decay_len < mucf_len)
0103 {
0104
0105
0106 }
0107
0108
0109 track.sim().add_time(cycle_time);
0110
0111
0112
0113 auto allocate_secondaries = phys_step_view.make_secondary_allocator();
0114 Interaction result;
0115 switch (muonic_molecule)
0116 {
0117 case MucfMuonicMolecule::deuterium_deuterium: {
0118
0119 DDMucfInteractor interact(
0120 data, detail::DDChannelSelector()(rng), allocate_secondaries);
0121 result = interact(rng);
0122 break;
0123 }
0124 case MucfMuonicMolecule::deuterium_tritium: {
0125
0126 DTMucfInteractor interact(
0127 data, detail::DTChannelSelector()(rng), allocate_secondaries);
0128 result = interact(rng);
0129 break;
0130 }
0131 case MucfMuonicMolecule::tritium_tritium: {
0132
0133 TTMucfInteractor interact(
0134 data, detail::TTChannelSelector()(rng), allocate_secondaries);
0135 result = interact(rng);
0136 break;
0137 }
0138 default:
0139 CELER_ASSERT_UNREACHABLE();
0140 }
0141
0142
0143
0144
0145 return result;
0146 }
0147
0148
0149 }