Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:32

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/data/RelativisticBremData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/cont/Array.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "corecel/math/Quantity.hh"
0014 #include "celeritas/Quantities.hh"
0015 #include "celeritas/Types.hh"
0016 
0017 #include "ElectronBremsData.hh"
0018 
0019 namespace celeritas
0020 {
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * The atomic form factors used in the differential cross section of the
0024  * bremsstrahlung process by an ultrarelativistic electron.
0025  */
0026 struct RelBremFormFactor
0027 {
0028     real_type el;  //!< elastic component
0029     real_type inel;  //!< inelastic component
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 /*!
0034  * A special metadata structure per element used in the differential cross
0035  * section calculation.
0036  */
0037 struct RelBremElementData
0038 {
0039     real_type fz;  //!< \f$ \ln(Z)/3 + f_c (Coulomb correction) \f$
0040     real_type factor1;  //!< \f$ ((Fel-fc)+Finel*invZ)\f$
0041     real_type factor2;  //!< \f$ (1.0+invZ)/12 \f$
0042     real_type gamma_factor;  //!< Constant for evaluating screening functions
0043     real_type epsilon_factor;  //!< Constant for evaluating screening functions
0044 };
0045 
0046 //---------------------------------------------------------------------------//
0047 /*!
0048  * Device data for creating an interactor.
0049  */
0050 template<Ownership W, MemSpace M>
0051 struct RelativisticBremData
0052 {
0053     template<class T>
0054     using ElementItems = celeritas::Collection<T, W, M, ElementId>;
0055 
0056     //// MEMBER DATA ////
0057 
0058     //! IDs
0059     ElectronBremIds ids;
0060 
0061     //! Electron mass [MeVMass]
0062     units::MevMass electron_mass;
0063 
0064     //! Low energy limit of the model
0065     units::MevEnergy low_energy_limit;
0066 
0067     //! LPM flag
0068     bool enable_lpm{};
0069 
0070     //! Element data
0071     ElementItems<RelBremElementData> elem_data;
0072 
0073     //// MEMBER FUNCTIONS ////
0074 
0075     //! Include a dielectric suppression effect in LPM functions
0076     static CELER_CONSTEXPR_FUNCTION bool dielectric_suppression()
0077     {
0078         return true;
0079     }
0080 
0081     //! Whether all data are assigned and valid
0082     explicit CELER_FUNCTION operator bool() const
0083     {
0084         return ids && electron_mass > zero_quantity() && !elem_data.empty();
0085     }
0086 
0087     //! Assign from another set of data
0088     template<Ownership W2, MemSpace M2>
0089     RelativisticBremData& operator=(RelativisticBremData<W2, M2> const& other)
0090     {
0091         CELER_EXPECT(other);
0092         ids = other.ids;
0093         electron_mass = other.electron_mass;
0094         low_energy_limit = other.low_energy_limit;
0095         enable_lpm = other.enable_lpm;
0096         elem_data = other.elem_data;
0097         return *this;
0098     }
0099 };
0100 
0101 using RelativisticBremDeviceRef = DeviceCRef<RelativisticBremData>;
0102 using RelativisticBremHostRef = HostCRef<RelativisticBremData>;
0103 using RelativisticBremRef = NativeCRef<RelativisticBremData>;
0104 
0105 }  // namespace celeritas