Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:08:58

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