File indexing completed on 2025-09-13 08:53:26
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "celeritas/Quantities.hh"
0010 #include "celeritas/phys/InteractionUtils.hh"
0011 #include "celeritas/phys/Secondary.hh"
0012
0013 namespace celeritas
0014 {
0015 namespace detail
0016 {
0017
0018
0019
0020
0021 class BremFinalStateHelper
0022 {
0023 public:
0024
0025
0026 using Energy = units::MevEnergy;
0027 using Mass = units::MevMass;
0028 using Momentum = units::MevMomentum;
0029
0030
0031 public:
0032
0033 inline CELER_FUNCTION BremFinalStateHelper(Energy inc_energy,
0034 Real3 const& inc_direction,
0035 Momentum inc_momentum,
0036 ParticleId gamma_id,
0037 Energy gamma_energy,
0038 real_type costheta,
0039 Secondary* secondary);
0040
0041
0042 template<class Engine>
0043 inline CELER_FUNCTION Interaction operator()(Engine& rng);
0044
0045 private:
0046
0047 Real3 const& inc_direction_;
0048
0049 Momentum inc_momentum_;
0050
0051 Energy exit_energy_;
0052
0053 ParticleId gamma_id_;
0054
0055 Energy gamma_energy_;
0056
0057 real_type costheta_;
0058
0059 Secondary* secondary_;
0060 };
0061
0062
0063
0064
0065
0066
0067
0068 CELER_FUNCTION
0069 BremFinalStateHelper::BremFinalStateHelper(Energy inc_energy,
0070 Real3 const& inc_direction,
0071 Momentum inc_momentum,
0072 ParticleId gamma_id,
0073 Energy gamma_energy,
0074 real_type costheta,
0075 Secondary* secondary)
0076 : inc_direction_(inc_direction)
0077 , inc_momentum_(inc_momentum)
0078 , exit_energy_{inc_energy - gamma_energy}
0079 , gamma_id_(gamma_id)
0080 , gamma_energy_{gamma_energy}
0081 , costheta_(costheta)
0082 , secondary_{secondary}
0083 {
0084 CELER_EXPECT(secondary_);
0085 }
0086
0087
0088
0089
0090
0091 template<class Engine>
0092 CELER_FUNCTION Interaction BremFinalStateHelper::operator()(Engine& rng)
0093 {
0094
0095
0096 secondary_->direction
0097 = ExitingDirectionSampler{costheta_, inc_direction_}(rng);
0098 secondary_->particle_id = gamma_id_;
0099 secondary_->energy = gamma_energy_;
0100
0101
0102 Interaction result;
0103 result.energy = exit_energy_;
0104 result.direction = calc_exiting_direction(
0105 {inc_momentum_.value(), inc_direction_},
0106 {gamma_energy_.value(), secondary_->direction});
0107 result.secondaries = {secondary_, 1};
0108
0109 return result;
0110 }
0111
0112
0113 }
0114 }