Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:53:26

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/RayleighExecutor.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/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 
0021 namespace celeritas
0022 {
0023 //---------------------------------------------------------------------------//
0024 struct RayleighExecutor
0025 {
0026     inline CELER_FUNCTION Interaction
0027     operator()(celeritas::CoreTrackView const& track);
0028 
0029     RayleighRef params;
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 /*!
0034  * Sample Rayleigh scattering from the current track.
0035  */
0036 CELER_FUNCTION Interaction
0037 RayleighExecutor::operator()(CoreTrackView const& track)
0038 {
0039     auto material = track.material().material_record();
0040     auto particle = track.particle();
0041 
0042     auto elcomp_id = track.physics_step().element();
0043     CELER_ASSERT(elcomp_id);
0044     auto el_id = material.element_id(elcomp_id);
0045     auto const& dir = track.geometry().dir();
0046 
0047     RayleighInteractor interact(params, particle, dir, el_id);
0048 
0049     auto rng = track.rng();
0050     return interact(rng);
0051 }
0052 
0053 //---------------------------------------------------------------------------//
0054 }  // namespace celeritas