source: trunk/examples/advanced/Tiara/source/tiara/src/TiaraMaterials.cc @ 1002

Last change on this file since 1002 was 807, checked in by garnier, 16 years ago

update

File size: 6.5 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// $Id: TiaraMaterials.cc,v 1.5 2006/06/29 15:45:15 gunter Exp $
27// GEANT4 tag $Name:  $
28//
29
30#include "TiaraMaterials.hh"
31#include "G4Element.hh"
32#include "G4Material.hh"
33
34
35TiaraMaterials::TiaraMaterials()
36{
37
38  G4String name, symbol;
39
40  FillElementMap("Hydrogen", "H", 1, 1.01*g/mole);
41  FillElementMap("Carbon", "C", 6, 12.01*g/mole);
42  FillElementMap("Oxygen", "O", 8,  16.00*g/mole);
43  FillElementMap("Natrium", "Na", 11, 22.99*g/mole);
44  FillElementMap("Magnesium", "Mg", 12, 24.305*g/mole); 
45  //  FillElementMap("Hg", "Hg", 80, 200.59*g/mole);
46  FillElementMap("Aluminium", "Al", 14, 26.98*g/mole);
47  FillElementMap("Silicon", "Si", 14, 28.09*g/mole);
48  FillElementMap("K", "K", 19, 39.1*g/mole);
49  FillElementMap("Calzium", "Ca", 31, 69.72*g/mole);
50  FillElementMap("Iron", "Fe", 26, 55.85*g/mole);
51  FillElementMap("Nitro", "N", 7 , 14.006*g/mole);
52
53 
54  G4Material *mat = 0;
55  mat = CreateConcrete();
56  fMapNameMaterial[mat->GetName()] = mat;
57  mat = CreateIron();
58  fMapNameMaterial[mat->GetName()] = mat;
59  mat = CreateAir();
60  fMapNameMaterial[mat->GetName()] = mat;
61  mat = CreateVakuum();
62  fMapNameMaterial[mat->GetName()] = mat;
63}
64
65TiaraMaterials::~TiaraMaterials(){
66}
67
68
69G4Material *TiaraMaterials::GetMaterial(const G4String &matName) const {
70  G4Material *mat =0;
71
72  TiaraMapNameMaterial::const_iterator matElm = 
73    fMapNameMaterial.find(matName);
74
75  if (matElm == fMapNameMaterial.end()) {
76    G4cout << "TiaraMaterials::GetMaterial: material named \"" <<
77      matName << "\", not known!" << G4endl;
78  }
79  else {
80    mat = matElm->second;
81  }
82  return mat;
83}
84
85
86void TiaraMaterials::FillElementMap(const G4String &name, 
87                                   const G4String &symbol,
88                                   G4int Z,
89                                   G4double A) {
90  TiaraMapSymbolElement::iterator it = fMapSymbolElement.find(symbol);
91  if (it!=fMapSymbolElement.end()) {
92    G4cout << "TiaraMaterials::FillElementMap: symbol: " 
93           << symbol << ", already defined" << G4endl;
94  }
95  else {
96    fMapSymbolElement[symbol] = new G4Element(name, symbol, Z, A);
97    if (!fMapSymbolElement[symbol]) {
98      G4Exception("TiaraMaterials::FillElementMap: new failed to create G4Element!");
99    }
100  }
101  return;
102}
103
104G4Material *TiaraMaterials::CreateMCNPConcrete(){
105  typedef std::map< G4Element* , G4double > TiaraMapElementFraction;
106
107  TiaraMapElementFraction concreteFractions; 
108  concreteFractions[fMapSymbolElement["H"]] = 0.01;
109  concreteFractions[fMapSymbolElement["O"]] = 0.529;
110  concreteFractions[fMapSymbolElement["Na"]] = 0.016;
111  //  concreteFractions[fMapSymbolElement["Hg"]] = 0.002 ;
112  concreteFractions[fMapSymbolElement["Al"]] = 0.034;
113  concreteFractions[fMapSymbolElement["Si"]] = 0.337 + 0.002;
114  concreteFractions[fMapSymbolElement["K"]] = 0.013;
115  concreteFractions[fMapSymbolElement["Ca"]] = 0.044;
116  concreteFractions[fMapSymbolElement["Fe"]] = 0.014;
117  concreteFractions[fMapSymbolElement["C"]] = 0.001;
118
119  G4Material *mat =0;
120  G4double density = 2.03*g/cm3;
121  mat = new G4Material("concrete", density, 
122                       concreteFractions.size());
123  for (TiaraMapElementFraction::iterator it = concreteFractions.begin();
124       it != concreteFractions.end(); ++it) {
125    mat->AddElement(it->first , it->second);
126  }
127 
128  return mat;
129
130}
131
132G4Material *TiaraMaterials::CreateConcrete(){
133  typedef std::map< G4Element* , G4double > TiaraMapElementFraction;
134
135  TiaraMapElementFraction concreteFractions; 
136  concreteFractions[fMapSymbolElement["H"]] = 0.010853422;
137  concreteFractions[fMapSymbolElement["O"]] = 0.48165594;
138  concreteFractions[fMapSymbolElement["Na"]] = 0.020327181;
139  concreteFractions[fMapSymbolElement["Mg"]] = 0.010832401;
140  concreteFractions[fMapSymbolElement["Al"]] = 0.060514396;
141  concreteFractions[fMapSymbolElement["Si"]] = 0.22409956;
142  concreteFractions[fMapSymbolElement["K"]] = 0.010680188;
143  concreteFractions[fMapSymbolElement["Ca"]] = 0.12388306;
144  concreteFractions[fMapSymbolElement["Fe"]] = 0.056603178;
145
146  G4Material *mat =0;
147  G4double density = 2.31*g/cm3;
148  mat = new G4Material("concrete", density, 
149                       concreteFractions.size());
150  for (TiaraMapElementFraction::iterator it = concreteFractions.begin();
151       it != concreteFractions.end(); ++it) {
152    mat->AddElement(it->first , it->second);
153  }
154 
155  return mat;
156
157}
158
159G4Material *TiaraMaterials::CreateAir(){
160  G4Material *mat =0;
161  G4double density = 1.29*mg/cm3;
162  mat = new G4Material("air", density, 2);
163
164  mat->AddElement(fMapSymbolElement["N"], 0.75);
165  mat->AddElement(fMapSymbolElement["O"], 0.25);
166
167  return mat;
168}
169
170G4Material *TiaraMaterials::CreateIron(){
171  G4Material *mat =0;
172  G4double density = 7.87*g/cm3;
173  mat = new G4Material("iron", density, 1);
174  mat->AddElement(fMapSymbolElement["Fe"],1);
175  return mat;
176}
177
178G4Material *TiaraMaterials::CreateVakuum(){
179  G4Material *mat =0;
180  G4double density(universe_mean_density);
181  G4double temperature(2.73*kelvin);
182  G4double pressure(3.e-18*pascal);
183  mat = new G4Material("vacuum", 1., 1.01*g/mole, 
184                       density,
185                       kStateGas,temperature,pressure);
186  return mat;
187}
Note: See TracBrowser for help on using the repository browser.