source: trunk/source/materials/test/nistComparison.cc@ 1325

Last change on this file since 1325 was 1315, checked in by garnier, 15 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 5.6 KB
Line 
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
42int main() {
43
44G4UnitDefinition::BuildUnitsTable();
45
46// initialise NIST data base
47//
48G4NistManager* 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
60G4bool buildIsotopes;
61
62G4Element* H = nistMat->FindOrBuildElement ( "H", buildIsotopes=false);
63G4Element* C = nistMat->FindOrBuildElement ( "C", buildIsotopes=false);
64G4Element* N = nistMat->FindOrBuildElement ( "N", buildIsotopes=false);
65G4Element* O = nistMat->FindOrBuildElement ( "O", buildIsotopes=false);
66G4Element* Si = nistMat->FindOrBuildElement ("Si", buildIsotopes=false);
67G4Element* Ge = nistMat->FindOrBuildElement ("Ge", buildIsotopes=false);
68G4Element* Bi = nistMat->FindOrBuildElement ("Bi", buildIsotopes=false);
69
70//----------------------------------------------------------------------
71G4int ncomponents, natoms;
72G4double density, temperature, pressure;
73
74// CH4
75//
76density = 0.717*mg/cm3;
77pressure = 1.*atmosphere;
78temperature = 273.15*kelvin;
79G4Material* CH4 = new G4Material("Methane", density, ncomponents=2,
80 kStateGas,temperature,pressure);
81CH4->AddElement(H, natoms=4);
82CH4->AddElement(C, natoms=1);
83
84nistMat->FindOrBuildMaterial ("G4_METHANE");
85
86// Air
87//
88density = 1.205*mg/cm3;
89pressure = 1.*atmosphere;
90temperature = 293.15*kelvin;
91G4Material* Air = new G4Material("dry_Air", density, ncomponents=2,
92 kStateGas,temperature,pressure);
93Air->AddElement(N, 75*perCent);
94Air->AddElement(O, 25*perCent);
95
96nistMat->FindOrBuildMaterial ("G4_AIR");
97
98// CO2
99//
100density = 1.977*mg/cm3;
101pressure = 1.*atmosphere;
102temperature = 273.15*kelvin;
103G4Material* CO2 = new G4Material("Carbonic gas", density, ncomponents=2,
104 kStateGas,temperature,pressure);
105CO2->AddElement(C, natoms=1);
106CO2->AddElement(O, natoms=2);
107
108nistMat->FindOrBuildMaterial ("G4_CARBON_DIOXIDE");
109
110// C8H18
111//
112density = 0.703*g/cm3;
113G4Material* C8H18 = new G4Material("liquid Octane", density, ncomponents=2);
114C8H18->AddElement(H, natoms=18);
115C8H18->AddElement(C, natoms=8);
116
117nistMat->FindOrBuildMaterial ("G4_OCTANE");
118
119// H2O
120//
121density = 1.000*g/cm3;
122G4Material* H2O = new G4Material("Water", density, ncomponents=2);
123H2O->AddElement(H, natoms=2);
124H2O->AddElement(O, natoms=1);
125
126nistMat->FindOrBuildMaterial ("G4_WATER");
127
128// Mylar
129//
130density = 1.390*g/cm3;
131G4Material* mylar = new G4Material("Mylar", density, ncomponents=3);
132mylar->AddElement(H, natoms=4);
133mylar->AddElement(C, natoms=5);
134mylar->AddElement(O, natoms=2);
135
136nistMat->FindOrBuildMaterial ("G4_MYLAR");
137
138// SiO2
139//
140density = 2.320*g/cm3;
141G4Material* SiO2 = new G4Material("Quartz", density, ncomponents=2);
142SiO2->AddElement(O , natoms=2);
143SiO2->AddElement(Si, natoms=1);
144
145nistMat->FindOrBuildMaterial ("G4_SILICON_DIOXIDE");
146
147// BGO
148//
149density = 7.130*g/cm3;
150G4Material* BGO = new G4Material("BGO", density, ncomponents=3);
151BGO->AddElement(O , natoms=12);
152BGO->AddElement(Ge, natoms=3);
153BGO->AddElement(Bi, natoms=4);
154
155nistMat->FindOrBuildMaterial ("G4_BGO");
156
157//----------------------------------------------------------------------
158
159// Print the table of materials
160//
161G4cout << *(G4Material::GetMaterialTable()) << G4endl;
162
163return EXIT_SUCCESS;
164}
Note: See TracBrowser for help on using the repository browser.