| 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 |
|
|---|
| 42 | int main() {
|
|---|
| 43 |
|
|---|
| 44 | G4int z;
|
|---|
| 45 | G4bool buildIsotopes;
|
|---|
| 46 | G4int verbose;
|
|---|
| 47 |
|
|---|
| 48 | G4UnitDefinition::BuildUnitsTable();
|
|---|
| 49 |
|
|---|
| 50 | // define Elements
|
|---|
| 51 | //
|
|---|
| 52 | G4NistElementBuilder nistElm(verbose=0);
|
|---|
| 53 |
|
|---|
| 54 | nistElm.FindOrBuildElement (z=1);
|
|---|
| 55 | nistElm.FindOrBuildElement (z=6);
|
|---|
| 56 | nistElm.FindOrBuildElement (z=7, buildIsotopes=false);
|
|---|
| 57 | nistElm.FindOrBuildElement ("O");
|
|---|
| 58 | nistElm.FindOrBuildElement ("Si", buildIsotopes=false);
|
|---|
| 59 | nistElm.FindOrBuildElement ("Fe");
|
|---|
| 60 | nistElm.FindOrBuildElement ("U");
|
|---|
| 61 |
|
|---|
| 62 | G4cout << *(G4Isotope::GetIsotopeTable()) << G4endl;
|
|---|
| 63 | G4cout << *(G4Element::GetElementTable()) << G4endl;
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | // define Materials
|
|---|
| 67 | //
|
|---|
| 68 | G4NistMaterialBuilder nistMat(0, &nistElm, verbose=0);
|
|---|
| 69 |
|
|---|
| 70 | //nistMat.ListNistSimpleMaterials();
|
|---|
| 71 |
|
|---|
| 72 | G4Material* Al =
|
|---|
| 73 | nistMat.FindOrBuildMaterial ("G4_Al");
|
|---|
| 74 | nistMat.FindOrBuildMaterial ("G4_lAr", buildIsotopes=false);
|
|---|
| 75 | nistMat.FindOrBuildMaterial ("G4_Cu" , buildIsotopes=false);
|
|---|
| 76 | G4Material* Pb =
|
|---|
| 77 | nistMat.FindOrBuildMaterial ("G4_Pb");
|
|---|
| 78 |
|
|---|
| 79 | //nistMat.ListNistCompoundMaterials();
|
|---|
| 80 |
|
|---|
| 81 | G4Material* H2O =
|
|---|
| 82 | nistMat.FindOrBuildMaterial ("G4_WATER");
|
|---|
| 83 | nistMat.FindOrBuildMaterial ("G4_POLYSTYRENE");
|
|---|
| 84 | nistMat.FindOrBuildMaterial ("G4_SILICON_DIOXIDE");
|
|---|
| 85 | nistMat.FindOrBuildMaterial ("G4_AIR", buildIsotopes=false);
|
|---|
| 86 |
|
|---|
| 87 | // build new materials from scratch
|
|---|
| 88 | //
|
|---|
| 89 | G4String gelSiElm[3] = {"H", "O", "Si"};
|
|---|
| 90 | G4int gelSiAtom[3] = { 4, 4, 1};
|
|---|
| 91 | G4double gelSiW[3] = {0.0416, 0.6661, 0.2923};
|
|---|
| 92 |
|
|---|
| 93 | std::vector<G4String> elm;
|
|---|
| 94 | std::vector<G4int> atom;
|
|---|
| 95 | std::vector<G4double> w;
|
|---|
| 96 | for (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
|
|---|
| 102 | G4Material* Aerog =
|
|---|
| 103 | nistMat.ConstructNewMaterial ("gel_silicate1", elm, atom, 0.2);
|
|---|
| 104 |
|
|---|
| 105 | // by mass fraction
|
|---|
| 106 | nistMat.ConstructNewMaterial ("gel_silicate2", elm, w, 0.2);
|
|---|
| 107 |
|
|---|
| 108 | // print G4MaterialTable
|
|---|
| 109 | //
|
|---|
| 110 | G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
|---|
| 111 |
|
|---|
| 112 | // print additional informations
|
|---|
| 113 | //
|
|---|
| 114 | G4cout << " Nuclear interaction length of Aluminium: "
|
|---|
| 115 | << Al->GetNuclearInterLength()/cm << " cm" << G4endl;
|
|---|
| 116 |
|
|---|
| 117 | G4cout << " Nuclear interaction length of Lead: "
|
|---|
| 118 | << Pb->GetNuclearInterLength()/cm << " cm" << G4endl;
|
|---|
| 119 |
|
|---|
| 120 | G4cout << " Nuclear interaction length of Water: "
|
|---|
| 121 | << H2O->GetNuclearInterLength()/cm << " cm" << G4endl;
|
|---|
| 122 |
|
|---|
| 123 | G4cout << " Nuclear interaction length of Aerogel: "
|
|---|
| 124 | << Aerog->GetNuclearInterLength()/cm << " cm" << G4endl;
|
|---|
| 125 |
|
|---|
| 126 | return EXIT_SUCCESS;
|
|---|
| 127 | }
|
|---|