Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-05 10:27:45

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/GammaNuclearData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/NonuniformGridData.hh"
0013 #include "corecel/math/Quantity.hh"
0014 #include "celeritas/Quantities.hh"
0015 #include "celeritas/Types.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Scalar data for the gamma-nuclear model.
0022  */
0023 struct GammaNuclearScalars
0024 {
0025     // Particle IDs
0026     ParticleId gamma_id;
0027 
0028     //! Model's maximum energy limit [MeV]
0029     static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
0030     {
0031         return units::MevEnergy{1e+8};
0032     }
0033 
0034     //! Whether data are assigned
0035     explicit CELER_FUNCTION operator bool() const
0036     {
0037         return static_cast<bool>(gamma_id);
0038     }
0039 };
0040 
0041 //---------------------------------------------------------------------------//
0042 /*!
0043  * Device data for calculating micro (element) cross sections.
0044  */
0045 template<Ownership W, MemSpace M>
0046 struct GammaNuclearData
0047 {
0048     template<class T>
0049     using Items = Collection<T, W, M>;
0050     template<class T>
0051     using ElementItems = Collection<T, W, M, ElementId>;
0052 
0053     //// MEMBER DATA ////
0054 
0055     // Scalar data
0056     GammaNuclearScalars scalars;
0057 
0058     // Microscopic cross sections using G4PARTICLEXS/gamma nuclear (IAEA) data
0059     ElementItems<NonuniformGridRecord> xs_iaea;
0060     Items<real_type> reals;
0061 
0062     // Microscopic cross sections using parameterized CHIPS data at high energy
0063     ElementItems<NonuniformGridRecord> xs_chips;
0064 
0065     //! Whether the data are assigned
0066     explicit CELER_FUNCTION operator bool() const
0067     {
0068         return scalars && !xs_iaea.empty() && !reals.empty()
0069                && xs_chips.size() == xs_iaea.size();
0070     }
0071 
0072     //! Assign from another set of data
0073     template<Ownership W2, MemSpace M2>
0074     GammaNuclearData& operator=(GammaNuclearData<W2, M2> const& other)
0075     {
0076         CELER_EXPECT(other);
0077         scalars = other.scalars;
0078         xs_iaea = other.xs_iaea;
0079         xs_chips = other.xs_chips;
0080         reals = other.reals;
0081 
0082         return *this;
0083     }
0084 };
0085 
0086 //---------------------------------------------------------------------------//
0087 }  // namespace celeritas