Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:11:39

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/optical/surface/model/GridReflectivityModel.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/data/ParamsDataStore.hh"
0010 #include "celeritas/inp/OpticalPhysics.hh"
0011 #include "celeritas/optical/surface/SurfaceModel.hh"
0012 
0013 #include "GridReflectivityData.hh"
0014 
0015 namespace celeritas
0016 {
0017 namespace optical
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * User-defined grid reflectivity model.
0022  *
0023  * Allows user-defined grids (probability as a function of energy) to override
0024  * the usual surface physics logic.
0025  * Following Geant4's conventions, reflectivity is defined as the probability a
0026  * track continues with the usual surface interaction (not necessarily just
0027  * reflects). Transmittance is the probability the track moves to the next
0028  * surface layer without any changes. If the reflectivity and transmittance do
0029  * not sum to 1, then the remaining probability is the chance the track is
0030  * absorbed on the surface.
0031  *
0032  * If a track is absorbed on the surface and there's a non-zero efficiency
0033  * grid, it is sampled as the probability the track is "detected" on the
0034  * surface. Because this is a hold-over from Geant4 integration, if the track
0035  * is sampled to pass the efficiency then it is changed from absorbed to
0036  * transmitted. If the next volume is indeed a detector volume, then it is
0037  * detected and killed at the surface which matches Geant4's expectation for
0038  * detection on a surface.
0039  *
0040  * \todo Refactor into a unified grid that at each point has the probability of
0041  * forcing absorption (before entering a potential detector region) or
0042  * transmission ?
0043  */
0044 class GridReflectivityModel : public SurfaceModel
0045 {
0046   public:
0047     //!@{
0048     //! \name Type aliases
0049     using InputT = inp::GridReflection;
0050     //!@}
0051 
0052   public:
0053     // Construct the model from an ID and layer map
0054     GridReflectivityModel(SurfaceModelId,
0055                           std::map<PhysSurfaceId, InputT> const&);
0056 
0057     //! Get the list of physical surfaces this model applies to
0058     VecSurfaceLayer const& get_surfaces() const final { return surfaces_; }
0059 
0060     // Execute the model with host data
0061     void step(CoreParams const&, CoreStateHost&) const final;
0062 
0063     // Execute the model with device data
0064     void step(CoreParams const&, CoreStateDevice&) const final;
0065 
0066   private:
0067     VecSurfaceLayer surfaces_;
0068     ParamsDataStore<GridReflectivityData> data_;
0069 };
0070 
0071 //---------------------------------------------------------------------------//
0072 }  // namespace optical
0073 }  // namespace celeritas