Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:15

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2021-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/em/data/RayleighData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/cont/Array.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "celeritas/Types.hh"
0015 
0016 namespace celeritas
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Rayleigh angular parameters to fit tabulated form factors.
0021  *
0022  * The form factors \em FF (constructed by the RayleighModel) are:
0023  * \f[
0024  *  FF(E,cos)^2 = \Sigma_{j} \frac{a_j}{[1 + b_j x]^{n}}
0025  * \f]
0026  * where \f$ x = E^{2}(1 - \cos\theta) \f$ and \em n is the high energy slope
0027  * of the form factor and \em a and \em b are free parameters to obtain the
0028  * best fit to the form factor. The unit for the energy (\em E) is in MeV.
0029  */
0030 struct RayleighParameters
0031 {
0032     Real3 a;
0033     Real3 b;
0034     Real3 n;
0035 };
0036 
0037 //---------------------------------------------------------------------------//
0038 /*!
0039  * Device data for creating an interactor.
0040  */
0041 template<Ownership W, MemSpace M>
0042 struct RayleighData
0043 {
0044     template<class T>
0045     using ElementItems = celeritas::Collection<T, W, M, ElementId>;
0046 
0047     ParticleId gamma;
0048     ElementItems<RayleighParameters> params;
0049 
0050     //! Check whether the data is assigned
0051     explicit CELER_FUNCTION operator bool() const
0052     {
0053         return gamma && !params.empty();
0054     }
0055 
0056     //! Assign from another set of data
0057     template<Ownership W2, MemSpace M2>
0058     RayleighData& operator=(RayleighData<W2, M2> const& other)
0059     {
0060         CELER_EXPECT(other);
0061         gamma = other.gamma;
0062         params = other.params;
0063         return *this;
0064     }
0065 };
0066 
0067 using RayleighRef = NativeCRef<RayleighData>;
0068 //---------------------------------------------------------------------------//
0069 }  // namespace celeritas