source: trunk/examples/extended/parameterisations/gflash/src/ExGflashMaterialManager.cc@ 1256

Last change on this file since 1256 was 807, checked in by garnier, 17 years ago

update

File size: 6.8 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#include "ExGflashMaterialManager.hh"
27
28ExGflashMaterialManager* ExGflashMaterialManager::mpointer=0;
29
30void ExGflashMaterialManager::storeElement(G4String name,G4String symbol, double z, double a)
31{
32 if (elist.find(symbol)!=elist.end())
33 {
34 cout<<"attempt of redefining an existing element "<<symbol<<endl;
35 cout<<elist[symbol]<<endl;
36 }
37 else
38 {
39 G4Element *newelement=new G4Element(name,symbol,z,a);
40 elist[symbol]=newelement;
41 }
42}
43
44G4Element* ExGflashMaterialManager::getElement(G4String symbol)
45{
46 if (elist.find(symbol)==elist.end())
47 {
48 cout<<" element "<<symbol<<" not found!"<<endl;
49 return NULL;
50 }
51 else
52 return elist[symbol];
53}
54
55void ExGflashMaterialManager::storeMaterial(G4String name, double z, double a, double d)
56{
57 if (mlist.find(name)!=mlist.end())
58 {
59 cout<<"attempt of redefining an existing material "<<endl;
60 cout<<mlist[name]<<endl;
61 }
62 else
63 {
64 G4Material *newmaterial=new G4Material(name,z,a,d);
65 mlist[name]=newmaterial;
66 }
67}
68
69void ExGflashMaterialManager::storeMaterial(G4String name, double d, int ncomponent)
70{
71 if (mlist.find(name)!=mlist.end())
72 {
73 cout<<"attempt of redefining an existing material "<<endl;
74 cout<<mlist[name]<<endl;
75 }
76 else
77 {
78 G4Material *newmaterial=new G4Material(name,d,ncomponent);
79 mlist[name]=newmaterial;
80 }
81}
82
83G4Material* ExGflashMaterialManager::getMaterial(G4String name)
84{
85 if (mlist.find(name)==mlist.end())
86 {
87 cout<<" material "<<name<<" not found!"<<endl;
88 return NULL;
89 }
90 else
91 {
92 // cout<<"returning material "<<name<<endl;
93 return mlist[name];
94 }
95}
96
97void ExGflashMaterialManager::addMaterial(G4String n1,G4String n2,double fraction)
98{
99 G4Material *mat=getMaterial(n1);
100 mat->AddMaterial(getMaterial(n2),fraction);
101}
102
103void ExGflashMaterialManager::addElement(G4String n1,G4String n2,double fraction)
104{
105 G4Material *mat=getMaterial(n1);
106 mat->AddElement(getElement(n2),fraction);
107}
108
109void ExGflashMaterialManager::addElement(G4String n1,G4String n2,int natoms)
110{
111 G4Material *mat=getMaterial(n1);
112 mat->AddElement(getElement(n2),natoms);
113}
114
115void ExGflashMaterialManager::printMaterialTable()
116{
117 MaterialList::iterator it;
118 for (it=mlist.begin();it!=mlist.end();it++) cout<<(*it).second<<endl;
119}
120
121void ExGflashMaterialManager::printElementTable()
122{
123 ElementList::iterator it;
124 for (it=elist.begin();it!=elist.end();it++) cout<<(*it).second<<endl;
125}
126
127void ExGflashMaterialManager::initialize()
128{
129 G4String name,symbol;
130 double z,a,density;
131 int ncomponents,natoms;
132 //double fraction;
133 storeElement(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole);
134 storeElement(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole);
135 storeElement(name="Nitrogen",symbol="N" , z= 7., a=14.01*g/mole);
136 storeElement(name="Oxygen" ,symbol="O" , z= 8., a=16.00*g/mole);
137 storeElement(name="Silicon",symbol="Si" , z= 14., a=28.09*g/mole);
138 storeElement(name="Argon",symbol="Ar",z=18.,a=39.95*g/mole);
139 storeElement(name="Iron" ,symbol="Fe", z=26., a=55.85*g/mole);
140 storeElement(name="Aluminum",symbol="Al",z=13.,a=26.98*g/mole);
141 storeElement(name="Lead",symbol="Pb",z=82.,a=207.19*g/mole);
142 storeElement(name="Fluorine",symbol="F",z=9.,a=18.99*g/mole);
143 storeElement(name="Chlorine",symbol="Cl",z=17.,a=35.45*g/mole);
144 storeElement(name="Tungsten",symbol="W",z=74.,a=183.85*g/mole);
145 storeMaterial(name="Aluminium", z=13., a = 26.98*g/mole, density = 2.700*g/cm3);
146 storeMaterial(name="Iron",z=26., a=55.85*g/mole, density=7.87*g/cm3);
147 storeMaterial(name="Copper",z=29.,a=63.546*g/mole, density=8.96*g/cm3);
148 storeMaterial(name="Silicon",z=14.,a=28.0855*g/mole, density=2.33*g/cm3);
149 storeMaterial(name="Tungsten",z=74.,a=183.85*g/mole, density = 19.3*g/cm3 );
150 storeMaterial(name="Lead" , z=82., a= 207.19*g/mole,density = 11.35*g/cm3);
151 storeMaterial(name="LAr",z=18.,a=39.95*g/mole,density =1.39*g/cm3);
152 storeMaterial(name="Scintillator", density=1.032*g/cm3, ncomponents=2);
153 addElement("Scintillator","C",natoms=9);
154 addElement("Scintillator","H",natoms=10);
155 storeMaterial(name="PbWO4", density=8.28*g/cm3, ncomponents=3);
156 addElement("PbWO4","Pb",natoms=1);
157 addElement("PbWO4","W",natoms=1);
158 addElement("PbWO4","O",natoms=4);
159 // addElement("PbWO4","Pb", fraction=0.45532661 );
160 // addElement("PbWO4","W", fraction=0.40403397 );
161 // addElement("PbWO4","O", fraction=0.14063942);
162 storeMaterial(name="Air" , density=1.290*mg/cm3, ncomponents=2);
163 addElement("Air", "N", .7);
164 addElement("Air", "O", .3);
165 storeMaterial(name="CO2", density=1.977*mg/1000*cm3,ncomponents=2);
166 addElement("CO2","C",natoms=1);
167 addElement("CO2","O",natoms=2);
168 storeMaterial(name="ArCO2",density=1.8*mg/1000*cm3,ncomponents=2);
169 addElement("ArCO2","Ar",.93);
170 addMaterial("ArCO2","CO2",.07);
171 storeMaterial(name="RPCgas", density=1.977*mg/1000*cm3,ncomponents=3);
172 addElement("RPCgas","C",natoms=2);
173 addElement("RPCgas","H",natoms=2);
174 addElement("RPCgas","F",natoms=4);
175 storeMaterial(name="RPVC", density=1.4*g/cm3,ncomponents=3);
176 addElement("RPVC","C",natoms=2);
177 addElement("RPVC","H",natoms=3);
178 addElement("RPVC","Cl",natoms=1);
179 storeMaterial(name="Bakelite", density=1.4*g/cm3,ncomponents=3);
180 addElement("Bakelite","C",natoms=1);
181 addElement("Bakelite","H",natoms=4);
182 addElement("Bakelite","O",natoms=2);
183}
184
185
186
187
188
189
190
191
192
193
194
195
Note: See TracBrowser for help on using the repository browser.