ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MaterialPropertiesTable.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4MaterialPropertiesTable.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
29 //
30 // class G4MaterialPropertiesTable
31 //
32 // Class description:
33 //
34 // A Material properties table is a hash table, with
35 // key = property name, and value either G4double or
36 // G4MaterialPropertyVector
37 
38 // File: G4MaterialPropertiesTable.hh
39 // Version: 1.0
40 // Created: 1996-02-08
41 // Author: Juliet Armstrong
42 // Updated: 2005-05-12 add SetGROUPVEL() by P. Gumplinger
43 // 2002-11-05 add named material constants by P. Gumplinger
44 // 1999-11-05 Migration from G4RWTPtrHashDictionary to STL
45 // by John Allison
46 // 1999-10-29 add method and class descriptors
47 // 1997-03-25 by Peter Gumplinger
48 // > cosmetics (only)
49 // mail: gum@triumf.ca
50 //
52 
53 #ifndef G4MaterialPropertiesTable_h
54 #define G4MaterialPropertiesTable_h 1
55 
57 // Includes
59 
60 #include <cmath>
61 #include <map>
62 #include "globals.hh"
65 
67 // Class Definition
69 
71 {
72  public: // Without description
73 
76 
77  public: // With description
78 
79  inline void AddConstProperty(const char *key,
80  G4double PropertyValue);
81  // Add a new property to the table by giving a key-name and value
82 
83  G4MaterialPropertyVector* AddProperty(const char *key,
84  G4double *PhotonEnergies,
85  G4double *PropertyValues,
86  G4int NumEntries);
87  // Add a new property to the table by giving a key-name and the
88  // arrays x and y of size NumEntries.
89 
90  void AddProperty(const char *key, G4MaterialPropertyVector *opv);
91  // Add a new property to the table by giving a key-name and an
92  // already constructed G4MaterialPropertyVector.
93 
94  inline void RemoveConstProperty(const char *key);
95  // Remove a constant property from the table.
96 
97  inline void RemoveProperty(const char *key);
98  // Remove a property from the table.
99 
100  G4double GetConstProperty(const char *key) const;
101  // Get the constant property from the table corresponding to the key-name
102 
103  G4double GetConstProperty(const G4int index) const;
104  // Get the constant property from the table corresponding to the key-index
105 
106  G4bool ConstPropertyExists(const char *key) const;
107  // Return true if a const property 'key' exists.
108 
109  G4MaterialPropertyVector* GetProperty(const char *key,
110  G4bool warning=false);
111  // Get the property from the table corresponding to the key-name.
112 
114  G4bool warning=false);
115  // Get the property from the table corresponding to the key-index.
116 
117  void AddEntry(const char *key, G4double aPhotonEnergy,
118  G4double aPropertyValue);
119  // Add a new entry (pair of numbers) to the table for a given key.
120 
122  G4bool warning=false) const;
123  // Get the constant property index from the key-name
124 
125  G4int GetPropertyIndex(const G4String& key, G4bool warning=false) const;
126  // Get the property index by the key-name.
127 
128  std::vector<G4String> GetMaterialPropertyNames() const;
129  std::vector<G4String> GetMaterialConstPropertyNames() const;
130 
131  void DumpTable();
132 
133  public: // without description
134 
135  std::map< G4String, G4MaterialPropertyVector*, std::less<G4String> >*
136  GetPropertiesMap();
137  std::map< G4String, G4double, std::less<G4String> >*
139 
140  const std::map<G4int, G4MaterialPropertyVector*, std::less<G4int> >*
141  GetPropertyMap() const { return &MP; }
142  const std::map<G4int, G4double, std::less<G4int> >*
143  GetConstPropertyMap() const { return &MCP; }
144  // Accessors required for persistency purposes
145 
146  private:
147 
149  // Calculate the group velocity based on RINDEX
150 
152  // Dummy method: will be obsolete from the next (version 11) release
153 
154  private:
155 
156  std::map<G4String, G4MaterialPropertyVector*, std::less<G4String> > MPT;
157  typedef std::map< G4String, G4MaterialPropertyVector*,
158  std::less<G4String> >::const_iterator MPTiterator;
159 
160  std::map< G4String, G4double, std::less<G4String> > MPTC;
161  typedef std::map< G4String, G4double,
162  std::less<G4String> >::const_iterator MPTCiterator;
163  // MPT and MPTC will be obsolete when associate public interfaces,
164  // GetPropertiesMap and GetPropertiesCMap are removed from the version 11.
165 
166  std::map<G4int, G4MaterialPropertyVector*, std::less<G4int> > MP;
167  typedef std::map< G4int, G4MaterialPropertyVector*,
168  std::less<G4int> >::const_iterator MPiterator;
169 
170  std::map< G4int, G4double, std::less<G4int> > MCP;
171  typedef std::map< G4int, G4double,
172  std::less<G4int> >::const_iterator MCPiterator;
173  //material property map and constant property map by index types
174 
175  std::vector<G4String> G4MaterialPropertyName;
176  std::vector<G4String> G4MaterialConstPropertyName;
177  // vectors of strings of property names
178 
179 };
180 
182 // Inline definitions
184 
185 #include "G4MaterialPropertiesTable.icc"
186 
187 #endif /* G4MaterialPropertiesTable_h */