![]() |
|
|||
File indexing completed on 2025-02-22 10:31:24
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 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/ImportOpticalMaterial.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <map> 0011 #include <vector> 0012 0013 #include "ImportPhysicsVector.hh" 0014 #include "ImportUnits.hh" 0015 0016 namespace celeritas 0017 { 0018 //---------------------------------------------------------------------------// 0019 /*! 0020 * Store basic properties for different scintillation component types. 0021 * 0022 * Fast/intermediate/slow/etc scintillation components can be used for both 0023 * particle- and material-dependent spectra, as well as material-only spectra. 0024 */ 0025 struct ImportScintComponent 0026 { 0027 double yield_frac{}; //!< Fraction of total scintillation yield 0028 double lambda_mean{}; //!< Mean wavelength [len] 0029 double lambda_sigma{}; //!< Standard deviation of wavelength 0030 double rise_time{}; //!< Rise time [time] 0031 double fall_time{}; //!< Decay time [time] 0032 0033 //! Whether all data are assigned and valid 0034 explicit operator bool() const 0035 { 0036 return yield_frac > 0 && lambda_mean > 0 && lambda_sigma > 0 0037 && rise_time >= 0 && fall_time > 0; 0038 } 0039 }; 0040 0041 //---------------------------------------------------------------------------// 0042 /*! 0043 * Store material-only scintillation spectrum information. 0044 * TODO: Components are not necessary in Geant4, but are in our generator. 0045 */ 0046 struct ImportMaterialScintSpectrum 0047 { 0048 double yield_per_energy{}; //!< Light yield of the material [1/MeV] 0049 std::vector<ImportScintComponent> components; //!< Scintillation 0050 //!< components 0051 0052 //! Whether all data are assigned and valid 0053 explicit operator bool() const 0054 { 0055 return yield_per_energy > 0 && !components.empty(); 0056 } 0057 }; 0058 0059 //---------------------------------------------------------------------------// 0060 /*! 0061 * Store per-particle material scintillation spectrum information. 0062 * 0063 * The yield vector is the only necessary element, needed to calculate the 0064 * yield based on the particle energy-loss during the stepping loop. 0065 * Components may not be assigned---they are the equivalent of 0066 * \c k[Particle]ScintillationYield[i] in \c G4MaterialPropertiesIndex.hh 0067 */ 0068 struct ImportParticleScintSpectrum 0069 { 0070 static constexpr auto x_units{ImportUnits::mev}; 0071 static constexpr auto y_units{ImportUnits::unitless}; 0072 0073 ImportPhysicsVector yield_vector; //!< Particle yield per energy bin 0074 std::vector<ImportScintComponent> components; //!< Scintillation 0075 //!< components 0076 0077 //! Whether all data are assigned and valid 0078 explicit operator bool() const 0079 { 0080 return yield_vector 0081 && yield_vector.vector_type == ImportPhysicsVectorType::free; 0082 } 0083 }; 0084 0085 //---------------------------------------------------------------------------// 0086 /*! 0087 * Store optical properties for scintillation. 0088 */ 0089 struct ImportScintData 0090 { 0091 using PDGint = int; 0092 using IPSS = ImportParticleScintSpectrum; 0093 0094 ImportMaterialScintSpectrum material; //!< Material scintillation data 0095 std::map<PDGint, IPSS> particles; //!< Particle scintillation data 0096 double resolution_scale{}; //!< Scales the stdev of photon distribution 0097 0098 //! Whether all data are assigned and valid 0099 explicit operator bool() const 0100 { 0101 return (static_cast<bool>(material) || !particles.empty()) 0102 && resolution_scale >= 0; 0103 } 0104 }; 0105 0106 //---------------------------------------------------------------------------// 0107 /*! 0108 * Store optical material properties for Rayleigh scattering. 0109 * 0110 * The isothermal compressibility is used to calculate the Rayleigh mean free 0111 * path if no mean free paths are provided. 0112 */ 0113 struct ImportOpticalRayleigh 0114 { 0115 double scale_factor{1}; //!< Scale the scattering length (optional) 0116 double compressibility{}; //!< Isothermal compressibility 0117 0118 //! Whether all data are assigned and valid 0119 explicit operator bool() const 0120 { 0121 return scale_factor >= 0 && compressibility >= 0; 0122 } 0123 }; 0124 0125 //---------------------------------------------------------------------------// 0126 /*! 0127 * Store common optical material properties. 0128 */ 0129 struct ImportOpticalProperty 0130 { 0131 ImportPhysicsVector refractive_index; 0132 0133 //! Whether all data are assigned and valid 0134 explicit operator bool() const 0135 { 0136 return static_cast<bool>(refractive_index); 0137 } 0138 }; 0139 0140 //---------------------------------------------------------------------------// 0141 /*! 0142 * Store optical photon wavelength shifting properties. 0143 * 0144 * The component vector represents the relative population as a function of the 0145 * re-emission energy. It is used to define an inverse CDF needed to sample the 0146 * re-emitted optical photon energy. 0147 */ 0148 struct ImportWavelengthShift 0149 { 0150 double mean_num_photons{}; //!< Mean number of re-emitted photons 0151 double time_constant{}; //!< Time delay between absorption and re-emission 0152 ImportPhysicsVector component; //!< Re-emission population [MeV, unitless] 0153 0154 //! Whether all data are assigned and valid 0155 explicit operator bool() const 0156 { 0157 return mean_num_photons > 0 && time_constant > 0 0158 && static_cast<bool>(component); 0159 } 0160 }; 0161 0162 //---------------------------------------------------------------------------// 0163 /*! 0164 * Store optical material properties. 0165 * 0166 * \todo boolean for enabling cerenkov in the material?? 0167 */ 0168 struct ImportOpticalMaterial 0169 { 0170 ImportOpticalProperty properties; 0171 ImportScintData scintillation; 0172 0173 //!@{ 0174 //! \name Optical process data 0175 ImportOpticalRayleigh rayleigh; 0176 ImportWavelengthShift wls; 0177 //!@} 0178 0179 //! Whether minimal useful data is stored 0180 explicit operator bool() const { return static_cast<bool>(properties); } 0181 }; 0182 0183 //---------------------------------------------------------------------------// 0184 } // 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 |
![]() ![]() |