Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-19 08:49:41

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/alongstep/detail/MscApplier.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "celeritas/global/CoreTrackView.hh"
0010 
0011 namespace celeritas
0012 {
0013 namespace detail
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Apply multiple scattering.
0018  *
0019  * This does three key things:
0020  * - Replaces the "geometrical" step (continuous) with the "physical" step
0021  *   (including multiple scattering)
0022  * - Likely changes the direction of the track
0023  * - Possibly displaces the particle
0024  */
0025 template<class MH>
0026 struct MscApplier
0027 {
0028     inline CELER_FUNCTION void operator()(CoreTrackView const& track);
0029 
0030     MH msc;
0031 };
0032 
0033 //---------------------------------------------------------------------------//
0034 // DEDUCTION GUIDES
0035 //---------------------------------------------------------------------------//
0036 template<class MH>
0037 CELER_FUNCTION MscApplier(MH&&) -> MscApplier<MH>;
0038 
0039 //---------------------------------------------------------------------------//
0040 // INLINE DEFINITIONS
0041 //---------------------------------------------------------------------------//
0042 template<class MH>
0043 CELER_FUNCTION void MscApplier<MH>::operator()(CoreTrackView const& track)
0044 {
0045     if (track.sim().status() != TrackStatus::alive)
0046     {
0047         // Active track killed during propagation or erroneous: don't apply MSC
0048         return;
0049     }
0050 
0051     if (track.physics_step().msc_step().geom_path > 0)
0052     {
0053         // Scatter the track and transform the "geometrical" step back to
0054         // "physical" step
0055         msc.apply_step(track);
0056     }
0057 }
0058 
0059 //---------------------------------------------------------------------------//
0060 }  // namespace detail
0061 }  // namespace celeritas