Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-31 08:58:46

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