File indexing completed on 2025-09-17 08:53:42
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "celeritas/global/CoreTrackView.hh"
0012
0013 #include "../CherenkovOffload.hh"
0014 #include "../OffloadData.hh"
0015
0016 namespace celeritas
0017 {
0018 namespace detail
0019 {
0020
0021
0022
0023
0024
0025
0026 struct CherenkovOffloadExecutor
0027 {
0028 inline CELER_FUNCTION void
0029 operator()(celeritas::CoreTrackView const& track);
0030
0031 NativeCRef<celeritas::optical::MaterialParamsData> const material;
0032 NativeCRef<celeritas::optical::CherenkovData> const cherenkov;
0033 NativeRef<OffloadStateData> const state;
0034 OpticalOffloadCounters<> size;
0035 };
0036
0037
0038
0039
0040
0041
0042
0043 CELER_FUNCTION void
0044 CherenkovOffloadExecutor::operator()(CoreTrackView const& track)
0045 {
0046 CELER_EXPECT(state);
0047 CELER_EXPECT(cherenkov);
0048 CELER_EXPECT(material);
0049
0050 using DistId = ItemId<celeritas::optical::GeneratorDistributionData>;
0051
0052 auto tsid = track.track_slot_id();
0053 CELER_ASSERT(size.cherenkov + tsid.get() < state.cherenkov.size());
0054 auto& cherenkov_dist = state.cherenkov[DistId(size.cherenkov + tsid.get())];
0055
0056
0057 cherenkov_dist = {};
0058
0059 auto sim = track.sim();
0060 auto const& step = state.step[tsid];
0061
0062 if (!step || sim.status() == TrackStatus::inactive)
0063 {
0064
0065
0066 return;
0067 }
0068
0069 auto particle = track.particle();
0070
0071
0072 if (particle.charge() != zero_quantity())
0073 {
0074 Real3 const& pos = track.geometry().pos();
0075 optical::MaterialView opt_mat{material, step.material};
0076 auto rng = track.rng();
0077
0078 CherenkovOffload generate(particle, sim, opt_mat, pos, cherenkov, step);
0079 cherenkov_dist = generate(rng);
0080 }
0081 }
0082
0083
0084 }
0085 }