1 #ifndef GUARD_GGEMS_NAVIGATORS_GGEMSPHOTONNAVIGATOR_HH
2 #define GUARD_GGEMS_NAVIGATORS_GGEMSPHOTONNAVIGATOR_HH
34 #ifdef __OPENCL_C_VERSION__
57 inline void GetPhotonNextInteraction(
62 GGint const particle_id)
65 GGint energy_id =
BinarySearchLeft(primary_particle->E_[particle_id], particle_cross_sections->energy_bins_, particle_cross_sections->number_of_bins_, 0, 0);
70 GGchar photon_process_id = 0;
71 GGfloat interaction_distance = 0.0f;
74 for (
GGchar i = 0; i < particle_cross_sections->number_of_activated_photon_processes_; ++i) {
76 photon_process_id = particle_cross_sections->photon_cs_id_[i];
79 interaction_distance =
80 -log(KissUniform(random, particle_id))/
81 particle_cross_sections->photon_cross_sections_[photon_process_id][energy_id + particle_cross_sections->number_of_bins_*index_material];
83 if (interaction_distance < next_interaction_distance) {
84 next_interaction_distance = interaction_distance;
85 next_discrete_process = photon_process_id;
90 primary_particle->E_index_[particle_id] = energy_id;
91 primary_particle->next_interaction_distance_[particle_id] = next_interaction_distance;
92 primary_particle->next_discrete_process_[particle_id] = next_discrete_process;
109 inline void PhotonDiscreteProcess(
115 GGint const particle_id
119 GGchar next_iteraction_process = primary_particle->next_discrete_process_[particle_id];
123 KleinNishinaComptonSampleSecondaries(primary_particle, random, particle_id);
126 StandardPhotoElectricSampleSecondaries(primary_particle, particle_id);
129 LivermoreRayleighSampleSecondaries(primary_particle, random, materials, particle_cross_sections, material_id, particle_id);
135 #endif // GUARD_GGEMS_NAVIGATORS_GGEMSPHOTONNAVIGATOR_HH