Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:22

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 "celeritas/inp/Grid.hh"
0012 // IWYU pragma: begin_exports
0013 #include "ImportAtomicRelaxation.hh"
0014 #include "ImportElement.hh"
0015 #include "ImportLivermorePE.hh"
0016 #include "ImportMaterial.hh"
0017 #include "ImportMuPairProductionTable.hh"
0018 #include "ImportOpticalMaterial.hh"
0019 #include "ImportOpticalModel.hh"
0020 #include "ImportParameters.hh"
0021 #include "ImportParticle.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 struct ImportData
0055 {
0056     //!@{
0057     //! \name Type aliases
0058     using ZInt = int;
0059     using GeoMatIndex = unsigned int;
0060     using ImportSBMap = std::map<ZInt, inp::TwodGrid>;
0061     using ImportLivermorePEMap = std::map<ZInt, ImportLivermorePE>;
0062     using ImportAtomicRelaxationMap = std::map<ZInt, ImportAtomicRelaxation>;
0063     using ImportNeutronElasticMap = std::map<ZInt, inp::Grid>;
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<ImportRegion> regions;
0077     std::vector<ImportVolume> volumes;
0078     //!@}
0079 
0080     //!@{
0081     //! \name Physics data
0082     std::vector<ImportParticle> particles;
0083     std::vector<ImportProcess> processes;
0084     std::vector<ImportMscModel> msc_models;
0085     ImportSBMap sb_data;
0086     ImportLivermorePEMap livermore_pe_data;
0087     ImportNeutronElasticMap neutron_elastic_data;
0088     ImportAtomicRelaxationMap atomic_relaxation_data;
0089     ImportMuPairProductionTable mu_pair_production_data;
0090     //!@}
0091 
0092     //!@{
0093     //! \name Physics configuration options
0094     ImportEmParameters em_params;
0095     ImportTransParameters trans_params;
0096     //!@}
0097 
0098     //!@{
0099     //! \name Optical data
0100     ImportOpticalParameters optical_params;
0101     std::vector<ImportOpticalModel> optical_models;
0102     std::vector<ImportOpticalMaterial> optical_materials;
0103     //!@}
0104 
0105     //! Unit system of the stored data: "cgs", "clhep", or "si"
0106     std::string units;
0107 };
0108 
0109 //---------------------------------------------------------------------------//
0110 // FREE FUNCTIONS
0111 //---------------------------------------------------------------------------//
0112 
0113 // Recursively convert imported data to the native unit type
0114 void convert_to_native(ImportData* data);
0115 
0116 // Whether an imported model of the given class is present
0117 bool has_model(ImportData const&, ImportModelClass);
0118 
0119 // Whether an imported MSC model of the given class is present
0120 bool has_msc_model(ImportData const&, ImportModelClass);
0121 
0122 //---------------------------------------------------------------------------//
0123 }  // namespace celeritas