Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4Material.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 // $Id: G4Material.hh 106243 2017-09-26 01:56:43Z gcosmo $
28 //
29 
30 //---------------------------------------------------------------------------
31 //
32 // ClassName: G4Material
33 //
34 // Description: Contains material properties
35 //
36 // Class description:
37 //
38 // Is used to define the material composition of Geant4 volumes.
39 // A G4Material is always made of G4Elements. It should has the name,
40 // the list of G4Elements, material density, material state, temperature,
41 // pressure. Other parameters are optional and may be set by the user code
42 // or computed at initialisation.
43 //
44 // There is several ways to construct G4Material:
45 // - from single element;
46 // - from a list of components (elements or other materials);
47 // - from internal Geant4 database of materials
48 //
49 // A collection of constituent Elements/Materials should be defined
50 // with specified weights by fractional mass or atom counts (only for Elements).
51 //
52 // Quantities, with physical meaning or not, which are constant in a given
53 // material are computed and stored here as Derived data members.
54 //
55 // The class contains as a private static member the Table of defined
56 // materials (an ordered vector of materials).
57 //
58 // It is strongly not recommended to delete materials in user code.
59 // All materials will be deleted automatically at the end of Geant4 session.
60 //
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
64 // 10-07-96, new data members added by L.Urban
65 // 12-12-96, new data members added by L.Urban
66 // 20-01-97, aesthetic rearrangement. RadLength calculation modified
67 // Data members Zeff and Aeff REMOVED (i.e. passed to the Elements).
68 // (local definition of Zeff in DensityEffect and FluctModel...)
69 // Vacuum defined as a G4State. Mixture flag removed, M.Maire
70 // 29-01-97, State=Vacuum automatically set density=0 in the contructors.
71 // Subsequent protections have been put in the calculation of
72 // MeanExcEnergy, ShellCorrectionVector, DensityEffect, M.Maire
73 // 20-03-97, corrected initialization of pointers, M.Maire
74 // 10-06-97, new data member added by V.Grichine (fSandiaPhotoAbsCof)
75 // 27-06-97, new function GetElement(int), M.Maire
76 // 24-02-98, fFractionVector become fMassFractionVector
77 // 28-05-98, kState=kVacuum removed:
78 // The vacuum is an ordinary gas vith very low density, M.Maire
79 // 12-06-98, new method AddMaterial() allowing mixture of materials, M.Maire
80 // 09-07-98, Ionisation parameters removed from the class, M.Maire
81 // 04-08-98, new method GetMaterial(materialName), M.Maire
82 // 05-10-98, change name: NumDensity -> NbOfAtomsPerVolume
83 // 18-11-98, SandiaTable interface modified.
84 // 19-07-99, new data member (chemicalFormula) added by V.Ivanchenko
85 // 12-03-01, G4bool fImplicitElement (mma)
86 // 30-03-01, suppression of the warning message in GetMaterial
87 // 17-07-01, migration to STL. M. Verderi.
88 // 14-09-01, Suppression of the data member fIndexInTable
89 // 31-10-01, new function SetChemicalFormula() (mma)
90 // 26-02-02, fIndexInTable renewed
91 // 06-08-02, remove constructors with ChemicalFormula (mma)
92 // 15-11-05, GetMaterial(materialName, G4bool warning=true)
93 // 13-04-12, std::map<G4Material*,G4double> fMatComponents (mma)
94 // 21-04-12, fMassOfMolecule (mma)
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 
98 #ifndef G4MATERIAL_HH
99 #define G4MATERIAL_HH 1
100 
101 #include <vector>
102 #include <map>
104 
105 #include "globals.hh"
106 #include "G4ios.hh"
107 #include "G4Element.hh"
109 #include "G4IonisParamMat.hh"
110 #include "G4SandiaTable.hh"
111 #include "G4ElementVector.hh"
112 #include "G4MaterialTable.hh"
113 #include "G4Threading.hh"
114 
116 
117 static const G4double NTP_Temperature = 293.15;
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
122 {
123 public: // with description
124  //
125  // Constructor to create a material from single element
126  //
127  G4Material(const G4String& name, //its name
128  G4double z, //atomic number
129  G4double a, //mass of mole
130  G4double density, //density
131  G4State state = kStateUndefined, //solid,gas
132  G4double temp = NTP_Temperature, //temperature
133  G4double pressure = CLHEP::STP_Pressure); //pressure
134 
135  //
136  // Constructor to create a material from a combination of elements
137  // and/or materials subsequently added via AddElement and/or AddMaterial
138  //
139  G4Material(const G4String& name, //its name
140  G4double density, //density
141  G4int nComponents, //nbOfComponents
142  G4State state = kStateUndefined, //solid,gas
143  G4double temp = NTP_Temperature, //temperature
144  G4double pressure = CLHEP::STP_Pressure); //pressure
145 
146  //
147  // Constructor to create a material from the base material
148  //
149  G4Material(const G4String& name, //its name
150  G4double density, //density
151  const G4Material* baseMaterial, //base material
152  G4State state = kStateUndefined, //solid,gas
153  G4double temp = NTP_Temperature, //temperature
154  G4double pressure = CLHEP::STP_Pressure); //pressure
155 
156  //
157  // Add an element, giving number of atoms
158  //
159  void AddElement(G4Element* element, //the element
160  G4int nAtoms); //nb of atoms in
161  // a molecule
162  //
163  // Add an element or material, giving fraction of mass
164  //
165  void AddElement (G4Element* element , //the element
166  G4double fraction); //fractionOfMass
167 
168  void AddMaterial(G4Material* material, //the material
169  G4double fraction); //fractionOfMass
170 
171 
172  virtual ~G4Material();
173 
174  inline void SetChemicalFormula (const G4String& chF) {fChemicalFormula=chF;}
175 
176  //
177  // retrieval methods
178  //
179  inline const G4String& GetName() const {return fName;}
180  inline const G4String& GetChemicalFormula() const {return fChemicalFormula;}
181  inline G4double GetDensity() const {return fDensity;}
182  inline G4State GetState() const {return fState;}
183  inline G4double GetTemperature() const {return fTemp;}
184  inline G4double GetPressure() const {return fPressure;}
185 
186  //number of elements constituing this material:
187  inline size_t GetNumberOfElements() const {return fNumberOfElements;}
188 
189  //vector of pointers to elements constituing this material:
190  inline const
192 
193  //vector of fractional mass of each element:
194  inline const
196 
197  //vector of atom count of each element:
198  inline const
199  G4int* GetAtomsVector() const {return fAtomsVector;}
200 
201  //return a pointer to an element, given its index in the material:
202  inline const
203  G4Element* GetElement(G4int iel) const {return (*theElementVector)[iel];}
204 
205  //vector of nb of atoms per volume of each element in this material:
206  inline const
208  //total number of atoms per volume:
209  inline
211  //total number of electrons per volume:
212  inline
214 
215  //obsolete names (5-10-98) see the 2 functions above
216  inline const
219 
220  // Radiation length:
221  inline G4double GetRadlen() const {return fRadlen;}
222 
223  // Nuclear interaction length
225 
226  // ionisation parameters:
227  inline G4IonisParamMat* GetIonisation() const {return fIonisation;}
228 
229  // Sandia table:
230  inline G4SandiaTable* GetSandiaTable() const {return fSandiaTable;}
231 
232  // Base material:
233  inline
234  const G4Material* GetBaseMaterial() const {return fBaseMaterial;}
235 
236  // material components:
237  inline
238  const std::map<G4Material*,G4double>& GetMatComponents() const
239  {return fMatComponents;}
240 
241  // for chemical compound
242  inline
244 
245  // meaningful only for single material:
246  G4double GetZ() const;
247  G4double GetA() const;
248 
249  //the MaterialPropertiesTable (if any) attached to this material:
251 
253  {return fMaterialPropertiesTable;}
254 
255  // the static Table of Materials:
256  //
258 
259  static size_t GetNumberOfMaterials();
260 
261  //the index of this material in the Table:
262  inline size_t GetIndex() const {return fIndexInTable;}
263 
264  //return pointer to a material, given its name:
265  static G4Material* GetMaterial(const G4String& name, G4bool warning=true);
266 
267  //
268  //printing methods
269  //
270  friend std::ostream& operator<<(std::ostream&, const G4Material*);
271  friend std::ostream& operator<<(std::ostream&, const G4Material&);
272  friend std::ostream& operator<<(std::ostream&, G4MaterialTable);
273 
274  G4Material(__void__&);
275  // Fake default constructor for usage restricted to direct object
276  // persistency for clients requiring preallocation of memory for
277  // persistifiable objects.
278 
279  inline void SetName (const G4String& name) {fName=name;}
280 
281  virtual G4bool IsExtended() const;
282 
283 private:
284 
285  // operators
286  G4int operator==(const G4Material&) const = delete;
287  G4int operator!=(const G4Material&) const = delete;
288  G4Material(const G4Material&) = delete;
289  const G4Material& operator=(const G4Material&) = delete;
290 
291  void InitializePointers();
292 
293  // Header routine for all derived quantities
295 
296  // Compute Radiation length
297  void ComputeRadiationLength();
298 
299  // Compute Nuclear interaction length
301 
302  // Copy pointers of base material
304 
305 private:
306 
307  //
308  // Basic data members ( To define a material)
309  //
310  G4String fName; // Material name
311  G4String fChemicalFormula; // Material chemical formula
312  G4double fDensity; // Material density
313 
314  G4State fState; // Material state (determined
315  // internally based on density)
316  G4double fTemp; // Temperature (defaults: STP)
317  G4double fPressure; // Pressure (defaults: STP)
318 
319  G4int maxNbComponents; // totalNbOfComponentsInTheMaterial
320  G4int fArrayLength; // the length of fAtomsVector
321  G4int fNumberOfComponents; // Nb of components declared so far
322 
323  G4int fNumberOfElements; // Nb of Elements in the material
324  G4ElementVector* theElementVector; // vector of constituent Elements
325  G4double* fMassFractionVector; // composition by fractional mass
326  G4int* fAtomsVector; // composition by atom count
327 
329 
330  static
331  G4MaterialTable theMaterialTable; // the material table
332  size_t fIndexInTable; // the position in the table
333 
334  //
335  // Derived data members (computed from the basic data members)
336  //
337  // some general atomic properties
338 
339  G4double* VecNbOfAtomsPerVolume; // vector of nb of atoms per volume
340  G4double TotNbOfAtomsPerVolume; // total nb of atoms per volume
341  G4double TotNbOfElectPerVolume; // total nb of electrons per volume
342  G4double fRadlen; // Radiation length
343  G4double fNuclInterLen; // Nuclear interaction length
344 
345  G4IonisParamMat* fIonisation; // ionisation parameters
346  G4SandiaTable* fSandiaTable; // Sandia table
347 
348  // utilities
349  //
350  const G4Material* fBaseMaterial; // Pointer to the base material
351  G4double fMassOfMolecule; // for materials built by atoms count
352  std::map<G4Material*,G4double> fMatComponents; // for composites built via
353  // AddMaterial()
354 #ifdef G4MULTITHREADED
355  static G4Mutex materialMutex;
356 #endif
357 };
358 
359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
360 
361 #endif
const XML_Char * name
Definition: expat.h:151
static G4MaterialTable theMaterialTable
Definition: G4Material.hh:331
G4double TotNbOfElectPerVolume
Definition: G4Material.hh:341
G4int * fAtomsVector
Definition: G4Material.hh:326
const G4double * GetFractionVector() const
Definition: G4Material.hh:195
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:600
void InitializePointers()
Definition: G4Material.cc:258
static const G4double NTP_Temperature
Definition: G4Material.hh:117
G4State fState
Definition: G4Material.hh:314
G4double fNuclInterLen
Definition: G4Material.hh:343
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
G4double * fMassFractionVector
Definition: G4Material.hh:325
std::map< G4Material *, G4double > fMatComponents
Definition: G4Material.hh:352
size_t GetIndex() const
Definition: G4Material.hh:262
void SetName(const G4String &name)
Definition: G4Material.hh:279
G4double fPressure
Definition: G4Material.hh:317
G4double GetRadlen() const
Definition: G4Material.hh:221
Double_t z
virtual ~G4Material()
Definition: G4Material.cc:238
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:191
G4int operator!=(const G4Material &) const =delete
G4double fRadlen
Definition: G4Material.hh:342
virtual G4bool IsExtended() const
Definition: G4Material.cc:725
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:207
G4SandiaTable * fSandiaTable
Definition: G4Material.hh:346
const G4Material & operator=(const G4Material &)=delete
G4int operator==(const G4Material &) const =delete
const G4int * GetAtomsVector() const
Definition: G4Material.hh:199
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:608
G4String fName
Definition: G4Material.hh:310
static constexpr double STP_Pressure
const G4String & GetName() const
Definition: G4Material.hh:179
G4double GetTotNbOfElectPerVolume() const
Definition: G4Material.hh:213
G4double GetA() const
Definition: G4Material.cc:642
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
Definition: G4Material.cc:730
const G4Material * fBaseMaterial
Definition: G4Material.hh:350
void ComputeNuclearInterLength()
Definition: G4Material.cc:573
const G4String & GetChemicalFormula() const
Definition: G4Material.hh:180
G4State GetState() const
Definition: G4Material.hh:182
G4String fChemicalFormula
Definition: G4Material.hh:311
G4double fTemp
Definition: G4Material.hh:316
G4IonisParamMat * fIonisation
Definition: G4Material.hh:345
G4double GetZ() const
Definition: G4Material.cc:629
size_t fIndexInTable
Definition: G4Material.hh:332
std::vector< G4Material * > G4MaterialTable
G4double TotNbOfAtomsPerVolume
Definition: G4Material.hh:340
void SetChemicalFormula(const G4String &chF)
Definition: G4Material.hh:174
G4double GetPressure() const
Definition: G4Material.hh:184
std::vector< G4Element * > G4ElementVector
int G4int
Definition: G4Types.hh:78
G4double fMassOfMolecule
Definition: G4Material.hh:351
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:368
void ComputeRadiationLength()
Definition: G4Material.cc:562
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:227
G4int fNumberOfComponents
Definition: G4Material.hh:321
G4SandiaTable * GetSandiaTable() const
Definition: G4Material.hh:230
G4double * VecNbOfAtomsPerVolume
Definition: G4Material.hh:339
G4ElementVector * theElementVector
Definition: G4Material.hh:324
G4int fNumberOfElements
Definition: G4Material.hh:323
G4double fDensity
Definition: G4Material.hh:312
G4Material(const G4String &name, G4double z, G4double a, G4double density, G4State state=kStateUndefined, G4double temp=NTP_Temperature, G4double pressure=CLHEP::STP_Pressure)
Definition: G4Material.cc:94
const G4double * GetAtomicNumDensityVector() const
Definition: G4Material.hh:217
G4State
Definition: G4Material.hh:115
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:210
void ComputeDerivedQuantities()
Definition: G4Material.cc:302
G4MaterialPropertiesTable * fMaterialPropertiesTable
Definition: G4Material.hh:328
void AddMaterial(G4Material *material, G4double fraction)
Definition: G4Material.cc:473
const std::map< G4Material *, G4double > & GetMatComponents() const
Definition: G4Material.hh:238
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:203
G4double GetElectronDensity() const
Definition: G4Material.hh:218
const G4Material * GetBaseMaterial() const
Definition: G4Material.hh:234
G4double GetNuclearInterLength() const
Definition: G4Material.hh:224
G4int maxNbComponents
Definition: G4Material.hh:319
void CopyPointersOfBaseMaterial()
Definition: G4Material.cc:332
G4double GetMassOfMolecule() const
Definition: G4Material.hh:243
size_t GetNumberOfElements() const
Definition: G4Material.hh:187
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
G4int fArrayLength
Definition: G4Material.hh:320
G4double GetTemperature() const
Definition: G4Material.hh:183
G4double GetDensity() const
Definition: G4Material.hh:181
friend std::ostream & operator<<(std::ostream &, const G4Material *)
Definition: G4Material.cc:656
std::mutex G4Mutex
Definition: G4Threading.hh:84