source: trunk/source/materials/test/NistMaterialTest1.cc@ 1204

Last change on this file since 1204 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 4.3 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: NistMaterialTest1.cc,v 1.3 2006/06/29 19:13:19 gunter Exp $
28// GEANT4 tag $Name: materials-V09-02-18 $
29//
30//
31// ------------------------------------------------------------
32//
33//
34// Test the construction of materials from the NIST data base
35//
36#include "G4NistElementBuilder.hh"
37#include "G4NistMaterialBuilder.hh"
38
39#include "globals.hh"
40#include "G4UnitsTable.hh"
41
42int main() {
43
44G4int z;
45G4bool buildIsotopes;
46G4int verbose;
47
48G4UnitDefinition::BuildUnitsTable();
49
50// define Elements
51//
52G4NistElementBuilder nistElm(verbose=0);
53
54nistElm.FindOrBuildElement (z=1);
55nistElm.FindOrBuildElement (z=6);
56nistElm.FindOrBuildElement (z=7, buildIsotopes=false);
57nistElm.FindOrBuildElement ("O");
58nistElm.FindOrBuildElement ("Si", buildIsotopes=false);
59nistElm.FindOrBuildElement ("Fe");
60nistElm.FindOrBuildElement ("U");
61
62G4cout << *(G4Isotope::GetIsotopeTable()) << G4endl;
63G4cout << *(G4Element::GetElementTable()) << G4endl;
64
65
66// define Materials
67//
68G4NistMaterialBuilder nistMat(0, &nistElm, verbose=0);
69
70//nistMat.ListNistSimpleMaterials();
71
72G4Material* Al =
73nistMat.FindOrBuildMaterial ("G4_Al");
74nistMat.FindOrBuildMaterial ("G4_lAr", buildIsotopes=false);
75nistMat.FindOrBuildMaterial ("G4_Cu" , buildIsotopes=false);
76G4Material* Pb =
77nistMat.FindOrBuildMaterial ("G4_Pb");
78
79//nistMat.ListNistCompoundMaterials();
80
81G4Material* H2O =
82nistMat.FindOrBuildMaterial ("G4_WATER");
83nistMat.FindOrBuildMaterial ("G4_POLYSTYRENE");
84nistMat.FindOrBuildMaterial ("G4_SILICON_DIOXIDE");
85nistMat.FindOrBuildMaterial ("G4_AIR", buildIsotopes=false);
86
87// build new materials from scratch
88//
89G4String gelSiElm[3] = {"H", "O", "Si"};
90G4int gelSiAtom[3] = { 4, 4, 1};
91G4double gelSiW[3] = {0.0416, 0.6661, 0.2923};
92
93std::vector<G4String> elm;
94std::vector<G4int> atom;
95std::vector<G4double> w;
96for (G4int j=0; j<3; j++) {
97 elm.push_back(gelSiElm[j]); atom.push_back(gelSiAtom[j]);
98 w.push_back(gelSiW[j]);
99}
100
101// by atom count
102G4Material* Aerog =
103nistMat.ConstructNewMaterial ("gel_silicate1", elm, atom, 0.2);
104
105// by mass fraction
106nistMat.ConstructNewMaterial ("gel_silicate2", elm, w, 0.2);
107
108// print G4MaterialTable
109//
110G4cout << *(G4Material::GetMaterialTable()) << G4endl;
111
112// print additional informations
113//
114G4cout << " Nuclear interaction length of Aluminium: "
115 << Al->GetNuclearInterLength()/cm << " cm" << G4endl;
116
117G4cout << " Nuclear interaction length of Lead: "
118 << Pb->GetNuclearInterLength()/cm << " cm" << G4endl;
119
120G4cout << " Nuclear interaction length of Water: "
121 << H2O->GetNuclearInterLength()/cm << " cm" << G4endl;
122
123G4cout << " Nuclear interaction length of Aerogel: "
124 << Aerog->GetNuclearInterLength()/cm << " cm" << G4endl;
125
126return EXIT_SUCCESS;
127}
Note: See TracBrowser for help on using the repository browser.