Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 << 25 // >> 26 // >> 27 // 26 ////////////////////////////////////////////// 28 //////////////////////////////////////////////////////////////////////// 27 // 29 // 28 // class G4MaterialPropertiesTable 30 // class G4MaterialPropertiesTable 29 // 31 // 30 // Class description: 32 // Class description: 31 // 33 // 32 // A Material properties table is a hash table 34 // A Material properties table is a hash table, with 33 // key = property name, and value either G4dou 35 // key = property name, and value either G4double or 34 // G4MaterialPropertyVector 36 // G4MaterialPropertyVector 35 // << 37 36 // File: G4MaterialPropertiesTable.hh 38 // File: G4MaterialPropertiesTable.hh 37 // Version: 1.0 39 // Version: 1.0 38 // Created: 1996-02-08 40 // Created: 1996-02-08 39 // Author: Juliet Armstrong 41 // Author: Juliet Armstrong 40 // Updated: 2005-05-12 add SetGROUPVEL() b 42 // Updated: 2005-05-12 add SetGROUPVEL() by P. Gumplinger 41 // 2002-11-05 add named material 43 // 2002-11-05 add named material constants by P. Gumplinger 42 // 1999-11-05 Migration from G4RW 44 // 1999-11-05 Migration from G4RWTPtrHashDictionary to STL 43 // by John Allison 45 // by John Allison 44 // 1999-10-29 add method and clas 46 // 1999-10-29 add method and class descriptors 45 // 1997-03-25 by Peter Gumplinger 47 // 1997-03-25 by Peter Gumplinger 46 // > cosmetics (only) 48 // > cosmetics (only) 47 // 49 // 48 ////////////////////////////////////////////// 50 //////////////////////////////////////////////////////////////////////// 49 51 50 #ifndef G4MaterialPropertiesTable_h 52 #ifndef G4MaterialPropertiesTable_h 51 #define G4MaterialPropertiesTable_h 1 53 #define G4MaterialPropertiesTable_h 1 52 54 >> 55 #include "globals.hh" 53 #include "G4MaterialPropertiesIndex.hh" 56 #include "G4MaterialPropertiesIndex.hh" 54 #include "G4MaterialPropertyVector.hh" 57 #include "G4MaterialPropertyVector.hh" 55 #include "globals.hh" << 56 58 57 #include <vector> 59 #include <vector> 58 60 59 class G4MaterialPropertiesTable 61 class G4MaterialPropertiesTable 60 { 62 { 61 public: 63 public: 62 G4MaterialPropertiesTable(); 64 G4MaterialPropertiesTable(); 63 virtual ~G4MaterialPropertiesTable(); 65 virtual ~G4MaterialPropertiesTable(); 64 66 >> 67 void AddConstProperty(const G4String& key, G4double propertyValue, >> 68 G4bool createNewKey = false); >> 69 void AddConstProperty(const char* key, G4double propertyValue, >> 70 G4bool createNewKey = false); 65 // Add a new property to the table by giving 71 // Add a new property to the table by giving a key-name and value 66 void AddConstProperty(const G4String& key, G << 67 void AddConstProperty(const char* key, G4dou << 68 72 >> 73 G4MaterialPropertyVector* AddProperty( >> 74 const G4String& key, const std::vector<G4double>& photonEnergies, >> 75 const std::vector<G4double>& propertyValues, G4bool createNewKey = false, >> 76 G4bool spline = false); 69 // Add a new property to the table by giving 77 // Add a new property to the table by giving a key-name and 70 // vectors of values 78 // vectors of values 71 G4MaterialPropertyVector* AddProperty(const << 72 const std::vector<G4double>& photonEnergie << 73 G4bool createNewKey = false, G4bool spline << 74 79 >> 80 G4MaterialPropertyVector* AddProperty( >> 81 const char* key, G4double* photonEnergies, G4double* propertyValues, >> 82 G4int numEntries, G4bool createNewKey = false, G4bool spline = false); 75 // Add a new property to the table by giving 83 // Add a new property to the table by giving a key-name and the 76 // arrays x and y of size NumEntries. 84 // arrays x and y of size NumEntries. 77 G4MaterialPropertyVector* AddProperty(const << 78 G4double* propertyValues, G4int numEntries << 79 85 >> 86 void AddProperty(const G4String& key, G4MaterialPropertyVector* opv, >> 87 G4bool createNewKey = false); >> 88 void AddProperty(const char* key, G4MaterialPropertyVector* opv, >> 89 G4bool createNewKey = false); 80 // Add a new property to the table by giving 90 // Add a new property to the table by giving a key-name and an 81 // already constructed G4MaterialPropertyVec 91 // already constructed G4MaterialPropertyVector. 82 void AddProperty(const G4String& key, G4Mate << 83 void AddProperty(const char* key, G4Material << 84 92 >> 93 void AddProperty(const G4String& key, const G4String& mat); 85 // Add a new property to the table by giving 94 // Add a new property to the table by giving a key name and a material 86 // name. Properties are in namespace G4Optic 95 // name. Properties are in namespace G4OpticalMaterialProperties 87 // Not possible to create a new key with thi 96 // Not possible to create a new key with this method. 88 void AddProperty(const G4String& key, const << 89 97 90 // Remove a constant property from the table << 91 void RemoveConstProperty(const G4String& key 98 void RemoveConstProperty(const G4String& key); 92 void RemoveConstProperty(const char* key); 99 void RemoveConstProperty(const char* key); >> 100 // Remove a constant property from the table. 93 101 94 // Remove a property from the table. << 95 void RemoveProperty(const G4String& key); 102 void RemoveProperty(const G4String& key); 96 void RemoveProperty(const char* key); 103 void RemoveProperty(const char* key); >> 104 // Remove a property from the table. 97 105 98 // Get a constant property from the table << 99 // It is an error to ask for a const propert << 100 // Check if it has been defined with ConstP << 101 G4double GetConstProperty(const G4String& ke 106 G4double GetConstProperty(const G4String& key) const; 102 G4double GetConstProperty(const char* key) c 107 G4double GetConstProperty(const char* key) const; 103 G4double GetConstProperty(const G4int index) 108 G4double GetConstProperty(const G4int index) const; >> 109 // Get a constant property from the table >> 110 // It is an error to ask for a const property that the user has not defined. >> 111 // Check if it has been defined with ConstPropertyExists() first. 104 112 >> 113 G4bool ConstPropertyExists(const G4String& key) const; >> 114 G4bool ConstPropertyExists(const char* key) const; >> 115 G4bool ConstPropertyExists(const G4int index) const; 105 // Return true if a const property has been 116 // Return true if a const property has been defined by the user. 106 // Despite the name, this returns false for 117 // Despite the name, this returns false for a const property in 107 // GetMaterialConstPropertyNames() but not 118 // GetMaterialConstPropertyNames() but not defined by user. 108 // Use this method before calling GetConstPr 119 // Use this method before calling GetConstProperty(). 109 G4bool ConstPropertyExists(const G4String& k << 110 G4bool ConstPropertyExists(const char* key) << 111 G4bool ConstPropertyExists(const G4int index << 112 120 113 // Get the property from the table correspon << 114 // nullptr is returned if the property has n << 115 G4MaterialPropertyVector* GetProperty(const 121 G4MaterialPropertyVector* GetProperty(const char* key) const; 116 G4MaterialPropertyVector* GetProperty(const 122 G4MaterialPropertyVector* GetProperty(const G4String& key) const; 117 G4MaterialPropertyVector* GetProperty(const 123 G4MaterialPropertyVector* GetProperty(const G4int index) const; >> 124 // Get the property from the table corresponding to the key-index or index. >> 125 // nullptr is returned if the property has not been defined by the user. 118 126 >> 127 void AddEntry(const G4String& key, G4double aPhotonEnergy, >> 128 G4double aPropertyValue); >> 129 void AddEntry(const char* key, G4double aPhotonEnergy, >> 130 G4double aPropertyValue); 119 // Add a new entry (pair of numbers) to the 131 // Add a new entry (pair of numbers) to the table for a given key. 120 void AddEntry(const G4String& key, G4double << 121 void AddEntry(const char* key, G4double aPho << 122 132 >> 133 G4int GetConstPropertyIndex(const G4String& key) const; 123 // Get the constant property index from the 134 // Get the constant property index from the key-name 124 // It is an error to request the index of a 135 // It is an error to request the index of a non-existent key (key not 125 // present in fMaterialConstPropertyNames() 136 // present in fMaterialConstPropertyNames()). 126 G4int GetConstPropertyIndex(const G4String& << 127 137 >> 138 G4int GetPropertyIndex(const G4String& key) const; 128 // Get the property index by the key-name. 139 // Get the property index by the key-name. 129 // It is an error to request the index of a 140 // It is an error to request the index of a non-existent key (key not 130 // present in GetMaterialPropertyNames()). 141 // present in GetMaterialPropertyNames()). 131 G4int GetPropertyIndex(const G4String& key) << 132 142 133 // print the material properties and materia << 134 void DumpTable() const; 143 void DumpTable() const; >> 144 // print the material properties and material constant properties 135 145 136 // the next four methods are used in persist 146 // the next four methods are used in persistency/GDML: 137 const std::vector<G4String>& GetMaterialProp << 147 const std::vector<G4String>& GetMaterialPropertyNames() const 138 const std::vector<G4String>& GetMaterialCons << 148 { >> 149 return fMatPropNames; >> 150 } >> 151 const std::vector<G4String>& GetMaterialConstPropertyNames() const >> 152 { >> 153 return fMatConstPropNames; >> 154 } >> 155 const std::vector<G4MaterialPropertyVector*>& GetProperties() const >> 156 { >> 157 return fMP; >> 158 } >> 159 const std::vector<std::pair<G4double, G4bool>>& GetConstProperties() >> 160 const >> 161 { >> 162 return fMCP; >> 163 } 139 // return references to the vectors of mater 164 // return references to the vectors of material (constant) properties. 140 const std::vector<G4MaterialPropertyVector*> << 141 const std::vector<std::pair<G4double, G4bool << 142 165 143 private: 166 private: 144 // Calculate the group velocity based on RIN << 145 G4MaterialPropertyVector* CalculateGROUPVEL( 167 G4MaterialPropertyVector* CalculateGROUPVEL(); >> 168 // Calculate the group velocity based on RINDEX 146 169 147 // Vector of pointer to material property ve << 148 // All entries are initialized to nullptr. << 149 // Order of entries in MP defined by enum in << 150 std::vector<G4MaterialPropertyVector*> fMP; 170 std::vector<G4MaterialPropertyVector*> fMP; >> 171 // Vector of pointer to material property vectors. All entries are >> 172 // initialized to nullptr. Pointer is not null when mat.prop. vector defined. >> 173 // Order of entries in MP defined by enum in G4MaterialPropertiesIndex. 151 174 >> 175 std::vector<std::pair<G4double, G4bool>> fMCP; 152 // Vector of energy-independent (i.e., "cons 176 // Vector of energy-independent (i.e., "constant") material properties. We 153 // need to keep track if a property is defin 177 // need to keep track if a property is defined or not: the bool in the pair 154 // is 'true' if the property is defined. 178 // is 'true' if the property is defined. 155 // Order of entries in MCP defined by enum i 179 // Order of entries in MCP defined by enum in G4MaterialPropertiesIndex. 156 std::vector<std::pair<G4double, G4bool>> fMC << 157 180 158 std::vector<G4String> fMatPropNames; // vec << 181 std::vector<G4String> fMatPropNames; 159 std::vector<G4String> fMatConstPropNames; / << 182 std::vector<G4String> fMatConstPropNames; >> 183 // vectors of strings of property names 160 }; 184 }; 161 185 162 #endif /* G4MaterialPropertiesTable_h */ 186 #endif /* G4MaterialPropertiesTable_h */ 163 187