Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-30 09:14:51

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/ImportData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <vector>
0010 
0011 #include "corecel/inp/Grid.hh"
0012 #include "celeritas/inp/Particle.hh"
0013 #include "celeritas/inp/Physics.hh"
0014 #include "celeritas/inp/PhysicsModel.hh"
0015 // IWYU pragma: begin_exports
0016 #include "ImportElement.hh"
0017 #include "ImportLivermorePE.hh"
0018 #include "ImportMaterial.hh"
0019 #include "ImportOpticalMaterial.hh"
0020 #include "ImportOpticalModel.hh"
0021 #include "ImportParameters.hh"
0022 #include "ImportProcess.hh"
0023 #include "ImportVolume.hh"
0024 // IWYU pragma: end_exports
0025 
0026 namespace celeritas
0027 {
0028 //---------------------------------------------------------------------------//
0029 /*!
0030  * Store imported physics data from external sources.
0031  *
0032  * All the data imported to Celeritas is stored in this single entity. This
0033  * struct can be used in memory or recorded in a ROOT TBranch as a single TTree
0034  * entry, which will be read by \c RootImporter to load the data into
0035  * Celeritas. Currently, the TTree and TBranch names are hardcoded as \e
0036  * geant4_data and \e ImportData in \c RootImporter .
0037  *
0038  * Each entity's id is defined by its vector position. An \c ImportElement with
0039  * id = 3 is stored at \c elements[3] . The same is true for
0040  * geometry/physics/materials (all of which have an independent index!) and
0041  * volumes.
0042  *
0043  * Seltzer-Berger, Livermore PE, and atomic relaxation data are loaded based on
0044  * atomic numbers, and thus are stored in maps. To retrieve specific data use
0045  * \c find(atomic_number) .
0046  *
0047  * The unit system of the data is stored in the "units" string. If empty
0048  * (backward compatibility) or "cgs" the embedded contents are in CGS. If
0049  * "clhep" the units are CLHEP (the native Geant4 unit system). The \c
0050  * convert_to_native function will convert a data structure in place and update
0051  * the units label. Refer to \c base/Units.hh for further information on unit
0052  * systems.
0053  *
0054  * \note  \c ImportData will eventually become \c inp::Problem once the import
0055  * system populates all its \c inp:: objects.
0056  */
0057 struct ImportData
0058 {
0059     //!@{
0060     //! \name Type aliases
0061     using ZInt = int;
0062     using GeoMatIndex = unsigned int;
0063     using ImportSBMap = std::map<ZInt, inp::TwodGrid>;
0064     //!@}
0065 
0066     //!@{
0067     //! \name Material data
0068     std::vector<ImportIsotope> isotopes;
0069     std::vector<ImportElement> elements;
0070     std::vector<ImportGeoMaterial> geo_materials;
0071     std::vector<ImportPhysMaterial> phys_materials;
0072     //!@}
0073 
0074     //!@{
0075     //! \name Spatial region data
0076     std::vector<ImportVolume> volumes;
0077     //!@}
0078 
0079     //!@{
0080     //! \name Physics data
0081     std::vector<inp::Particle> particles;
0082     std::vector<ImportProcess> processes;
0083     std::vector<ImportMscModel> msc_models;
0084     //!@}
0085 
0086     //!@{
0087     //! \name Physics configuration options
0088     ImportEmParameters em_params;
0089     ImportTransParameters trans_params;
0090     //!@}
0091 
0092     //!@{
0093     //! \name Optical data
0094     std::vector<ImportOpticalMaterial> optical_materials;
0095     //!@}
0096 
0097     //! Unit system of the stored data: "cgs", "clhep", or "si"
0098     std::string units;
0099 
0100     //!@{
0101     //! \name Current \c inp::Problem data that has been ported
0102 
0103     // Models
0104     inp::LivermorePhotoModel livermore_photo;
0105     inp::MuPairProductionModel mu_production;
0106     inp::SeltzerBergerModel seltzer_berger;
0107 
0108     // Processes
0109     inp::AtomicRelaxation atomic_relaxation;
0110 
0111     // Physics groups
0112     inp::OpticalPhysics optical_physics;  //! DISABLE ROOT
0113 
0114     // Muon-catalyzed fusion
0115     inp::MucfPhysics mucf_physics;
0116     //!@}
0117 };
0118 
0119 //---------------------------------------------------------------------------//
0120 // FREE FUNCTIONS
0121 //---------------------------------------------------------------------------//
0122 
0123 // Recursively convert imported data to the native unit type
0124 void convert_to_native(ImportData* data);
0125 
0126 // Whether an imported model of the given class is present
0127 bool has_model(ImportData const&, ImportModelClass);
0128 
0129 // Whether an imported MSC model of the given class is present
0130 bool has_msc_model(ImportData const&, ImportModelClass);
0131 
0132 //---------------------------------------------------------------------------//
0133 }  // namespace celeritas