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: nistComparison.cc,v 1.2 2006/06/29 19:13:23 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // ------------------------------------------------------------ |
---|
32 | // |
---|
33 | // |
---|
34 | // Test the construction of materials from the NIST data base |
---|
35 | // |
---|
36 | |
---|
37 | #include "G4NistManager.hh" |
---|
38 | |
---|
39 | #include "globals.hh" |
---|
40 | #include "G4UnitsTable.hh" |
---|
41 | |
---|
42 | int main() { |
---|
43 | |
---|
44 | G4UnitDefinition::BuildUnitsTable(); |
---|
45 | |
---|
46 | // initialise NIST data base |
---|
47 | // |
---|
48 | G4NistManager* nistMat = G4NistManager::Instance(); |
---|
49 | // |
---|
50 | // define Elements |
---|
51 | // |
---|
52 | //G4Element* H = new G4Element("Hydrogen" , "H", 1., 1.01*g/mole); |
---|
53 | //G4Element* C = new G4Element("Carbon" , "C", 6., 2.01*g/mole); |
---|
54 | //G4Element* N = new G4Element("Nitrogen" , "N", 7., 14.01*g/mole); |
---|
55 | //G4Element* O = new G4Element("Oxygen" , "O", 8., 16.00*g/mole); |
---|
56 | //G4Element* Si = new G4Element("Silicon" , "Si", 14., 28.09*g/mole); |
---|
57 | //G4Element* Ge = new G4Element("Germanium", "Ge", 32., 72.59*g/mole); |
---|
58 | //G4Element* Bi = new G4Element("Bismuth" , "Bi", 83., 208.98*g/mole); |
---|
59 | |
---|
60 | G4bool buildIsotopes; |
---|
61 | |
---|
62 | G4Element* H = nistMat->FindOrBuildElement ( "H", buildIsotopes=false); |
---|
63 | G4Element* C = nistMat->FindOrBuildElement ( "C", buildIsotopes=false); |
---|
64 | G4Element* N = nistMat->FindOrBuildElement ( "N", buildIsotopes=false); |
---|
65 | G4Element* O = nistMat->FindOrBuildElement ( "O", buildIsotopes=false); |
---|
66 | G4Element* Si = nistMat->FindOrBuildElement ("Si", buildIsotopes=false); |
---|
67 | G4Element* Ge = nistMat->FindOrBuildElement ("Ge", buildIsotopes=false); |
---|
68 | G4Element* Bi = nistMat->FindOrBuildElement ("Bi", buildIsotopes=false); |
---|
69 | |
---|
70 | //---------------------------------------------------------------------- |
---|
71 | G4int ncomponents, natoms; |
---|
72 | G4double density, temperature, pressure; |
---|
73 | |
---|
74 | // CH4 |
---|
75 | // |
---|
76 | density = 0.717*mg/cm3; |
---|
77 | pressure = 1.*atmosphere; |
---|
78 | temperature = 273.15*kelvin; |
---|
79 | G4Material* CH4 = new G4Material("Methane", density, ncomponents=2, |
---|
80 | kStateGas,temperature,pressure); |
---|
81 | CH4->AddElement(H, natoms=4); |
---|
82 | CH4->AddElement(C, natoms=1); |
---|
83 | |
---|
84 | nistMat->FindOrBuildMaterial ("G4_METHANE"); |
---|
85 | |
---|
86 | // Air |
---|
87 | // |
---|
88 | density = 1.205*mg/cm3; |
---|
89 | pressure = 1.*atmosphere; |
---|
90 | temperature = 293.15*kelvin; |
---|
91 | G4Material* Air = new G4Material("dry_Air", density, ncomponents=2, |
---|
92 | kStateGas,temperature,pressure); |
---|
93 | Air->AddElement(N, 75*perCent); |
---|
94 | Air->AddElement(O, 25*perCent); |
---|
95 | |
---|
96 | nistMat->FindOrBuildMaterial ("G4_AIR"); |
---|
97 | |
---|
98 | // CO2 |
---|
99 | // |
---|
100 | density = 1.977*mg/cm3; |
---|
101 | pressure = 1.*atmosphere; |
---|
102 | temperature = 273.15*kelvin; |
---|
103 | G4Material* CO2 = new G4Material("Carbonic gas", density, ncomponents=2, |
---|
104 | kStateGas,temperature,pressure); |
---|
105 | CO2->AddElement(C, natoms=1); |
---|
106 | CO2->AddElement(O, natoms=2); |
---|
107 | |
---|
108 | nistMat->FindOrBuildMaterial ("G4_CARBON_DIOXIDE"); |
---|
109 | |
---|
110 | // C8H18 |
---|
111 | // |
---|
112 | density = 0.703*g/cm3; |
---|
113 | G4Material* C8H18 = new G4Material("liquid Octane", density, ncomponents=2); |
---|
114 | C8H18->AddElement(H, natoms=18); |
---|
115 | C8H18->AddElement(C, natoms=8); |
---|
116 | |
---|
117 | nistMat->FindOrBuildMaterial ("G4_OCTANE"); |
---|
118 | |
---|
119 | // H2O |
---|
120 | // |
---|
121 | density = 1.000*g/cm3; |
---|
122 | G4Material* H2O = new G4Material("Water", density, ncomponents=2); |
---|
123 | H2O->AddElement(H, natoms=2); |
---|
124 | H2O->AddElement(O, natoms=1); |
---|
125 | |
---|
126 | nistMat->FindOrBuildMaterial ("G4_WATER"); |
---|
127 | |
---|
128 | // Mylar |
---|
129 | // |
---|
130 | density = 1.390*g/cm3; |
---|
131 | G4Material* mylar = new G4Material("Mylar", density, ncomponents=3); |
---|
132 | mylar->AddElement(H, natoms=4); |
---|
133 | mylar->AddElement(C, natoms=5); |
---|
134 | mylar->AddElement(O, natoms=2); |
---|
135 | |
---|
136 | nistMat->FindOrBuildMaterial ("G4_MYLAR"); |
---|
137 | |
---|
138 | // SiO2 |
---|
139 | // |
---|
140 | density = 2.320*g/cm3; |
---|
141 | G4Material* SiO2 = new G4Material("Quartz", density, ncomponents=2); |
---|
142 | SiO2->AddElement(O , natoms=2); |
---|
143 | SiO2->AddElement(Si, natoms=1); |
---|
144 | |
---|
145 | nistMat->FindOrBuildMaterial ("G4_SILICON_DIOXIDE"); |
---|
146 | |
---|
147 | // BGO |
---|
148 | // |
---|
149 | density = 7.130*g/cm3; |
---|
150 | G4Material* BGO = new G4Material("BGO", density, ncomponents=3); |
---|
151 | BGO->AddElement(O , natoms=12); |
---|
152 | BGO->AddElement(Ge, natoms=3); |
---|
153 | BGO->AddElement(Bi, natoms=4); |
---|
154 | |
---|
155 | nistMat->FindOrBuildMaterial ("G4_BGO"); |
---|
156 | |
---|
157 | //---------------------------------------------------------------------- |
---|
158 | |
---|
159 | // Print the table of materials |
---|
160 | // |
---|
161 | G4cout << *(G4Material::GetMaterialTable()) << G4endl; |
---|
162 | |
---|
163 | return EXIT_SUCCESS; |
---|
164 | } |
---|