Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:22

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/io/NeutronXsReader.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <string>
0010 
0011 #include "corecel/math/Quantity.hh"
0012 #include "corecel/math/UnitUtils.hh"
0013 #include "celeritas/UnitTypes.hh"
0014 #include "celeritas/Units.hh"
0015 #include "celeritas/inp/Grid.hh"
0016 #include "celeritas/phys/AtomicNumber.hh"
0017 
0018 namespace celeritas
0019 {
0020 //---------------------------------------------------------------------------//
0021 /*!
0022  * Types of microscopic cross sections in G4PARTICLEXSDATA/neutron data.
0023  */
0024 enum class NeutronXsType
0025 {
0026     cap,  //!< Capture cross section
0027     el,  //!< Elastic cross section
0028     inel,  //!< Inelastic cross section
0029     size_
0030 };
0031 
0032 //---------------------------------------------------------------------------//
0033 /*!
0034  * Load the neutron cross section (G4PARTICLEXSDATA/neutron) data by the
0035  * interaction type (capture, elastic, and inelastic).
0036  */
0037 class NeutronXsReader
0038 {
0039   public:
0040     //!@{
0041     //! \name Type aliases
0042     using result_type = inp::Grid;
0043     using MmSqMicroXs
0044         = Quantity<UnitProduct<units::Millimeter, units::Millimeter>, double>;
0045     //!@}
0046 
0047   public:
0048     // Construct the reader and locate the data using the environment variable
0049     explicit NeutronXsReader(NeutronXsType type);
0050 
0051     // Construct the reader from the path to the data directory and the type
0052     NeutronXsReader(NeutronXsType type, char const* path);
0053 
0054     // Read the data for the given element
0055     result_type operator()(AtomicNumber atomic_number) const;
0056 
0057   private:
0058     // Type and directory containing the neutron elastic cross section data
0059     NeutronXsType type_;
0060     std::string path_;
0061 };
0062 
0063 //---------------------------------------------------------------------------//
0064 // FREE FUNCTIONS
0065 //---------------------------------------------------------------------------//
0066 
0067 // Get the string value for a neutron cross section type
0068 char const* to_cstring(NeutronXsType value);
0069 
0070 //---------------------------------------------------------------------------//
0071 }  // namespace celeritas