Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ExtendedMaterial.hh
Go to the documentation of this file.
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//
28
29//---------------------------------------------------------------------------
30//
31// ClassName: G4ExtendedMaterial
32//
33// Description: Contains extended material properties
34//
35// Class description:
36//
37// Is used to define the additional material information. This class
38// contains a map of G4VMaterialExtension associated with an integer
39// key of G4PhysicsModelCatalog index.
40//
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44#ifndef G4EXTENDEDMATERIAL_HH
45#define G4EXTENDEDMATERIAL_HH 1
46
47#include "G4Material.hh"
48#include <unordered_map>
49#include <memory>
50#include "G4VMaterialExtension.hh"//Needed for hash defintion
51
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55
56// A map for material extensions based on the hash of the name.
57// Extensions are owned by the map
58using G4MaterialExtensionMap=std::unordered_map<G4String, //KEY
59 std::unique_ptr<G4VMaterialExtension>,//VALUE
60 G4MaterialExtensionHash>;//HASHING FUNCTOR
61
63{
64public: // with description
65 //
66 // Constructor to create an extended material from the base-class G4Material
67 //
68 G4ExtendedMaterial(const G4String& name, //its name
69 const G4Material* baseMaterial); //base material
70
71 //
72 // Constructor to create an extended material from single element
73 //
74 G4ExtendedMaterial(const G4String& name, //its name
75 G4double z, //atomic number
76 G4double a, //mass of mole
77 G4double density, //density
78 G4State state = kStateUndefined, //solid,gas
79 G4double temp = NTP_Temperature, //temperature
80 G4double pressure = CLHEP::STP_Pressure); //pressure
81
82 //
83 // Constructor to create an extended material from a combination of elements
84 // and/or materials subsequently added via AddElement and/or AddMaterial
85 //
86 G4ExtendedMaterial(const G4String& name, //its name
87 G4double density, //density
88 G4int nComponents, //nbOfComponents
89 G4State state = kStateUndefined, //solid,gas
90 G4double temp = NTP_Temperature, //temperature
91 G4double pressure = CLHEP::STP_Pressure); //pressure
92
93 //
94 // Constructor to create an extended material from the base extended material
95 //
96 G4ExtendedMaterial(const G4String& name, //its name
97 G4double density, //density
98 const G4ExtendedMaterial* baseMaterial, //base material
99 G4State state = kStateUndefined, //solid,gas
100 G4double temp = NTP_Temperature, //temperature
101 G4double pressure = CLHEP::STP_Pressure); //pressure
102
103public:
105
106private:
107 G4MaterialExtensionMap fExtensionMap;
108public: // with description
109 //
110 // register G4VMaterialExtension
111 // This class owns extensions. Register with:
112 // RegisterExtension(std::unique_ptr<MyExtension>(new MyExtension("name")));
113 // or:
114 // RegisteerExtension(std::make_unique<MyExtension>("name"));
115 void RegisterExtension(std::unique_ptr<G4VMaterialExtension> extension);
116 //
117 // retrieve G4VMaterialExtension, null pointer is returned if model is not available
119
121 { return G4int(fExtensionMap.size()); }
122
123 // Retrieve iterators, proxyes to c++ methods. These are const for read-only
124 // access. Use Register/RetreiveExtension to modify map
125 G4MaterialExtensionMap::const_iterator begin() const { return fExtensionMap.begin(); }
126 G4MaterialExtensionMap::const_iterator cbegin() const { return fExtensionMap.cbegin(); }
127 G4MaterialExtensionMap::const_iterator end() const { return fExtensionMap.end(); }
128 G4MaterialExtensionMap::const_iterator cend() const { return fExtensionMap.cend(); }
129
130public:
131 virtual G4bool IsExtended() const;
132 void Print(std::ostream& flux) const;
133};
134
135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136
137#endif
std::unordered_map< G4String, std::unique_ptr< G4VMaterialExtension >, G4MaterialExtensionHash > G4MaterialExtensionMap
G4State
Definition: G4Material.hh:111
@ kStateUndefined
Definition: G4Material.hh:111
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
std::hash< std::string > G4MaterialExtensionHash
void Print(std::ostream &flux) const
G4int GetNumberOfExtensions() const
void RegisterExtension(std::unique_ptr< G4VMaterialExtension > extension)
G4MaterialExtensionMap::const_iterator end() const
virtual G4bool IsExtended() const
G4MaterialExtensionMap::const_iterator begin() const
G4VMaterialExtension * RetrieveExtension(const G4String &name)
G4MaterialExtensionMap::const_iterator cbegin() const
G4MaterialExtensionMap::const_iterator cend() const