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