|
||||
File indexing completed on 2025-01-18 09:58:08
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 // Author: Mathieu Karamitros 0028 // 0029 // We would be very happy hearing from you, send us your feedback! :) 0030 // 0031 // In order for Geant4-DNA to be maintained and still open-source, 0032 // article citations are crucial. 0033 // If you use Geant4-DNA chemistry and you publish papers about your software, 0034 // in addition to the general paper on Geant4-DNA: 0035 // 0036 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178 0037 // 0038 // we would be very happy if you could please also cite the following 0039 // reference papers on chemistry: 0040 // 0041 // J. Comput. Phys. 274 (2014) 841-882 0042 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508 0043 0044 #ifndef G4DNAMolecularMaterial_HH 0045 #define G4DNAMolecularMaterial_HH 0046 0047 #include "globals.hh" 0048 #include "G4ios.hh" 0049 #include <map> 0050 #include <vector> 0051 #include "G4VStateDependent.hh" 0052 0053 class G4Material; 0054 class G4MolecularConfiguration; 0055 0056 /** 0057 * \struct CompareMaterial 0058 * \brief Materials can be described as a derivation of existing "parent" 0059 * materials in order to alter few of their features, such as density. 0060 * \p CompareMaterial compare materials taking into account 0061 * their possible "affiliation". 0062 */ 0063 struct CompareMaterial 0064 { 0065 bool operator()(const G4Material* mat1, const G4Material* mat2) const; 0066 }; 0067 0068 using ComponentMap = std::map<const G4Material*, G4double, CompareMaterial>; 0069 0070 /** 0071 * \class G4DNAMolecularMaterial 0072 * \brief G4DNAMolecularMaterial builds tables of molecular densities for chosen 0073 * molecular materials. The class handles homogeneous, composite and 0074 * derived materials. A material of interest is labeled as molecular if built 0075 * using the number of atoms rather than the mass fractions. 0076 * 0077 * \details 0078 * - Initialization: 0079 * G4DNAMolecularMaterial is initialized when 0080 * G4ApplicationState == G4State_Idle. 0081 * It should be initialized on the master thread and used in read-only mode 0082 * during stepping. The singleton is thread-shared. 0083 * 0084 * - For Developers: 0085 * Use GetNumMolPerVolTableFor(molecule) in the concrete implementation of 0086 * G4VEmModel::Initialise or G4VProcess::PreparePhysicsTable 0087 * at run initialization to retrieve a read-only, thread-safe, table. 0088 * The table is then built on the master thread at initialization time and 0089 * shared between all threads and models. 0090 * 0091 * \note A G4material is labeled as molecular if built using the number of atoms 0092 * 0093 */ 0094 0095 class G4DNAMolecularMaterial: public G4VStateDependent 0096 { 0097 public: 0098 G4DNAMolecularMaterial(const G4DNAMolecularMaterial& right) = delete; 0099 G4DNAMolecularMaterial& operator=(const G4DNAMolecularMaterial&) = delete; 0100 0101 static G4DNAMolecularMaterial* Instance(); 0102 void Initialize(); 0103 void Clear(); 0104 0105 G4bool Notify(G4ApplicationState requestedState) override; 0106 0107 //---------------------------------------------------------------------------- 0108 0109 /** 0110 * \fn const std::vector<G4double>* \ 0111 * GetDensityTableFor(const G4Material* searchedMaterial) const 0112 * \brief Retrieve a table of volumetric mass densities (mass per unit volume) 0113 * in the G4 unit system for chosen material. 0114 * 0115 * @param[in] searchedMaterial 0116 * The material which you'd like to retrieve the volumic mass 0117 * @pre The \p searchedMaterial used in parameter must be built as a 0118 * molecular material, using the number of atoms rather than the density 0119 * fractions. 0120 * \return 0121 * Pointer to a table of molecular densities for the \p searchedMaterial 0122 * indexed on the (parent) material index. 0123 * 0124 */ 0125 const std::vector<G4double>* GetDensityTableFor(const G4Material*) const; 0126 0127 /** 0128 * \fn const std::vector<G4double>* \ 0129 * GetNumMolPerVolTableFor(const G4Material* searchedMaterial) const 0130 * \brief Retrieve a table of molecular densities (number of molecules per 0131 * unit volume) in the G4 unit system for chosen material. 0132 * 0133 * @param[in] searchedMaterial 0134 * The material which you'd like to retrieve the molecular density 0135 * @pre The \p searchedMaterial used in parameter must be built as a 0136 * molecular material, using the number of atoms rather than the density 0137 * fractions. 0138 * \return 0139 * Pointer to a table of molecular densities for the \p searchedMaterial 0140 * indexed on the (parent) material index. 0141 */ 0142 const std::vector<G4double>* GetNumMolPerVolTableFor(const G4Material*) const; 0143 0144 inline const std::vector<ComponentMap>* GetMassFractionTable() const{ 0145 return fpCompFractionTable; 0146 } 0147 inline const std::vector<ComponentMap>* GetDensityTable() const{ 0148 return fpCompDensityTable; 0149 } 0150 0151 //---------------------------------------------------------------------------- 0152 0153 G4MolecularConfiguration* GetMolecularConfiguration(const G4Material*) const; 0154 0155 /** 0156 * \fn void SetMolecularConfiguration(const G4Material* material, \ 0157 * G4MolecularConfiguration* molConf) 0158 * \brief Associate a molecular configuration to a G4material. 0159 * 0160 * @param[in] material 0161 * Pointer to a G4 material. The material 0162 * does not need to be defined as a molecular material. 0163 * @param[in] molConf 0164 * The molecular configuration corresponding to 0165 * the G4 \p material. 0166 */ 0167 void SetMolecularConfiguration(const G4Material*, 0168 G4MolecularConfiguration*); 0169 0170 /** 0171 * \fn void SetMolecularConfiguration(const G4Material* material, \ 0172 * const G4String& molConf) 0173 * \brief Associate a molecular configuration to a G4material. 0174 * 0175 * @param[in] material 0176 * Pointer to a G4 material. The material 0177 * does not need to be defined as a molecular material. 0178 * @param[in] molConf 0179 * User ID of the molecular configuration corresponding to 0180 * the G4 \p material. 0181 */ 0182 void SetMolecularConfiguration(const G4Material*, 0183 const G4String&); 0184 0185 /** 0186 * \fn void SetMolecularConfiguration(const G4Material* material, \ 0187 * const G4String& molConf) 0188 * \brief Associate a molecular configuration to a G4material. 0189 * 0190 * @param[in] material 0191 * Name of the G4 material. The material 0192 * does not need to be defined as a molecular material. 0193 * @param[in] molConf 0194 * User ID of the molecular configuration corresponding to 0195 * the G4 \p material. 0196 */ 0197 void SetMolecularConfiguration(const G4String& materialName, 0198 const G4String& molUserIF); 0199 0200 //---------------------------------------------------------------------------- 0201 0202 /** 0203 * \brief Deprecated 0204 * \deprecated Will return a G4 fatal exception. 0205 * Use instead GetNumMolPerVolTableFor(molecule) at run 0206 * initialization to retrieve a read-only, thread-safe, table. 0207 * \note A G4material is labeled as molecular if built using 0208 * the number of atoms. 0209 */ 0210 G4double GetNumMoleculePerVolumeUnitForMaterial(const G4Material *mat); 0211 0212 /** 0213 * \brief Deprecated 0214 * \deprecated Will return a G4 fatal exception. 0215 * Use instead GetNumMolPerVolTableFor(molecule) at run 0216 * initialization to retrieve a read-only, thread-safe, table. 0217 * \note A G4material is labeled as molecular if built using 0218 * the number of atoms. 0219 */ 0220 G4double GetNumMolPerVolForComponentInComposite(const G4Material *composite, 0221 const G4Material *component, 0222 G4double massFraction); 0223 0224 protected: 0225 static G4DNAMolecularMaterial* fInstance; 0226 G4DNAMolecularMaterial(); 0227 ~G4DNAMolecularMaterial() override; 0228 void Create(); 0229 void InitializeNumMolPerVol(); 0230 void InitializeDensity(); 0231 void RecordMolecularMaterial(G4Material* parentMaterial, 0232 G4Material* molecularMaterial, 0233 G4double fraction); 0234 void SearchMolecularMaterial(G4Material* parentMaterial, 0235 G4Material* material, 0236 G4double currentFraction); 0237 0238 void AddMaterial(const G4Material*, G4double fraction); 0239 0240 void PrintNotAMolecularMaterial(const char* methodName, 0241 const G4Material* lookForMaterial) const; 0242 0243 // Tables built for all molecular materials at initialization 0244 std::vector<ComponentMap>* fpCompFractionTable; 0245 std::vector<ComponentMap>* fpCompDensityTable; 0246 std::vector<ComponentMap>* fpCompNumMolPerVolTable; 0247 0248 mutable std::map<const G4Material*, std::vector<G4double>*, CompareMaterial> 0249 fAskedDensityTable; 0250 mutable std::map<const G4Material*, std::vector<G4double>*, CompareMaterial> 0251 fAskedNumPerVolTable; 0252 mutable std::map<const G4Material*, G4bool, CompareMaterial> fWarningPrinted; 0253 0254 std::map<G4int /*Material ID*/, 0255 G4MolecularConfiguration*> fMaterialToMolecularConf; 0256 0257 G4bool fIsInitialized; 0258 std::size_t fNMaterials; 0259 }; 0260 0261 #endif // G4DNAMolecularMaterial_HH
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |