Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:24

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2021-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/io/ImportData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <vector>
0011 
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 "ImportSBTable.hh"
0024 #include "ImportVolume.hh"
0025 // IWYU pragma: end_exports
0026 
0027 namespace celeritas
0028 {
0029 //---------------------------------------------------------------------------//
0030 /*!
0031  * Store imported physics data from external sources.
0032  *
0033  * All the data imported to Celeritas is stored in this single entity. This
0034  * struct can be used in memory or recorded in a ROOT TBranch as a single TTree
0035  * entry, which will be read by \c RootImporter to load the data into
0036  * Celeritas. Currently, the TTree and TBranch names are hardcoded as \e
0037  * geant4_data and \e ImportData in \c RootImporter .
0038  *
0039  * Each entity's id is defined by its vector position. An \c ImportElement with
0040  * id = 3 is stored at \c elements[3] . The same is true for
0041  * geometry/physics/materials (all of which have an independent index!) and
0042  * volumes.
0043  *
0044  * Seltzer-Berger, Livermore PE, and atomic relaxation data are loaded based on
0045  * atomic numbers, and thus are stored in maps. To retrieve specific data use
0046  * \c find(atomic_number) .
0047  *
0048  * The unit system of the data is stored in the "units" string. If empty
0049  * (backward compatibility) or "cgs" the embedded contents are in CGS. If
0050  * "clhep" the units are CLHEP (the native Geant4 unit system). The \c
0051  * convert_to_native function will convert a data structure in place and update
0052  * the units label. Refer to \c base/Units.hh for further information on unit
0053  * systems.
0054  */
0055 struct ImportData
0056 {
0057     //!@{
0058     //! \name Type aliases
0059     using ZInt = int;
0060     using GeoMatIndex = unsigned int;
0061     using ImportSBMap = std::map<ZInt, ImportSBTable>;
0062     using ImportLivermorePEMap = std::map<ZInt, ImportLivermorePE>;
0063     using ImportAtomicRelaxationMap = std::map<ZInt, ImportAtomicRelaxation>;
0064     using ImportNeutronElasticMap = std::map<ZInt, ImportPhysicsVector>;
0065     //!@}
0066 
0067     //!@{
0068     //! \name Material data
0069     std::vector<ImportIsotope> isotopes;
0070     std::vector<ImportElement> elements;
0071     std::vector<ImportGeoMaterial> geo_materials;
0072     std::vector<ImportPhysMaterial> phys_materials;
0073     //!@}
0074 
0075     //!@{
0076     //! \name Spatial region data
0077     std::vector<ImportRegion> regions;
0078     std::vector<ImportVolume> volumes;
0079     //!@}
0080 
0081     //!@{
0082     //! \name Physics data
0083     std::vector<ImportParticle> particles;
0084     std::vector<ImportProcess> processes;
0085     std::vector<ImportMscModel> msc_models;
0086     ImportSBMap sb_data;
0087     ImportLivermorePEMap livermore_pe_data;
0088     ImportNeutronElasticMap neutron_elastic_data;
0089     ImportAtomicRelaxationMap atomic_relaxation_data;
0090     ImportMuPairProductionTable mu_pair_production_data;
0091     //!@}
0092 
0093     //!@{
0094     //! \name Physics configuration options
0095     ImportEmParameters em_params;
0096     ImportTransParameters trans_params;
0097     //!@}
0098 
0099     //!@{
0100     //! \name Optical data
0101     ImportOpticalParameters optical_params;
0102     std::vector<ImportOpticalModel> optical_models;
0103     std::vector<ImportOpticalMaterial> optical_materials;
0104     //!@}
0105 
0106     //! Unit system of the stored data: "cgs", "clhep", or "si"
0107     std::string units;
0108 };
0109 
0110 //---------------------------------------------------------------------------//
0111 // FREE FUNCTIONS
0112 //---------------------------------------------------------------------------//
0113 
0114 // Recursively convert imported data to the native unit type
0115 void convert_to_native(ImportData* data);
0116 
0117 // Whether an imported model of the given class is present
0118 bool has_model(ImportData const&, ImportModelClass);
0119 
0120 // Whether an imported MSC model of the given class is present
0121 bool has_msc_model(ImportData const&, ImportModelClass);
0122 
0123 //---------------------------------------------------------------------------//
0124 }  // namespace celeritas