source: trunk/source/materials/test/NistMaterialTest2.cc@ 1314

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

nvx fichiers dans CVS

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