Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-29 08:07:03

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 In Geant4, the \c dedx table belonging to the ionization process is
0082  * actually the sum of the de/dx for all processes that contribute to energy
0083  * loss for the given particle, while the \c dedx tables for the remaining
0084  * processes are the per-process energy loss.
0085  *
0086  * \todo remove \c secondary_pdg , rename \c particle_pdg to just \c pdg, also
0087  * in \c ImportMscModel
0088  */
0089 struct ImportProcess
0090 {
0091     //!@{
0092     //! \name Type aliases
0093     using PdgInt = int;
0094     //!@}
0095 
0096     PdgInt particle_pdg{0};
0097     PdgInt secondary_pdg{0};
0098     ImportProcessType process_type{ImportProcessType::size_};
0099     ImportProcessClass process_class{ImportProcessClass::size_};
0100     std::vector<ImportModel> models;
0101     ImportPhysicsTable lambda;
0102     ImportPhysicsTable lambda_prim;
0103     ImportPhysicsTable dedx;
0104     bool applies_at_rest{false};
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