Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:16

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/em/executor/CoulombScatteringExecutor.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "celeritas/em/data/CoulombScatteringData.hh"
0013 #include "celeritas/em/data/WentzelOKVIData.hh"
0014 #include "celeritas/em/interactor/CoulombScatteringInteractor.hh"
0015 #include "celeritas/global/CoreTrackView.hh"
0016 #include "celeritas/mat/IsotopeSelector.hh"
0017 #include "celeritas/mat/MaterialTrackView.hh"
0018 #include "celeritas/phys/CutoffView.hh"
0019 #include "celeritas/phys/Interaction.hh"
0020 #include "celeritas/phys/PhysicsStepView.hh"
0021 #include "celeritas/random/RngEngine.hh"
0022 
0023 namespace celeritas
0024 {
0025 //---------------------------------------------------------------------------//
0026 struct CoulombScatteringExecutor
0027 {
0028     inline CELER_FUNCTION Interaction
0029     operator()(celeritas::CoreTrackView const& track);
0030 
0031     CoulombScatteringData params;
0032     NativeCRef<WentzelOKVIData> wentzel;
0033 };
0034 
0035 //---------------------------------------------------------------------------//
0036 /*!
0037  * Sample Wentzel's model of elastic Coulomb scattering from the current track.
0038  */
0039 CELER_FUNCTION Interaction
0040 CoulombScatteringExecutor::operator()(CoreTrackView const& track)
0041 {
0042     // Incident particle quantities
0043     auto particle = track.make_particle_view();
0044     auto const& dir = track.make_geo_view().dir();
0045 
0046     // Material and target quantities
0047     auto material = track.make_material_view().make_material_view();
0048     auto elcomp_id = track.make_physics_step_view().element();
0049     auto element_id = material.element_id(elcomp_id);
0050     auto cutoffs = track.make_cutoff_view();
0051 
0052     auto rng = track.make_rng_engine();
0053 
0054     // Select isotope
0055     ElementView element = material.make_element_view(elcomp_id);
0056     IsotopeSelector iso_select(element);
0057     IsotopeView target = element.make_isotope_view(iso_select(rng));
0058 
0059     // Construct the interactor
0060     CoulombScatteringInteractor interact(
0061         params, wentzel, particle, dir, material, target, element_id, cutoffs);
0062 
0063     // Execute the interactor
0064     return interact(rng);
0065 }
0066 
0067 //---------------------------------------------------------------------------//
0068 }  // namespace celeritas