File indexing completed on 2025-09-18 09:09:12
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Macros.hh"
0010 #include "celeritas/Types.hh"
0011 #include "celeritas/geo/GeoTrackView.hh"
0012 #include "celeritas/global/CoreTrackView.hh"
0013 #include "celeritas/track/SimTrackView.hh"
0014
0015 #include "../ParticleTrackView.hh"
0016
0017 #if !CELER_DEVICE_COMPILE
0018 # include "corecel/io/Logger.hh"
0019 # include "celeritas/global/Debug.hh"
0020 #endif
0021
0022 namespace celeritas
0023 {
0024 namespace detail
0025 {
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 struct TrackingCutExecutor
0043 {
0044 inline CELER_FUNCTION void operator()(celeritas::CoreTrackView& track);
0045 };
0046
0047
0048 CELER_FUNCTION void
0049 TrackingCutExecutor::operator()(celeritas::CoreTrackView& track)
0050 {
0051 using Energy = ParticleTrackView::Energy;
0052
0053 auto particle = track.particle();
0054 auto sim = track.sim();
0055
0056
0057 auto deposited = particle.energy().value();
0058 if (particle.is_antiparticle())
0059 {
0060
0061 deposited += 2 * particle.mass().value();
0062 }
0063
0064 #if !CELER_DEVICE_COMPILE
0065 {
0066
0067
0068 auto const geo = track.geometry();
0069 auto msg = self_logger()(CELER_CODE_PROVENANCE,
0070 sim.status() == TrackStatus::errored
0071 ? LogLevel::error
0072 : LogLevel::debug);
0073 msg << "Killing track " << StreamableTrack{track} << ": "
0074 << (geo.is_outside() ? "depositing" : "lost") << ' ' << deposited
0075 << ' ' << Energy::unit_type::label();
0076 }
0077 #endif
0078
0079 track.physics_step().deposit_energy(Energy{deposited});
0080 particle.subtract_energy(particle.energy());
0081
0082 sim.status(TrackStatus::killed);
0083 }
0084
0085
0086 }
0087 }