Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2021-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/RayleighExecutor.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Assert.hh"
0011 #include "corecel/Macros.hh"
0012 #include "celeritas/em/data/RayleighData.hh"
0013 #include "celeritas/em/interactor/RayleighInteractor.hh"
0014 #include "celeritas/geo/GeoTrackView.hh"
0015 #include "celeritas/global/CoreTrackView.hh"
0016 #include "celeritas/mat/MaterialTrackView.hh"
0017 #include "celeritas/mat/MaterialView.hh"
0018 #include "celeritas/phys/Interaction.hh"
0019 #include "celeritas/phys/PhysicsStepView.hh"
0020 #include "celeritas/random/RngEngine.hh"
0021 
0022 namespace celeritas
0023 {
0024 //---------------------------------------------------------------------------//
0025 struct RayleighExecutor
0026 {
0027     inline CELER_FUNCTION Interaction
0028     operator()(celeritas::CoreTrackView const& track);
0029 
0030     RayleighRef params;
0031 };
0032 
0033 //---------------------------------------------------------------------------//
0034 /*!
0035  * Sample Rayleigh scattering from the current track.
0036  */
0037 CELER_FUNCTION Interaction
0038 RayleighExecutor::operator()(CoreTrackView const& track)
0039 {
0040     auto material = track.make_material_view().make_material_view();
0041     auto particle = track.make_particle_view();
0042 
0043     auto elcomp_id = track.make_physics_step_view().element();
0044     CELER_ASSERT(elcomp_id);
0045     auto el_id = material.element_id(elcomp_id);
0046     auto const& dir = track.make_geo_view().dir();
0047 
0048     RayleighInteractor interact(params, particle, dir, el_id);
0049 
0050     auto rng = track.make_rng_engine();
0051     return interact(rng);
0052 }
0053 
0054 //---------------------------------------------------------------------------//
0055 }  // namespace celeritas