Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:01

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/params/WentzelOKVIParams.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "corecel/data/ParamsDataInterface.hh"
0013 #include "celeritas/em/data/WentzelOKVIData.hh"
0014 #include "celeritas/phys/AtomicNumber.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 class MaterialParams;
0020 class ParticleParams;
0021 struct ImportData;
0022 
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Construct and store shared Coulomb and multiple scattering data.
0026  *
0027  * This data is used by both the single Coulomb scattering and Wentzel VI
0028  * multiple scattering models.
0029  */
0030 class WentzelOKVIParams final : public ParamsDataInterface<WentzelOKVIData>
0031 {
0032   public:
0033     //!@{
0034     //! \name Type aliases
0035     using SPConstMaterials = std::shared_ptr<MaterialParams const>;
0036     using SPConstParticles = std::shared_ptr<ParticleParams const>;
0037     //!@}
0038 
0039   public:
0040     struct Options
0041     {
0042         //! Use combined single and multiple scattering
0043         bool is_combined{true};
0044         //! Polar angle limit between single and multiple scattering
0045         real_type polar_angle_limit{constants::pi};
0046         //! Factor for dynamic computation of angular limit between SS and MSC
0047         real_type angle_limit_factor{1};
0048         //! User defined screening factor
0049         real_type screening_factor{1};
0050         //! Nuclear form factor model
0051         NuclearFormFactorType form_factor{NuclearFormFactorType::exponential};
0052     };
0053 
0054   public:
0055     // Construct if Wentzel VI or Coulomb is present, else return nullptr
0056     static std::shared_ptr<WentzelOKVIParams>
0057     from_import(ImportData const& data,
0058                 SPConstMaterials materials,
0059                 SPConstParticles particles);
0060 
0061     // Construct from material data and options
0062     WentzelOKVIParams(SPConstMaterials materials,
0063                       SPConstParticles particles,
0064                       Options options);
0065 
0066     //! Access Wentzel OK&VI data on the host
0067     HostRef const& host_ref() const final { return data_.host_ref(); }
0068 
0069     //! Access Wentzel OK&VI data on the device
0070     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0071 
0072   private:
0073     //// TYPES ////
0074 
0075     using CoeffMat = MottElementData::MottCoeffMatrix;
0076 
0077     //// DATA ////
0078 
0079     // Host/device storage and reference
0080     CollectionMirror<WentzelOKVIData> data_;
0081 
0082     //// HELPER METHODS ////
0083 
0084     // Construct per-element data (loads Mott coefficients)
0085     void build_data(HostVal<WentzelOKVIData>& host_data,
0086                     MaterialParams const& materials);
0087 
0088     // Retrieve matrix of interpolated Mott electron coefficients
0089     static CoeffMat get_electron_mott_coeffs(AtomicNumber z);
0090 
0091     // Retrieve matrix of interpolated Mott positron coefficients
0092     static CoeffMat get_positron_mott_coeffs(AtomicNumber z);
0093 };
0094 
0095 //---------------------------------------------------------------------------//
0096 }  // namespace celeritas