Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-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/ImportProcess.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <map>
0011 #include <string_view>
0012 #include <vector>
0013 
0014 #include "corecel/Macros.hh"
0015 // IWYU pragma: begin_exports
0016 #include "ImportModel.hh"
0017 #include "ImportPhysicsTable.hh"
0018 #include "ImportPhysicsVector.hh"
0019 // IWYU pragma: end_exports
0020 
0021 namespace celeritas
0022 {
0023 //---------------------------------------------------------------------------//
0024 /*!
0025  * Category of physics process.
0026  *
0027  * See Geant4's G4ProcessType.hh for the equivalent enum.
0028  */
0029 enum class ImportProcessType
0030 {
0031     other,
0032     transportation,
0033     electromagnetic,
0034     optical,
0035     hadronic,
0036     photolepton_hadron,
0037     decay,
0038     general,
0039     parameterisation,
0040     user_defined,
0041     parallel,
0042     phonon,
0043     ucn,
0044     size_
0045 };
0046 
0047 //---------------------------------------------------------------------------//
0048 /*!
0049  * Enumerator for the available physics processes.
0050  *
0051  * This enum was created to safely access the many physics tables imported.
0052  */
0053 enum class ImportProcessClass
0054 {
0055     other,
0056     // EM
0057     ion_ioni,
0058     msc,
0059     h_ioni,
0060     h_brems,
0061     h_pair_prod,
0062     coulomb_scat,
0063     e_ioni,
0064     e_brems,
0065     photoelectric,
0066     compton,
0067     conversion,
0068     rayleigh,
0069     annihilation,
0070     mu_ioni,
0071     mu_brems,
0072     mu_pair_prod,
0073     gamma_general,  // Will be decomposed into other processes
0074     // Neutron
0075     neutron_elastic,
0076     size_
0077 };
0078 
0079 //---------------------------------------------------------------------------//
0080 /*!
0081  * Store physics process data.
0082  *
0083  * \note \c ImportPhysicsTable is process and type (lambda, dedx, and so
0084  * on) dependent, with each table type including physics vectors for all
0085  * materials. Therefore, the physics vector of a given material is retrieved
0086  * by finding the appropriate \c table_type in the \c tables vector and
0087  * selecting the material: \c table.physics_vectors.at(material_id) .
0088  *
0089  * \todo remove \c secondary_pdg , rename \c particle_pdg to just \c pdg, also
0090  * in \c ImportMscModel
0091  */
0092 struct ImportProcess
0093 {
0094     //!@{
0095     //! \name Type aliases
0096     using PdgInt = int;
0097     //!@}
0098 
0099     PdgInt particle_pdg{0};
0100     PdgInt secondary_pdg{0};
0101     ImportProcessType process_type{ImportProcessType::size_};
0102     ImportProcessClass process_class{ImportProcessClass::size_};
0103     std::vector<ImportModel> models;
0104     std::vector<ImportPhysicsTable> tables;
0105 
0106     explicit operator bool() const
0107     {
0108         return particle_pdg != 0 && process_type != ImportProcessType::size_
0109                && process_class != ImportProcessClass::size_ && !models.empty();
0110     }
0111 };
0112 
0113 //---------------------------------------------------------------------------//
0114 // FREE FUNCTIONS
0115 //---------------------------------------------------------------------------//
0116 
0117 // Get the string form of one of the enumerations
0118 char const* to_cstring(ImportProcessType value);
0119 char const* to_cstring(ImportProcessClass value);
0120 
0121 // Get the default Geant4 process name
0122 char const* to_geant_name(ImportProcessClass value);
0123 // Convert a Geant4 process name to an IPC (throw RuntimeError if unsupported)
0124 ImportProcessClass geant_name_to_import_process_class(std::string_view sv);
0125 
0126 //---------------------------------------------------------------------------//
0127 }  // namespace celeritas