|
|
|||
File indexing completed on 2026-10-27 09:25:09
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/ext/detail/GeantProcessImporter.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <memory> 0010 #include <unordered_map> 0011 #include <vector> 0012 0013 #include "corecel/cont/Array.hh" 0014 #include "corecel/inp/Grid.hh" 0015 #include "celeritas/io/ImportElement.hh" 0016 #include "celeritas/io/ImportMaterial.hh" 0017 #include "celeritas/io/ImportModel.hh" 0018 #include "celeritas/io/ImportProcess.hh" 0019 0020 class G4VProcess; 0021 class G4VEmProcess; 0022 class G4VEmModel; 0023 class G4VEnergyLossProcess; 0024 class G4VMultipleScattering; 0025 class G4HadronicProcess; 0026 class G4ParticleDefinition; 0027 class G4PhysicsTable; 0028 class G4PhysicsVector; 0029 class G4Physics2DVector; 0030 0031 namespace celeritas 0032 { 0033 namespace detail 0034 { 0035 //---------------------------------------------------------------------------// 0036 /*! 0037 * Simplify the convoluted mechanism to store Geant4 process, model, and XS 0038 * table data. 0039 * 0040 * \c Operator() is expected to be used while looping over Geant4 particle and 0041 * process lists, and it returns a populated \c ImportProcess object. If said 0042 * process was already imported during a previous loop, it will return an 0043 * empty object. \c ImportProcess has an operator bool to check if said object 0044 * is not empty before adding it to the \c vector<ImportProcess> member of 0045 * \c ImportData . 0046 * 0047 * \code 0048 * std::vector<ImportProcess> processes; 0049 * GeantProcessImporter import(materials, elements); 0050 * 0051 * G4ParticleTable::G4PTblDicIterator& particle_iterator 0052 * = *(G4ParticleTable::GetParticleTable()->GetIterator()); 0053 * particle_iterator.reset(); 0054 * 0055 * while (particle_iterator()) 0056 * { 0057 * const G4ParticleDefinition& g4_particle_def 0058 * = *(particle_iterator.value()); 0059 * const G4ProcessVector& *process_list = 0060 * *g4_particle_def.GetProcessManager()->GetProcessList(); 0061 * 0062 * for (int j = 0; j < process_list.size(); j++) 0063 * { 0064 * if (ImportProcess process 0065 * = import(g4_particle_def, *process_list[j])) 0066 * { 0067 * processes.push_back(std::move(process)); 0068 * } 0069 * } 0070 * } 0071 * \endcode 0072 */ 0073 class GeantProcessImporter 0074 { 0075 public: 0076 // Construct with selected list of tables 0077 GeantProcessImporter(std::vector<ImportPhysMaterial> const& materials, 0078 std::vector<ImportElement> const& elements, 0079 inp::Interpolation interpolation); 0080 0081 // Import processes 0082 ImportProcess operator()(G4ParticleDefinition const& particle, 0083 G4VEmProcess const& process); 0084 ImportProcess operator()(G4ParticleDefinition const& particle, 0085 G4VEnergyLossProcess const& process); 0086 ImportProcess operator()(G4ParticleDefinition const& particle, 0087 G4HadronicProcess const& process); 0088 std::vector<ImportMscModel> operator()( 0089 G4ParticleDefinition const& particle, 0090 G4VMultipleScattering const& process); 0091 0092 private: 0093 // Store material and element information for the element selector tables 0094 std::vector<ImportPhysMaterial> const& materials_; 0095 std::vector<ImportElement> const& elements_; 0096 inp::Interpolation interpolation_; 0097 }; 0098 0099 //---------------------------------------------------------------------------// 0100 // FREE FUNCTIONS 0101 //---------------------------------------------------------------------------// 0102 // Import a uniform physics vector with the given x, y units 0103 inp::UniformGrid import_physics_log_vector(G4PhysicsVector const&, 0104 Array<ImportUnits, 2>); 0105 0106 // Import a generic physics vector with the given x, y units 0107 inp::Grid import_physics_vector(G4PhysicsVector const&, Array<ImportUnits, 2>); 0108 0109 // Import a 2D physics vector 0110 inp::TwodGrid import_physics_2dvector(G4Physics2DVector const&, 0111 Array<ImportUnits, 3>); 0112 0113 //---------------------------------------------------------------------------// 0114 } // namespace detail 0115 } // namespace celeritas
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|