Back to home page

EIC code displayed by LXR

 
 

    


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

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