Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:08:57

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/RayleighData.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 "celeritas/Types.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Rayleigh angular parameters to fit tabulated form factors.
0020  *
0021  * The form factors \em FF (constructed by the RayleighModel) are:
0022  * \f[
0023  *  FF(E,cos)^2 = \Sigma_{j} \frac{a_j}{[1 + b_j x]^{n}}
0024  * \f]
0025  * where \f$ x = E^{2}(1 - \cos\theta) \f$ and \em n is the high energy slope
0026  * of the form factor and \em a and \em b are free parameters to obtain the
0027  * best fit to the form factor. The unit for the energy (\em E) is in MeV.
0028  */
0029 struct RayleighParameters
0030 {
0031     Real3 a;
0032     Real3 b;
0033     Real3 n;
0034 };
0035 
0036 //---------------------------------------------------------------------------//
0037 /*!
0038  * Device data for creating an interactor.
0039  */
0040 template<Ownership W, MemSpace M>
0041 struct RayleighData
0042 {
0043     template<class T>
0044     using ElementItems = celeritas::Collection<T, W, M, ElementId>;
0045 
0046     ParticleId gamma;
0047     ElementItems<RayleighParameters> params;
0048 
0049     //! Check whether the data is assigned
0050     explicit CELER_FUNCTION operator bool() const
0051     {
0052         return gamma && !params.empty();
0053     }
0054 
0055     //! Assign from another set of data
0056     template<Ownership W2, MemSpace M2>
0057     RayleighData& operator=(RayleighData<W2, M2> const& other)
0058     {
0059         CELER_EXPECT(other);
0060         gamma = other.gamma;
0061         params = other.params;
0062         return *this;
0063     }
0064 };
0065 
0066 using RayleighRef = NativeCRef<RayleighData>;
0067 //---------------------------------------------------------------------------//
0068 }  // namespace celeritas