/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSMaterials.cc

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 24.7.2002
00004    Copyright (c) 2002 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 
00006    Modified 22.03.05 by J.C.Carter, Royal Holloway, Univ. of London.
00007    Added GABs LCBeamGasPlugMat Material
00008    Added LCLead
00009 
00010    Modified 13.09.07 by S.P.Malton, Royal Holloway, Univ. of London.
00011    Created maps of materials and elements
00012    Added Initialise function
00013    Added Add/GetElement/Material functions
00014    Cleanup in destructor
00015    Added ListMaterials function
00016 */
00017 
00018 #include "BDSExecOptions.hh"
00019 #include "BDSMaterials.hh"
00020 #include "G4NistManager.hh"
00021 
00022 #include <list>
00023 #include <map>
00024 
00025 #include "parser/element.h"
00026 #include "parser/elementlist.h"
00027 #include "parser/options.h"
00028 
00029 extern Options options;
00030 
00031 BDSMaterials* BDSMaterials::_instance = 0;
00032 
00033 BDSMaterials* BDSMaterials::Instance(){
00034   if(_instance==0) {
00035     _instance = new BDSMaterials();
00036   }
00037   return _instance;
00038 }
00039 
00040 BDSMaterials::BDSMaterials(){
00041   Initialise();
00042 }
00043 
00044 void BDSMaterials::Initialise()
00045 {
00046   G4String name, symbol;             //a=mass of a mole;
00047   G4double a, z, density;            //z=mean number of protons;
00048   //G4int iz, n;                       //iz=number of protons  in an isotope;
00049                                    // n=number of nucleons in an isotope;
00050 
00051 
00052   //G4double abundance;
00053   G4double fractionmass;
00054  //G4int ncomponents;
00055   G4double temperature, pressure;
00056 
00057   //
00058   // Define elements
00059   //
00060 #ifdef BDSDEBUG
00061   G4cout << "BDSMaterials: G4 predefined units: " << G4endl;
00062   G4cout << "g= " << CLHEP::g << G4endl;
00063   G4cout << "kg= " << CLHEP::kg << G4endl;
00064   G4cout << "cm= " << CLHEP::cm << G4endl;
00065   G4cout << "m= " << CLHEP::m << G4endl;
00066   G4cout << "mm= " << CLHEP::mm << G4endl;
00067   G4cout << "um= " << CLHEP::um << G4endl;
00068   G4cout << "nm= " << CLHEP::nm << G4endl;
00069   G4cout << "mole= " << CLHEP::mole << G4endl;
00070   G4cout << "kelvin= " << CLHEP::kelvin << G4endl;
00071   G4cout << "tesla= " << CLHEP::tesla << G4endl;
00072 #endif
00073   
00074   G4Element* tmpElement = new G4Element
00075     (name="Hydrogen"   , symbol="H" , z=  1., a=   1.00*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00076 
00077   tmpElement = new G4Element
00078     (name="Helium"     , symbol="He", z=  2., a=   4.0026*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00079 
00080   tmpElement = new G4Element
00081     (name="Beryllium"  , symbol="Be", z=  4., a=   9.0122*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00082 
00083   tmpElement = new G4Element
00084     (name="Boron"      , symbol="B", z=  5., a=   10.811*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00085 
00086   tmpElement = new G4Element
00087     (name="Carbon"     , symbol="C" , z=  6., a=  12.00*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00088 
00089   tmpElement = new G4Element
00090     (name="Nitrogen"   , symbol="N" , z=  7., a=  14.01*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00091 
00092   tmpElement = new G4Element
00093     (name="Oxygen"     , symbol="O" , z=  8., a=  16.00*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00094 
00095   tmpElement = new G4Element
00096     (name="Sodium"     , symbol="Na", z= 11., a= 22.98976928*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00097 
00098   tmpElement = new G4Element
00099     (name="Magnesium"  , symbol="Mg", z= 12., a=  24.3050*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00100 
00101   tmpElement = new G4Element
00102     (name="Aluminium"  , symbol="Al", z= 13., a=  26.98*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00103 
00104   tmpElement =  new G4Element
00105     (name="Silicon"    , symbol="Si", z= 14., a=  28.09*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00106 
00107   tmpElement = new G4Element
00108     (name="Phosphorous", symbol="P" , z= 15., a=  30.973762*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00109 
00110   tmpElement = new G4Element
00111     (name="Sulphur"    , symbol="S" , z= 16., a=  32.066*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00112 
00113   tmpElement = new G4Element
00114     (name="Potassium"   , symbol="K", z= 19., a=  39.0983*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00115 
00116   tmpElement = new G4Element
00117     (name="Calcium"    , symbol="Ca", z= 20., a=  40.078*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00118 
00119   tmpElement = new G4Element
00120     (name="Titanium"   , symbol="Ti", z= 22., a=  47.867*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00121 
00122   tmpElement = new G4Element
00123     (name="Vanadium"   , symbol="V" , z= 23., a=  50.9415*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00124 
00125   tmpElement = new G4Element
00126     (name="Chromium"   , symbol="Cr", z= 24., a= 51.9961*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00127 
00128   tmpElement = new G4Element
00129     (name="Manganese"  , symbol="Mn", z= 25., a=  54.93805*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00130 
00131   tmpElement = new G4Element
00132     (name="Iron"       , symbol="Fe", z= 26., a=  55.847*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00133 
00134   tmpElement = new G4Element
00135     (name="Cobalt"     , symbol="Co", z= 27., a=  58.93*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00136 
00137   tmpElement = new G4Element
00138     (name="Nickel"     , symbol="Ni", z= 28., a=  58.693*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00139 
00140   tmpElement = new G4Element
00141     (name="Copper"     , symbol="Cu", z= 29., a=  63.546*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00142 
00143   tmpElement = new G4Element
00144     (name="Zinc"       , symbol="Zn", z= 30., a= 65.38*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00145 
00146   tmpElement = new G4Element
00147     (name="Rubidium"   , symbol="Rb", z= 37., a=  85.4678*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00148 
00149   tmpElement = new G4Element
00150     (name="Strontium"  , symbol="Sr", z= 38., a=  87.62*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00151 
00152   tmpElement = new G4Element
00153     (name="Yttrium"    , symbol="Y", z=39 , a=88.906*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00154 
00155   tmpElement = new G4Element
00156     (name="Zirkonium"  , symbol="Zr", z= 40., a=  91.224*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00157 
00158   tmpElement = new G4Element
00159     (name="Niobium"    , symbol="Nb", z= 41., a=  92.906*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00160 
00161   tmpElement = new G4Element
00162     (name="Molybdenum" , symbol="Mo", z= 42., a= 95.94*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00163 
00164   tmpElement = new G4Element
00165     (name="Barium"     , symbol="Ba", z= 56., a= 137.327*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00166 
00167   tmpElement = new G4Element
00168     (name="Samarium"   , symbol="Sm", z= 62., a= 150.4*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00169 
00170   tmpElement = new G4Element
00171     (name="Europium"   , symbol="Eu", z= 63., a= 151.964*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00172 
00173   tmpElement = new G4Element
00174     (name="Tungsten"   , symbol="W" , z= 74., a= 183.84*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00175 
00176   tmpElement = new G4Element
00177     (name="Lead"       , symbol="Pb", z= 82., a= 207.2*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00178 
00179   tmpElement = new G4Element
00180     (name="Uranium"    , symbol="U", z= 92., a=  238.0289*CLHEP::g/CLHEP::mole); elements[symbol] = tmpElement;
00181 
00182   //
00183   // Define materials
00184   //
00185 
00186   //default Geant4 temperature = 273.15 K
00187   //default Geant4 pressure = 1atm
00188 
00189   // convention: material name in small letters (to be able to find materials regardless of capitalisation
00190   
00191   // solid materials
00192   // metals
00193   
00194   G4Material* tmpMaterial = new G4Material
00195     (name="aluminium"     , density=  2.700*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00196   tmpMaterial->AddElement(elements["Al"],1);
00197   materials[name] = tmpMaterial; 
00198 
00199   tmpMaterial = new G4Material
00200     (name="beryllium"     , density=  1.848*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00201   tmpMaterial->AddElement(elements["Be"],1);
00202   materials[name] = tmpMaterial; 
00203 
00204   tmpMaterial = new G4Material
00205     (name="copper"        , density=  8.96 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00206   tmpMaterial->AddElement(elements["Cu"],1);
00207   materials[name] = tmpMaterial; 
00208 
00209   tmpMaterial = new G4Material
00210     (name="graphite"      , density=  2.265*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00211   tmpMaterial->AddElement(elements["C"],1);
00212   materials[name] = tmpMaterial; 
00213 
00214   tmpMaterial = new G4Material
00215     (name="graphitefoam"      , density=  0.61*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00216   tmpMaterial->AddElement(elements["C"],1);
00217   materials[name] = tmpMaterial; 
00218 
00219   tmpMaterial = new G4Material
00220     (name="iron"          , density=  7.874 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00221   tmpMaterial->AddElement(elements["Fe"],1);
00222   materials[name] = tmpMaterial; 
00223 
00224   tmpMaterial = new G4Material
00225     (name="weightiron"    , density=  7.87 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00226   tmpMaterial->AddElement(elements["Fe"],1);
00227   materials[name] = tmpMaterial; 
00228 
00229   tmpMaterial = new G4Material
00230     (name="lead"          , density= 11.35 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00231   tmpMaterial->AddElement(elements["Pb"],1);
00232   materials[name] = tmpMaterial; 
00233 
00234   tmpMaterial = new G4Material
00235     (name="silicon"       , density=  2.33 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00236   tmpMaterial->AddElement(elements["Si"],1);
00237   materials[name] = tmpMaterial; 
00238 
00239   tmpMaterial = new G4Material
00240     (name="titanium"      , density=  4.54 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00241   tmpMaterial->AddElement(elements["Ti"],1);
00242   materials[name] = tmpMaterial; 
00243 
00244   tmpMaterial = new G4Material
00245     (name="tungsten"      , density= 19.3  *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00246   tmpMaterial->AddElement(elements["W"],1);
00247   materials[name] = tmpMaterial; 
00248 
00249   tmpMaterial = new G4Material
00250     (name="uranium"          , density=  18.9 *CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00251   tmpMaterial->AddElement(elements["U"],1);
00252   materials[name] = tmpMaterial; 
00253 
00254   tmpMaterial = new G4Material
00255     (name="vanadium"      , density=  5.800*CLHEP::g/CLHEP::cm3, 1, kStateSolid);
00256   tmpMaterial->AddElement(elements["V"],1);
00257   materials[name] = tmpMaterial; 
00258 
00259   // composites and alloys
00260 
00261   tmpMaterial = new G4Material
00262     (name="leadtungstate" , density=  8.27 *CLHEP::g/CLHEP::cm3, 3, kStateSolid);
00263   tmpMaterial->AddElement(elements["Pb"], 1);
00264   tmpMaterial->AddElement(elements["W"], 1);
00265   tmpMaterial->AddElement(elements["O"], 4);
00266   materials[name] = tmpMaterial; 
00267 
00268   tmpMaterial = new G4Material
00269     (name="smco"          , density=  8.4  *CLHEP::g/CLHEP::cm3, 2, kStateSolid, 300*CLHEP::kelvin);
00270   tmpMaterial->AddElement(elements["Sm"],fractionmass=0.338);
00271   tmpMaterial->AddElement(elements["Co"],fractionmass=0.662);
00272   materials[name] = tmpMaterial; 
00273 
00274   //Titanium alloy (BDS collimator material SLAC-TN-03-069 p25) deacon 15 Jun 2007
00275   tmpMaterial = new G4Material
00276     (name="titaniumalloy" , density=  4.48 *CLHEP::g/CLHEP::cm3, 3, kStateSolid, 300*CLHEP::kelvin);
00277   tmpMaterial->AddElement(elements["V"],  fractionmass=0.025);
00278   tmpMaterial->AddElement(elements["Al"], fractionmass=0.03 );
00279   tmpMaterial->AddElement(elements["Ti"], fractionmass=0.945);
00280   materials[name] = tmpMaterial; 
00281 
00282   //Carbon Steel (shell of cryomodule). LDeacon 21 Feb 2006
00283   tmpMaterial = new G4Material
00284     (name="carbonsteel"   , density=  7.87 *CLHEP::g/CLHEP::cm3, 5, kStateSolid, 100*CLHEP::kelvin);
00285   tmpMaterial->AddElement(elements["C"], fractionmass=0.0017);
00286   tmpMaterial->AddElement(elements["Mn"], fractionmass=0.0045);
00287   tmpMaterial->AddElement(elements["P"], fractionmass=0.0004);
00288   tmpMaterial->AddElement(elements["S"], fractionmass=0.0005);
00289   tmpMaterial->AddElement(elements["Fe"], fractionmass=0.9929);
00290   materials[name] = tmpMaterial; 
00291 
00292   //Stainless Steel 316L
00293   tmpMaterial = new G4Material
00294     (name="stainlesssteel"   , density=  8000 *CLHEP::kg/CLHEP::m3, 10, kStateSolid, 295*CLHEP::kelvin);
00295   tmpMaterial->AddElement(elements["C"], fractionmass=0.0003);
00296   tmpMaterial->AddElement(elements["Mn"], fractionmass=0.02);
00297   tmpMaterial->AddElement(elements["Si"], fractionmass=0.0075);
00298   tmpMaterial->AddElement(elements["P"], fractionmass=0.00045);
00299   tmpMaterial->AddElement(elements["S"], fractionmass=0.0003);
00300   tmpMaterial->AddElement(elements["Cr"], fractionmass=0.17);
00301   tmpMaterial->AddElement(elements["Mo"], fractionmass=0.025);
00302   tmpMaterial->AddElement(elements["Ni"], fractionmass=0.12);
00303   tmpMaterial->AddElement(elements["N"], fractionmass=0.001);
00304   tmpMaterial->AddElement(elements["Fe"], fractionmass=0.65545);
00305   materials[name] = tmpMaterial; 
00306 
00307   // superconducting materials
00308   // niobium at 2K
00309   tmpMaterial = new G4Material
00310     (name="niobium"       , density=  8.57 *CLHEP::g/CLHEP::cm3, 1, kStateSolid, 2*CLHEP::kelvin);
00311   tmpMaterial->AddElement(elements["Nb"],1);
00312   materials[name] = tmpMaterial; 
00313   // niobium titanium at 4K
00314   tmpMaterial = new G4Material
00315     (name="nbti"          , density=  5.6  *CLHEP::g/CLHEP::cm3, 2, kStateSolid, 4*CLHEP::kelvin);
00316   tmpMaterial->AddElement(elements["Nb"], 1);
00317   tmpMaterial->AddElement(elements["Ti"], 1);
00318   materials[name] = tmpMaterial; 
00319 
00320   // non-metal solids
00321   
00322   tmpMaterial = new G4Material
00323     (name="bn5000"      , density=  1.925  *CLHEP::g/CLHEP::cm3, 5, kStateSolid, 300*CLHEP::kelvin);
00324   tmpMaterial->AddElement(elements["B"], 0.383249242);//0.418535);
00325   tmpMaterial->AddElement(elements["Ni"], 0.472071387);//0.515535);
00326   tmpMaterial->AddElement(elements["O"], 0.0366276887);//0.04);
00327   tmpMaterial->AddElement(elements["Ca"], 0.0228923054);//0.025);
00328   tmpMaterial->AddElement(elements["Si"], 0.0851593762);//0.093);
00329   materials[name] = tmpMaterial; 
00330 
00331   //Calcium carbonate
00332   tmpMaterial = new G4Material
00333     (name="calciumCarbonate", density=  1201  *CLHEP::kg/CLHEP::m3, 3, kStateSolid, 300*CLHEP::kelvin);
00334   tmpMaterial->AddElement(elements["Ca"],1);
00335   tmpMaterial->AddElement(elements["O"], 3);
00336   tmpMaterial->AddElement(elements["C"], 1);
00337   materials[name] = tmpMaterial; 
00338 
00339   //Clay
00340   tmpMaterial = new G4Material
00341     (name="clay", density=  1746  *CLHEP::kg/CLHEP::m3, 4, kStateSolid, 300*CLHEP::kelvin);
00342   tmpMaterial->AddElement(elements["Al"],1);
00343   tmpMaterial->AddElement(elements["O"], 9);
00344   tmpMaterial->AddElement(elements["Si"], 2);
00345   tmpMaterial->AddElement(elements["H"], 4);
00346   materials[name] = tmpMaterial; 
00347 
00348   tmpMaterial = new G4Material
00349     (name="concrete"      , density=  2.3  *CLHEP::g/CLHEP::cm3, 6, kStateSolid, 300*CLHEP::kelvin);
00350   tmpMaterial->AddElement(elements["Si"], 0.227915);
00351   tmpMaterial->AddElement(elements["O"], 0.60541);
00352   tmpMaterial->AddElement(elements["H"], 0.09972);
00353   tmpMaterial->AddElement(elements["Ca"], 0.04986);
00354   tmpMaterial->AddElement(elements["Al"], 0.014245);
00355   tmpMaterial->AddElement(elements["Fe"], 0.00285);
00356   materials[name] = tmpMaterial; 
00357   
00358   tmpMaterial = new G4Material(name="lhcconcrete", density= 2.42*CLHEP::g/CLHEP::cm3,
00359                                20, kStateSolid, 300*CLHEP::kelvin);
00360   tmpMaterial->AddElement(elements["H"], 0.59785345499811  *CLHEP::perCent);
00361   tmpMaterial->AddElement(elements["C"], 5.59989402848226  *CLHEP::perCent);
00362   tmpMaterial->AddElement(elements["O"], 49.1111702720319  *CLHEP::perCent);
00363   tmpMaterial->AddElement(elements["Na"], 0.45137935852357 *CLHEP::perCent);
00364   tmpMaterial->AddElement(elements["Mg"], 0.66062806777291 *CLHEP::perCent);
00365   tmpMaterial->AddElement(elements["Al"], 2.05561946276849 *CLHEP::perCent);
00366   tmpMaterial->AddElement(elements["Si"], 18.7995018924154 *CLHEP::perCent);
00367   tmpMaterial->AddElement(elements["K"], 0.65365311079793  *CLHEP::perCent);
00368   tmpMaterial->AddElement(elements["Ca"], 20.0191229406116 *CLHEP::perCent);
00369   tmpMaterial->AddElement(elements["Fe"], 1.11400027114647 *CLHEP::perCent);
00370   tmpMaterial->AddElement(elements["P"], 0.04782827639985  *CLHEP::perCent);
00371   tmpMaterial->AddElement(elements["S"], 0.01195706909996  *CLHEP::perCent);
00372   tmpMaterial->AddElement(elements["Ti"], 0.3457585814739  *CLHEP::perCent);
00373   tmpMaterial->AddElement(elements["Mn"], 0.03856154784738 *CLHEP::perCent);
00374   tmpMaterial->AddElement(elements["Zn"], 0.02401378044242 *CLHEP::perCent);
00375   tmpMaterial->AddElement(elements["Zr"], 0.00737352594498 *CLHEP::perCent);
00376   tmpMaterial->AddElement(elements["Ba"], 0.01783596140744 *CLHEP::perCent);
00377   tmpMaterial->AddElement(elements["Pb"], 0.04623400051985 *CLHEP::perCent);
00378   tmpMaterial->AddElement(elements["Sr"], 0.39757254757374 *CLHEP::perCent);
00379   tmpMaterial->AddElement(elements["Eu"], 4.184974185E-05  *CLHEP::perCent);
00380   materials[name] = tmpMaterial; 
00381 
00382   tmpMaterial = new G4Material 
00383     (name="fusedsilica", density=1.032*CLHEP::g/CLHEP::cm3, 2, kStateSolid);
00384   tmpMaterial->AddElement(elements["O"],2);
00385   tmpMaterial->AddElement(elements["Si"],1);
00386   const G4int FusedSilica_NUMENTRIES = 3; //Number of entries in the material properties table
00387   G4double FusedSilica_RIND[FusedSilica_NUMENTRIES]={1.49,1.49,1.49};
00388   G4double FusedSilica_AbsLength[FusedSilica_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
00389   G4double FusedSilica_Energy[FusedSilica_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
00390   fsMaterialPropertiesTable= new G4MaterialPropertiesTable();
00391   fsMaterialPropertiesTable->AddProperty("ABSLENGTH",FusedSilica_Energy,FusedSilica_AbsLength,FusedSilica_NUMENTRIES);
00392   fsMaterialPropertiesTable->AddProperty("RINDEX",FusedSilica_Energy,FusedSilica_RIND,FusedSilica_NUMENTRIES);
00393   tmpMaterial->SetMaterialPropertiesTable(fsMaterialPropertiesTable);
00394   materials[name] = tmpMaterial; 
00395 
00396   //Invar.Temperature 2 kelvin. LDeacon 6th Feburary 2006
00397   tmpMaterial = new G4Material
00398     (name="invar"         , density=  8.1  *CLHEP::kg/CLHEP::m3, 2, kStateSolid, 2*CLHEP::kelvin);
00399   tmpMaterial->AddElement(elements["Ni"], fractionmass=0.35);
00400   tmpMaterial->AddElement(elements["Fe"], fractionmass=0.65);
00401   materials[name] = tmpMaterial; 
00402 
00403   //Kapton polyimide film
00404   tmpMaterial = new G4Material
00405     (name="kapton", density=  1.42 *CLHEP::g/CLHEP::cm3, 4, kStateSolid, 295*CLHEP::kelvin);
00406   tmpMaterial->AddElement(elements["H"], fractionmass=0.026362);
00407   tmpMaterial->AddElement(elements["C"], fractionmass=0.691133);
00408   tmpMaterial->AddElement(elements["N"], fractionmass=0.073270);
00409   tmpMaterial->AddElement(elements["O"], fractionmass=0.209235);
00410   materials[name] = tmpMaterial; 
00411 
00412   //n-bk7
00413   tmpMaterial = new G4Material 
00414     (name="n-bk7", density=1.032*CLHEP::g/CLHEP::cm3, 2, kStateSolid);
00415   tmpMaterial->AddElement(elements["O"],2);
00416   tmpMaterial->AddElement(elements["Si"],1);
00417   const G4int N_Bk7_NUMENTRIES = 3; //Number of entries in the material properties table
00418   G4double N_Bk7_RIND[N_Bk7_NUMENTRIES]={1.51680,1.51680,1.51680};
00419   G4double N_Bk7_AbsLength[N_Bk7_NUMENTRIES]={420.*CLHEP::cm,420.*CLHEP::cm,420.*CLHEP::cm};
00420   G4double N_Bk7_Energy[N_Bk7_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV};
00421   G4MaterialPropertiesTable* nbk7MaterialPropertiesTable= new G4MaterialPropertiesTable();
00422   nbk7MaterialPropertiesTable->AddProperty("ABSLENGTH",N_Bk7_Energy,N_Bk7_AbsLength,N_Bk7_NUMENTRIES);
00423   nbk7MaterialPropertiesTable->AddProperty("RINDEX",N_Bk7_Energy,N_Bk7_RIND,N_Bk7_NUMENTRIES);
00424   tmpMaterial->SetMaterialPropertiesTable(nbk7MaterialPropertiesTable);
00425   materials[name] = tmpMaterial; 
00426 
00427   //quartz
00428   tmpMaterial = new G4Material
00429     (name="quartz", density=  2.655  *CLHEP::g/CLHEP::cm3, 2, kStateSolid, 300*CLHEP::kelvin);
00430   tmpMaterial->AddElement(elements["Si"],1);
00431   tmpMaterial->AddElement(elements["O"], 2);
00432   materials[name] = tmpMaterial; 
00433 
00434   // marl
00435   tmpMaterial = new G4Material
00436     (name="marl"          , density=1474*CLHEP::kg/CLHEP::m3, 2, kStateSolid, 300*CLHEP::kelvin);
00437   tmpMaterial->AddMaterial(materials["clay"], 0.5 );
00438   tmpMaterial->AddMaterial(materials["calciumCarbonate"],0.5);
00439   materials[name] = tmpMaterial; 
00440 
00441   //clayousMarl
00442   tmpMaterial = new G4Material
00443     (name="clayousMarl"          , density=1555*CLHEP::kg/CLHEP::m3, 2, kStateSolid, 300*CLHEP::kelvin);
00444   tmpMaterial->AddMaterial(materials["clay"], 0.65 );
00445   tmpMaterial->AddMaterial(materials["calciumCarbonate"],0.35);
00446   materials[name] = tmpMaterial; 
00447 
00448   //limousMarl
00449   tmpMaterial = new G4Material
00450     (name="limousMarl"          , density=1392*CLHEP::kg/CLHEP::m3, 2, kStateSolid, 300*CLHEP::kelvin);
00451   tmpMaterial->AddMaterial(materials["clay"], 0.35 );
00452   tmpMaterial->AddMaterial(materials["calciumCarbonate"],0.65);
00453   materials[name] = tmpMaterial; 
00454 
00455   // "standard" soil (dry)
00456   tmpMaterial = new G4Material
00457     (name="soil"          , density=  1.9  *CLHEP::g/CLHEP::cm3, 4, kStateSolid, 300*CLHEP::kelvin);
00458   tmpMaterial->AddElement(elements["Si"],0.33377483443708611 );
00459   tmpMaterial->AddElement(elements["O"], 0.57218543046357617);
00460   tmpMaterial->AddElement(elements["H"], 0.022516556291390728);
00461   tmpMaterial->AddElement(elements["Al"], 0.071523178807947022);
00462   materials[name] = tmpMaterial; 
00463 
00464   // Epoxy Resin components
00465   //The main component of epoxy resin commonly used to insulate magnet coils.
00466   G4int natoms;
00467   tmpMaterial = new G4Material
00468     (name="aralditef", density = 1.175*CLHEP::g/CLHEP::cm3, 3, kStateSolid, 300*CLHEP::kelvin);
00469   tmpMaterial->AddElement(elements["C"], natoms=12);
00470   tmpMaterial->AddElement(elements["H"], natoms=18);
00471   tmpMaterial->AddElement(elements["O"], natoms=4);
00472   materials[name] = tmpMaterial;
00473 
00474   //A hardener for the epoxy resin
00475   tmpMaterial = new G4Material
00476     (name="hy906", density = 1.225*CLHEP::g/CLHEP::cm3, 3, kStateSolid, 300*CLHEP::kelvin);
00477   tmpMaterial->AddElement(elements["C"], natoms=10);
00478   tmpMaterial->AddElement(elements["H"], natoms=5);
00479   tmpMaterial->AddElement(elements["O"], natoms=3);
00480   materials[name] = tmpMaterial;
00481 
00482   //An accelerator for epoxy resin
00483   tmpMaterial = new G4Material
00484     (name="dy061", density = 1.025*CLHEP::g/CLHEP::cm3, 4, kStateSolid, 300*CLHEP::kelvin);
00485   tmpMaterial->AddElement(elements["C"], natoms=15);
00486   tmpMaterial->AddElement(elements["H"], natoms=25 );
00487   tmpMaterial->AddElement(elements["O"], natoms=1 );
00488   tmpMaterial->AddElement(elements["N"], natoms=3 );
00489   materials[name] = tmpMaterial;
00490 
00491   //Material type 3 from CERN 81-05, "The Selection and Properties of Epoxide Resins Used for the Insulation of Magnet Systems in Radiation Environments".
00492   tmpMaterial = new G4Material
00493     (name="epoxyresin3", density = 1.20*CLHEP::g/CLHEP::cm3, 3, kStateSolid, 300*CLHEP::kelvin);
00494   tmpMaterial->AddMaterial(materials["aralditef"],fractionmass=0.497512);
00495   tmpMaterial->AddMaterial(materials["hy906"],fractionmass=0.497512);
00496   tmpMaterial->AddMaterial(materials["dy061"],fractionmass=0.004976);
00497   materials[name] = tmpMaterial;
00498   
00499   //scintillator materials
00500   //YAG
00501   tmpMaterial = new G4Material(name="yag", density=4.56*CLHEP::g/CLHEP::cm3, 3);
00502   tmpMaterial->AddElement(elements["Y"],3);
00503   tmpMaterial->AddElement(elements["Al"],5);
00504   tmpMaterial->AddElement(elements["O"],12);
00505   G4double birks = 0.08*CLHEP::mm/CLHEP::MeV; 
00506   tmpMaterial->GetIonisation()->SetBirksConstant(birks);
00507   G4MaterialPropertiesTable* mpt_YAG = new G4MaterialPropertiesTable();
00508   //  const int nEntries3=60;
00509   const G4int nEntries = 9;
00510   G4double PhotonEnergyYAG[nEntries];
00511   G4double dNEntries2=(G4double)nEntries;
00512   G4double energyMin=1.91*CLHEP::eV;
00513   G4double energyMax=2.76*CLHEP::eV;
00514   G4double deltaEnergy=(energyMax-energyMin)/(dNEntries2-1.0);
00515   G4double energy=energyMin;
00516   for(G4int i=0; i<nEntries; energy += deltaEnergy, i++){
00517     PhotonEnergyYAG[i]=energy;
00518   }
00519   G4double RefractiveIndexYAG[nEntries] = //Approximately correct, but check for different wavelengths
00520     { 1.82, 1.82, 1.82, 1.82, 1.82, 1.82, 1.82,
00521       1.82, 1.82 };
00522   G4double scintFastYAG[nEntries] = //Approximately correct
00523     { 0, 0.25, 2.0, 14.0, 13.0, 7.0, 4.0, 2.0, 0.0 };
00524   //  const G4int nEntries2 = 32;
00525   /*  G4double PhotonEnergy[nEntries2] =
00526     { 2.034*CLHEP::eV, 2.068*CLHEP::eV, 2.103*CLHEP::eV, 2.139*CLHEP::eV,
00527       2.177*CLHEP::eV, 2.216*CLHEP::eV, 2.256*CLHEP::eV, 2.298*CLHEP::eV,
00528       2.341*CLHEP::eV, 2.386*CLHEP::eV, 2.433*CLHEP::eV, 2.481*CLHEP::eV,
00529       2.532*CLHEP::eV, 2.585*CLHEP::eV, 2.640*CLHEP::eV, 2.697*CLHEP::eV,
00530       2.757*CLHEP::eV, 2.820*CLHEP::eV, 2.885*CLHEP::eV, 2.954*CLHEP::eV,
00531       3.026*CLHEP::eV, 3.102*CLHEP::eV, 3.181*CLHEP::eV, 3.265*CLHEP::eV,
00532       3.353*CLHEP::eV, 3.446*CLHEP::eV, 3.545*CLHEP::eV, 3.649*CLHEP::eV,
00533       3.760*CLHEP::eV, 3.877*CLHEP::eV, 4.002*CLHEP::eV, 4.136*CLHEP::eV };
00534   */
00535   mpt_YAG->AddProperty("FASTCOMPONENT",PhotonEnergyYAG, scintFastYAG, nEntries)->SetSpline(true);
00536   mpt_YAG->AddProperty("RINDEX",PhotonEnergyYAG, RefractiveIndexYAG, nEntries);
00537   mpt_YAG->AddConstProperty("SCINTILLATIONYIELD",8000./CLHEP::MeV); //Approximately correct
00538   mpt_YAG->AddConstProperty("RESOLUTIONSCALE",2.0); //Check this
00539   mpt_YAG->AddConstProperty("FASTTIMECONSTANT",70.*CLHEP::ns); //Approximately correct
00540   mpt_YAG->AddConstProperty("YIELDRATIO",1.0);
00541   tmpMaterial->SetMaterialPropertiesTable(mpt_YAG);
00542   materials[name] = tmpMaterial;
00543 
00544   //UPS-923A  - see http://www.amcrys-h.com/
00545   //Define the material properties (copy from NIST table of materials).
00546   G4Material* polystyrene = G4NistManager::Instance()->FindOrBuildMaterial("G4_POLYSTYRENE",true,true);
00547   tmpMaterial = new G4Material(name="ups923a",density=polystyrene->GetDensity(),1);
00548   tmpMaterial->AddMaterial(polystyrene,1);
00549   tmpMaterial->SetName(name.c_str());
00550   //Define the optical properties.
00551   const G4int ups923a_numentries = 67;
00552   
00553   G4double ups923a_PhotonEnergy[ups923a_numentries]   = {
00554     3.35,    3.31,    3.28,    3.26,    3.25,    3.23,    3.23,
00555     3.22,    3.21,    3.19,    3.18,    3.17,    3.16,    3.15,
00556     3.14,    3.14,    3.13,    3.11,    3.1,    3.09,    3.09,
00557     3.08,    3.07,    3.04,    3.02,    3.02,    3.01,    2.99,
00558     2.98,    2.97,    2.97,    2.95,    2.95,    2.93,    2.93,
00559     2.92,    2.92,    2.91,    2.89,    2.88,    2.87,    2.86,
00560     2.85,    2.83,    2.81,    2.8,    2.79,    2.78,    2.76,
00561     2.74,    2.72,    2.71,    2.68,    2.66,    2.64,    2.62,
00562     2.61,    2.58,    2.55,    2.53,    2.5,    2.48,    2.46,
00563     2.44,    2.41,    2.38,    2.35  };      
00564   
00565   G4double ups923a_emission[ups923a_numentries]   = {
00566     0,    0.04,    0.11,    0.2,    0.3,    0.4,    0.52,
00567     0.62,    0.67,    0.68,    0.67,    0.62,    0.53,    0.48,
00568     0.44,    0.42,    0.4,    0.41,    0.42,    0.51,    0.46,
00569     0.57,    0.67,    0.78,    0.91,    0.93,    0.95,    0.96,
00570     0.94,    0.91,    0.85,    0.76,    0.67,    0.61,    0.57,
00571     0.55,    0.52,    0.51,    0.52,    0.54,    0.57,    0.58,
00572     0.6,    0.6,    0.59,    0.58,    0.55,    0.48,    0.42,
00573     0.37,    0.33,    0.31,    0.29,    0.28,    0.26,    0.24,
00574     0.2,    0.17,    0.12,    0.09,    0.08,    0.07,
00575     0.06,    0.04,    0.02,    0.01,    0.01  };
00576   
00577   G4MaterialPropertiesTable* ups923a_mt = new G4MaterialPropertiesTable();
00578   ups923a_mt->AddConstProperty("RESOLUTIONSCALE",2.0); //Check this
00579   ups923a_mt->AddConstProperty("FASTTIMECONSTANT",3.3*CLHEP::ns);
00580   ups923a_mt->AddConstProperty("YIELDRATIO",1.0);
00581   //Birk's constant
00582   birks = (0.014/1.06)*CLHEP::cm/CLHEP::MeV; 
00583   tmpMaterial->GetIonisation()->SetBirksConstant(birks);
00584   ups923a_mt->AddProperty("FASTCOMPONENT",ups923a_PhotonEnergy, ups923a_emission, ups923a_numentries)->SetSpline(true);
00585   ups923a_mt->AddConstProperty("RINDEX", 1.52);
00586   ups923a_mt->AddConstProperty("ABSLENGTH", 1*CLHEP::m);
00587   G4double scintYieldAnthracene=14200; //Anthracene yield per 1 CLHEP::MeV
00588   G4double scintYieldUPS923A=scintYieldAnthracene*0.60;//60% of anthracene
00589   ups923a_mt->AddConstProperty("SCINTILLATIONYIELD",scintYieldUPS923A/CLHEP::MeV);
00590   tmpMaterial->SetMaterialPropertiesTable(ups923a_mt);
00591   //Put into the materials array.
00592   materials[name]=tmpMaterial;
00593 
00594   //PET (Dacron)
00595   tmpMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_DACRON",true,true);
00596   name="pet";
00597   const G4int Pet_NUMENTRIES = 3; //Number of entries in the material properties table
00598   G4double Pet_RIND[Pet_NUMENTRIES] = {1.570,1.570,1.570};//Assume constant refractive index.
00599   G4double Pet_Energy[Pet_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV}; //The energies.
00600   petMaterialPropertiesTable=new G4MaterialPropertiesTable();
00601   petMaterialPropertiesTable->AddProperty("RINDEX",Pet_Energy, Pet_RIND, Pet_NUMENTRIES);
00602   tmpMaterial->SetMaterialPropertiesTable(petMaterialPropertiesTable);
00603   materials[name]=tmpMaterial;
00604 
00605   //Cellulose
00606   tmpMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_CELLULOSE_CELLOPHANE",true,true);
00607   name="cellulose";
00608   const G4int Cellulose_NUMENTRIES = 3; //Number of entries in the material properties table
00609   G4double Cellulose_RIND[Cellulose_NUMENTRIES] = {1.532,1.532,1.532};//Assume constant refractive index.
00610   G4double Cellulose_Energy[Cellulose_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV}; //The energies.
00611   celluloseMaterialPropertiesTable=new G4MaterialPropertiesTable();
00612   celluloseMaterialPropertiesTable->AddProperty("RINDEX",Cellulose_Energy, Cellulose_RIND, Cellulose_NUMENTRIES);
00613   tmpMaterial->SetMaterialPropertiesTable(celluloseMaterialPropertiesTable);
00614   materials[name] = tmpMaterial;
00615 
00616 
00617   //Polyurethane
00618   tmpMaterial = new G4Material(name="polyurethane", density=1.05*CLHEP::g/CLHEP::cm3, 4);
00619   tmpMaterial->AddElement(elements["C"],6);
00620   tmpMaterial->AddElement(elements["H"],10);
00621   tmpMaterial->AddElement(elements["N"],2);
00622   tmpMaterial->AddElement(elements["O"],4);
00623   materials[name]=tmpMaterial;
00624 
00626   // Superconducting components of LHC magnet elements
00627   // Definitions taken from FLUKA
00628 
00629   // Liquid helium at 1.9K  
00630   tmpMaterial = new G4Material(name="lhe_1.9k", 0.1472*CLHEP::g/CLHEP::cm3, 1, kStateLiquid, 1.9*CLHEP::kelvin);
00631   tmpMaterial->AddElement(elements["He"],1);
00632   materials[name]=tmpMaterial;
00633 
00634   // Niobium @ 87K
00635   tmpMaterial = new G4Material(name="nb_87k", density=8.902*CLHEP::g/CLHEP::cm3, 1, kStateSolid, 87*CLHEP::kelvin);
00636   tmpMaterial->AddElement(elements["Nb"],1);
00637   materials[name]=tmpMaterial;
00638   
00639   // Titanium @ 87K
00640   tmpMaterial = new G4Material(name="ti_87k", density=4.54*CLHEP::g/CLHEP::cm3, 1, kStateSolid, 87*CLHEP::kelvin);
00641   tmpMaterial->AddElement(elements["Ti"],1);
00642   materials[name]=tmpMaterial;  
00643 
00644   // superconductor NbTi with Ti = 47% by weight
00645   tmpMaterial = new G4Material(name="nbti_87k", density=6.0471*CLHEP::g/CLHEP::cm3, 2, kStateSolid, 87*CLHEP::kelvin);
00646   tmpMaterial->AddMaterial(GetMaterial("Nb_87K"),fractionmass=0.53);
00647   tmpMaterial->AddMaterial(GetMaterial("Ti_87K"),fractionmass=0.47);
00648   materials[name]=tmpMaterial;
00649 
00650   // copper at 4 Kelvin
00651   tmpMaterial = new G4Material(name="cu_4k", density=8.96*CLHEP::g/CLHEP::cm3, 1, kStateSolid, 4*CLHEP::kelvin);
00652   tmpMaterial->AddElement(elements["Cu"],1);
00653   materials[name]=tmpMaterial;
00654   
00655   // naked superconductor NbTi wire with Cu/SC volume ratio (>= 4.0 and <4.8)
00656   tmpMaterial = new G4Material(name="nbti.1", density=8.4206*CLHEP::g/CLHEP::cm3, 2);
00657   tmpMaterial->AddMaterial(GetMaterial("nbti_87k"),fractionmass=1.0/5.4);
00658   tmpMaterial->AddMaterial(GetMaterial("cu_4k"),fractionmass=4.4/5.4);
00659   materials[name]=tmpMaterial;
00660   
00662 
00663   //Gadolinium oxysulphate Gd_2 O_2 S
00664   G4Material* GOS = G4NistManager::Instance()->FindOrBuildMaterial("G4_GADOLINIUM_OXYSULFIDE",true,true);
00665 
00666   //Ganolinium oxysulphate in a polyurethane elastomer (lanex)
00667   G4double fill_factor=0.5;
00668   G4double lanex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*GetMaterial("polyurethane")->GetDensity();
00669   G4double gos_fraction_by_mass=fill_factor*GOS->GetDensity()/lanex_density;
00670   G4double pur_fraction_by_mass=1-gos_fraction_by_mass;
00671   tmpMaterial = new G4Material(name="lanex", density=lanex_density, 2);
00672   tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
00673   tmpMaterial->AddMaterial(GetMaterial("polyurethane"), pur_fraction_by_mass);
00674   G4MaterialPropertiesTable* mptLanex = new G4MaterialPropertiesTable();
00675   const G4int nentLanex=2;
00676   G4double rindex=1.50;//(1.82+1.50)/2.0;
00677   G4double energytab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
00678   G4double rindextab[]={rindex, rindex};
00679   G4double emitspec[]={1.0, 1.0};
00680   G4double abslen[]={7*CLHEP::mm, 7*CLHEP::mm};
00681   mptLanex->AddProperty("RINDEX",energytab, rindextab, nentLanex); //Average refractive index of bulk material
00682   mptLanex->AddProperty("ABSLENGTH", energytab, abslen, nentLanex);
00683   mptLanex->AddProperty("FASTCOMPONENT",energytab, emitspec, nentLanex);
00684   G4double scintScalingFactor=1;
00685   mptLanex->AddConstProperty("SCINTILLATIONYIELD",7.8e4/CLHEP::MeV);
00686   mptLanex->AddConstProperty("RESOLUTIONSCALE",1.0);
00687   mptLanex->AddConstProperty("FASTTIMECONSTANT", 1.*CLHEP::ns);
00688   mptLanex->AddConstProperty("MIEHG", 60.3e-3*CLHEP::mm);
00689   mptLanex->AddConstProperty("MIEHG_FORWARD", 0.91);
00690   mptLanex->AddConstProperty("MIEHG_BACKWARD", 0.91);
00691   mptLanex->AddConstProperty("MIEHG_FORWARD_RATIO", 1.0);
00692   tmpMaterial->SetMaterialPropertiesTable(mptLanex);
00693   materials[name]=tmpMaterial;
00694 
00695   //Ganolinium oxysulphate in a polyurethane elastomer (lanex) - version 2
00696   tmpMaterial = new G4Material(name="lanex2", density=lanex_density, 2);
00697   tmpMaterial->AddMaterial(GOS, gos_fraction_by_mass);
00698   tmpMaterial->AddMaterial(GetMaterial("polyurethane"), pur_fraction_by_mass);
00699   G4MaterialPropertiesTable* mptLanex2 = new G4MaterialPropertiesTable();
00700   mptLanex2->AddProperty("RINDEX",energytab, rindextab, nentLanex); //Average refractive index of bulk material
00701   mptLanex2->AddProperty("ABSLENGTH", energytab, abslen, nentLanex);
00702   mptLanex2->AddProperty("FASTCOMPONENT",energytab, emitspec, nentLanex);
00703   mptLanex2->AddConstProperty("SCINTILLATIONYIELD",8.9e4/CLHEP::MeV);
00704   mptLanex2->AddConstProperty("RESOLUTIONSCALE",1.0);
00705   mptLanex2->AddConstProperty("FASTTIMECONSTANT", 1.*CLHEP::ns);
00706   mptLanex2->AddConstProperty("MIEHG", 60.3e-3*CLHEP::mm);
00707   mptLanex2->AddConstProperty("MIEHG_FORWARD", 0.91);
00708   mptLanex2->AddConstProperty("MIEHG_BACKWARD", 0.91);
00709   mptLanex2->AddConstProperty("MIEHG_FORWARD_RATIO", 0.5);
00710   tmpMaterial->SetMaterialPropertiesTable(mptLanex);
00711   materials[name]=tmpMaterial;
00712 
00713   //gos_lanex - GOS with the bulk optical transport properties of lanex particles suspended in an elastomer but the atomic, density and scintillation properties of GOS
00714   G4double gos_lanex_density=GOS->GetDensity();
00715   tmpMaterial = new G4Material(name="gos_lanex", density=gos_lanex_density, 1);
00716   tmpMaterial->AddMaterial(GOS, 1.0);
00717   G4MaterialPropertiesTable* mptGOSLanex = new G4MaterialPropertiesTable();
00718   const G4int nentGOSLanex=2;
00719   G4double rindexGOSLanex=1.50;
00720   G4double energyGOSLanexTab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
00721   G4double rindexGOSLanexTab[]={rindexGOSLanex, rindexGOSLanex};
00722   G4double emitspecGOSLanex[]={1.0, 1.0};
00723   G4double abslenGOSLanex[]={7*CLHEP::mm, 7*CLHEP::mm};
00724   G4double mieScatteringLengthGOSLanex=60.3*CLHEP::um;
00725   G4double gosLanexMiehgForward=0.911;
00726   G4double gosLanexMiehgBackward=0.911;
00727   G4double gosLanexMiehgForwardRatio=0.5;
00728   G4double mieHgTimeConst=1.0*CLHEP::ns;
00729   mptGOSLanex->AddProperty("FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
00730   mptGOSLanex->AddConstProperty("SCINTILLATIONYIELD",8.9e4/CLHEP::MeV); //Intrinisic scintilation yield of GOS
00731   mptGOSLanex->AddConstProperty("RESOLUTIONSCALE", 1.0);
00732   mptGOSLanex->AddConstProperty("FASTTIMECONSTANT", mieHgTimeConst);
00733   mptGOSLanex->AddConstProperty("YIELDRATIO", 1.0);
00734   mptGOSLanex->AddConstProperty("MIEHG", mieScatteringLengthGOSLanex);
00735   mptGOSLanex->AddConstProperty("MIEHG_FORWARD", gosLanexMiehgForward);
00736   mptGOSLanex->AddConstProperty("MIEHG_BACKWARD", gosLanexMiehgBackward);
00737   mptGOSLanex->AddConstProperty("MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
00738   mptGOSLanex->AddProperty("RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex); //Average refractive index of bulk material
00739   mptGOSLanex->AddProperty("ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
00740   tmpMaterial->SetMaterialPropertiesTable(mptGOSLanex);
00741   materials[name]=tmpMaterial;
00742 
00743   //Same as gos_lanex but refractive index = 1
00744   tmpMaterial = new G4Material(name="gos_ri1", density=gos_lanex_density, 1);
00745   tmpMaterial->AddMaterial(GOS, 1.0);
00746   G4MaterialPropertiesTable* mptGOSLanexRi1 = new G4MaterialPropertiesTable();
00747   G4double rindexGOSLanexRi1Tab[]={1.0, 1.0};
00748   mptGOSLanexRi1->AddProperty("FASTCOMPONENT",energyGOSLanexTab, emitspecGOSLanex, nentGOSLanex);
00749   mptGOSLanexRi1->AddConstProperty("SCINTILLATIONYIELD",8.9e4/CLHEP::MeV); //Intrinisic scintilation yield of GOS
00750   mptGOSLanexRi1->AddConstProperty("RESOLUTIONSCALE", 1.0);
00751   mptGOSLanexRi1->AddConstProperty("FASTTIMECONSTANT", mieHgTimeConst);
00752   mptGOSLanexRi1->AddConstProperty("YIELDRATIO", 1.0);
00753   mptGOSLanexRi1->AddConstProperty("MIEHG", mieScatteringLengthGOSLanex);
00754   mptGOSLanexRi1->AddConstProperty("MIEHG_FORWARD", gosLanexMiehgForward);
00755   mptGOSLanexRi1->AddConstProperty("MIEHG_BACKWARD", gosLanexMiehgBackward);
00756   mptGOSLanexRi1->AddConstProperty("MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
00757   mptGOSLanexRi1->AddProperty("RINDEX",energyGOSLanexTab, rindexGOSLanexRi1Tab, nentGOSLanex); //Average refractive index of bulk material
00758   mptGOSLanexRi1->AddProperty("ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
00759   tmpMaterial->SetMaterialPropertiesTable(mptGOSLanexRi1);
00760   materials[name]=tmpMaterial;
00761 
00762   //pet_lanex - PET with the bulk optical transport properties of lanex particles suspended in an elastomer but the atomic, density and scintillation properties of PET
00763   G4double pet_lanex_density=GetMaterial("polyurethane")->GetDensity();
00764   tmpMaterial = new G4Material(name="pet_lanex", density=pet_lanex_density, 1);
00765   tmpMaterial->AddMaterial(GetMaterial("polyurethane"), 1.0);
00766   G4MaterialPropertiesTable* mptPETLanex = new G4MaterialPropertiesTable();
00767   mptPETLanex->AddConstProperty("MIEHG", mieScatteringLengthGOSLanex);
00768   mptPETLanex->AddConstProperty("MIEHG_FORWARD", gosLanexMiehgForward);
00769   mptPETLanex->AddConstProperty("MIEHG_BACKWARD", gosLanexMiehgBackward);
00770   mptPETLanex->AddConstProperty("MIEHG_FORWARD_RATIO", gosLanexMiehgForwardRatio);
00771   mptPETLanex->AddProperty("RINDEX",energyGOSLanexTab, rindexGOSLanexTab, nentGOSLanex); //Average refractive index of bulk material
00772   mptPETLanex->AddProperty("ABSLENGTH", energyGOSLanexTab, abslenGOSLanex, nentGOSLanex);
00773   tmpMaterial->SetMaterialPropertiesTable(mptPETLanex);
00774   materials[name]=tmpMaterial;
00775 
00776 
00777   //Medex (larger grained lanex)
00778   //  G4double medex_fill_factor=0.5;
00779   G4double medex_density=fill_factor*GOS->GetDensity()+(1-fill_factor)*GetMaterial("polyurethane")->GetDensity();
00780   G4double medex_gos_fraction_by_mass=fill_factor*GOS->GetDensity()/medex_density;
00781   G4double medex_pur_fraction_by_mass=1-medex_gos_fraction_by_mass;
00782   tmpMaterial = new G4Material(name="medex", density=medex_density, 2);
00783   tmpMaterial->AddMaterial(GOS, medex_gos_fraction_by_mass);
00784   tmpMaterial->AddMaterial(GetMaterial("polyurethane"), medex_pur_fraction_by_mass);
00785   G4MaterialPropertiesTable* mptMedex = new G4MaterialPropertiesTable();
00786   const G4int nentMedex=2;
00787   //  G4double medexRindex=(1.82+1.50)/2.0;
00788   //  G4double medexEnergytab[]={2.239*CLHEP::eV, 2.241*CLHEP::eV};
00789   G4double medexRindextab[]={rindex, rindex};
00790   G4double medexEmitspec[]={1.0, 1.0};
00791   G4double medexAbslen[]={7*CLHEP::mm, 7*CLHEP::mm};
00792   mptMedex->AddProperty("RINDEX",energytab, medexRindextab, nentMedex); //Average refractive index of bulk material
00793   mptMedex->AddProperty("ABSLENGTH", energytab, medexAbslen, nentMedex);
00794   mptMedex->AddProperty("FASTCOMPONENT",energytab, medexEmitspec, nentMedex);
00795   mptMedex->AddConstProperty("SCINTILLATIONYIELD",scintScalingFactor*2.94e4/CLHEP::MeV);
00796   mptMedex->AddConstProperty("RESOLUTIONSCALE",1.0);
00797   mptMedex->AddConstProperty("FASTTIMECONSTANT", 1.*CLHEP::ns);
00798   mptMedex->AddConstProperty("MIEHG", 230e-3*CLHEP::mm);
00799   mptMedex->AddConstProperty("MIEHG_FORWARD", 0.93);
00800   mptMedex->AddConstProperty("MIEHG_BACKWARD", 0.93);
00801   mptMedex->AddConstProperty("MIEHG_FORWARD_RATIO", 1.0);
00802   tmpMaterial->SetMaterialPropertiesTable(mptMedex);
00803   materials[name]=tmpMaterial;
00804 
00805   // liquid materials
00806 
00807   tmpMaterial = new G4Material
00808     (name="liquidhelium"  , density=  0.12498*CLHEP::g/CLHEP::cm3, 1, kStateLiquid, 4.15*CLHEP::kelvin);
00809   tmpMaterial->AddElement(elements["He"],1);
00810   materials[name] = tmpMaterial; 
00811 
00812   tmpMaterial=new G4Material
00813     (name="water"         , density=  1.00 *CLHEP::g/CLHEP::cm3, 2, kStateLiquid, 300*CLHEP::kelvin);
00814   tmpMaterial->AddElement(elements["O"], 1);
00815   tmpMaterial->AddElement(elements["H"], 2);
00816   materials[name] = tmpMaterial; 
00817 
00818   // gaseous materials
00819   // For air: do we want it at p=1atm or at p inside beampipe?
00820   // 1st case:
00821   // tmpMaterial = new G4Material
00822   //    (name="Air"           , density=  1.205*CLHEP::g/dm3, 2, kStateGas, 300*CLHEP::kelvin);
00823   // 2nd case:
00824   // ideal gas: 
00825   //   1) density * temperature / pressure = constant
00826   //   2) at T=STP_Temperature, p=1*atmosphere, n=1mole occupies a volume
00827   //      V=22.4l=22.4e-3*m3 and therefore has density=molar weight/(22.4e-3*m3)
00828   
00829   //Room temperature temperature and standard pressure
00830   temperature = 300*CLHEP::kelvin;
00831   pressure = 1.0*CLHEP::atmosphere;
00832   //Air
00833   density = (CLHEP::STP_Temperature/temperature) * (pressure/(1.*CLHEP::atmosphere))* 30*CLHEP::g/(22.4e-3*CLHEP::m3) ;
00834   //  G4cout << "Air: temperature = " << temperature/CLHEP::kelvin << " kelvin, pressure = " << pressure/CLHEP::atmosphere << " atm, density = " << density/(CLHEP::g/CLHEP::m3) << " g/m3" << G4endl;
00835   tmpMaterial = new G4Material
00836     (name="air", density, 2, kStateGas, temperature, pressure);
00837   tmpMaterial->AddElement(elements["O"], fractionmass=0.2);
00838   tmpMaterial->AddElement(elements["N"], fractionmass=0.8);
00839   const G4int Air_NUMENTRIES = 3; //Number of entries in the material properties table
00840   G4double Air_RIND[Air_NUMENTRIES] = {1.000292,1.000292,1.000292};//Source: NPL Tables of Physical & Chemical Constants. Refractive indices at different energies.
00841   G4double Air_Energy[Air_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV}; //The energies.
00842   airMaterialPropertiesTable=new G4MaterialPropertiesTable();
00843   airMaterialPropertiesTable->AddProperty("RINDEX",Air_Energy, Air_RIND, Air_NUMENTRIES);
00844   tmpMaterial->SetMaterialPropertiesTable(airMaterialPropertiesTable);
00845   materials[name] = tmpMaterial; 
00846 
00847   //Carbon monoxide
00848   density = (CLHEP::STP_Temperature/temperature) * (pressure/(1.*CLHEP::atmosphere))
00849     * (12.+16.)*CLHEP::g/(22.4*1.e-3*CLHEP::m3) ;
00850   tmpMaterial =  new G4Material
00851     (name="carbonmonoxide", density, 2, kStateGas, temperature, pressure);
00852   tmpMaterial->AddElement(elements["C"], 1);
00853   tmpMaterial->AddElement(elements["O"], 1);
00854   materials[name] = tmpMaterial; 
00855 
00856   //Awake plasma - rubidium at density of 7e14 atoms/cm3 
00857   //  G4double numberDensity = 7.0e14/CLHEP::cm3;
00858   a = 85.4678*CLHEP::g/CLHEP::mole;
00859   density = 1e-7*CLHEP::g/CLHEP::cm3;
00860   //density = a*numberDensity;
00861   tmpMaterial =  new G4Material
00862     (name="awakeplasma", z=37., a, density);
00863   materials[name] = tmpMaterial; 
00864 
00865   //Carbon monoxide beam pipe gas
00866   double bp_pressure=0.0133e-9*CLHEP::bar; //10 nTorr pressure
00867   density = (CLHEP::STP_Temperature/temperature) * (bp_pressure/(1.*CLHEP::atmosphere))
00868     * (12.+16.)*CLHEP::g/(22.4*1.e-3*CLHEP::m3) ;
00869   tmpMaterial =  new G4Material
00870     (name="bp_carbonmonoxide", density, 2, kStateGas, temperature, bp_pressure);
00871   tmpMaterial->AddElement(elements["C"], 1);
00872   tmpMaterial->AddElement(elements["O"], 1);
00873   materials[name] = tmpMaterial; 
00874 
00875   //Nitrogen
00876   density = (CLHEP::STP_Temperature/temperature) * (pressure/(1.*CLHEP::atmosphere))
00877     * (14.)*CLHEP::g/(22.4*1.e-3*CLHEP::m3) ;
00878   tmpMaterial =  new G4Material
00879     (name="nitrogen", density, 1, kStateGas, temperature, pressure);
00880   tmpMaterial->AddElement(elements["N"], fractionmass=1.0);
00881   materials[name] = tmpMaterial; 
00882 
00883   //Default vacuum (same composition as residual vacuum in warm sections of LHC).
00884   // can be overridden by vacMaterial option
00885   G4double vacpressure=options.vacuumPressure*CLHEP::bar;
00886   density = (CLHEP::STP_Temperature/temperature) * (vacpressure/(1.*CLHEP::atmosphere))  * 29*CLHEP::g/(22.4*1.e-3*CLHEP::m3) ;
00887 #ifdef BDSDEBUG 
00888   G4cout<< " ***************** defining Vacuum"<<G4endl;
00889   G4cout<< "pressure="<<vacpressure/CLHEP::bar<<" bar"<<G4endl;
00890   G4cout<< "temp="<<temperature/CLHEP::kelvin<<" K"<<G4endl;
00891   G4cout<< "density="<<density/(CLHEP::g/CLHEP::m3)<<"g/m^3"<<G4endl;
00892 #endif
00893   tmpMaterial = new G4Material
00894     (name="vacuum", density, 3, kStateGas, temperature, vacpressure);
00895   tmpMaterial->AddElement(elements["H"], fractionmass=0.482);
00896   tmpMaterial->AddElement(elements["C"], fractionmass=0.221);
00897   tmpMaterial->AddElement(elements["O"], fractionmass=0.297);
00898   materials[name] = tmpMaterial; 
00899 
00900   const G4int Vac_NUMENTRIES = 3; //Number of entries in the material properties table
00901   G4double Vac_RIND[Vac_NUMENTRIES] = {1.000,1.000,1.000};//Assume refractive index = 1 in a vacuum.
00902   G4double Vac_Energy[Vac_NUMENTRIES] = {2.0*CLHEP::eV,7.0*CLHEP::eV,7.14*CLHEP::eV}; //The energies.
00903   vacMaterialPropertiesTable=new G4MaterialPropertiesTable();
00904   vacMaterialPropertiesTable->AddProperty("RINDEX",Vac_Energy, Vac_RIND, Vac_NUMENTRIES);
00905   tmpMaterial->SetMaterialPropertiesTable(vacMaterialPropertiesTable);
00906 
00907   tmpMaterial = new G4Material
00908     (name="laservac"      , density, 1, kStateGas, temperature, vacpressure);
00909   tmpMaterial->AddMaterial(materials["vacuum"], fractionmass=1.);
00910   materials[name] = tmpMaterial; 
00911 
00912   //High density carbon monoxide, density chosen such that 1mm length gives ~ one interaction
00913   density=37.403/10.*CLHEP::g/CLHEP::cm3;  
00914   tmpMaterial = new G4Material
00915     (name="beamgasplugmat", density, 2, kStateGas);
00916    tmpMaterial->AddElement(elements["C"], 1);
00917   tmpMaterial->AddElement(elements["O"], 1);
00918   materials[name] = tmpMaterial;
00919 
00920   // Empty material (space vacuum - real empty material does not exist in Geant4)
00921   tmpMaterial = G4NistManager::Instance()->FindOrBuildMaterial(name="G4_Galactic");
00922   materials[name] = tmpMaterial;
00923 }
00924 
00925 void BDSMaterials::AddMaterial(G4Material* aMaterial, G4String aName)
00926 {
00927   aName.toLower();
00928   if(materials.insert(make_pair(aName,aMaterial)).second){
00929 #ifdef BDSDEBUG
00930     G4cout << "New material : " << aName << " added to material table" << G4endl;
00931 #endif
00932 
00933   }else{
00934     G4String exceptionString = "Material "+aName+" already exists\n";
00935     G4Exception(exceptionString.c_str(), "-1", FatalException, "");
00936   }
00937 }
00938 
00939 // add material
00940 void BDSMaterials::AddMaterial(G4String aName,
00941                                G4double itsZ,
00942                                G4double itsA,
00943                                G4double itsDensity,
00944                                G4State  itsState,    //solid,gas
00945                                G4double itsTemp,     //temperature
00946                                G4double itsPressure) //pressure
00947 {
00948   aName.toLower();
00949   G4Material* tmpMaterial = new G4Material(aName, itsZ, itsA*CLHEP::g/CLHEP::mole, itsDensity*CLHEP::g/CLHEP::cm3, itsState, itsTemp*CLHEP::kelvin, itsPressure*CLHEP::atmosphere);
00950   if(materials.insert(make_pair(aName,tmpMaterial)).second){
00951 #ifdef BDSDEBUG
00952     G4cout << "New material : " << aName << " added to material table" << G4endl;
00953 #endif
00954   }else{
00955     G4String exceptionString = "Material "+aName+" already exists\n";
00956     G4Exception(exceptionString.c_str(), "-1", FatalException, "");
00957   }
00958 }
00959 
00960 template <typename Type> void BDSMaterials::AddMaterial(
00961 G4String aName, G4double itsDensity, G4State itsState,
00962 G4double itsTemp, G4double itsPressure,
00963 std::list<const char*> itsComponents, std::list<Type> itsComponentsFractions)
00964 {
00965   aName.toLower();
00966   G4Material* tmpMaterial = new G4Material(aName, itsDensity*CLHEP::g/CLHEP::cm3, 
00967                 (G4int)itsComponents.size(),itsState, itsTemp*CLHEP::kelvin, itsPressure*CLHEP::atmosphere);
00968   std::list<const char*>::iterator sIter;
00969   typename std::list<Type>::iterator dIter;
00970   for(sIter = itsComponents.begin(), dIter = itsComponentsFractions.begin();
00971       sIter != itsComponents.end();
00972       sIter++, dIter++)
00973   {
00974 #ifdef BDSDEBUG
00975     G4cout << "BDSMaterials::AddMaterial - Adding element: " << (G4String)*sIter << G4endl;
00976 #endif
00977     if(CheckElement((G4String)*sIter)){
00978       tmpMaterial->AddElement(GetElement((G4String)*sIter),(*dIter));
00979     } else tmpMaterial->AddMaterial(GetMaterial((G4String)*sIter),(*dIter));
00980   }
00981   if(materials.insert(make_pair(aName,tmpMaterial)).second){
00982 #ifdef BDSDEBUG
00983     G4cout << "New material : " << aName << " added to material table" << G4endl;
00984 #endif
00985   }else{
00986     G4String exceptionString = "Material "+aName+" already exists\n";
00987     G4Exception(exceptionString.c_str(), "-1", FatalException, "");  
00988   }
00989 }
00990 
00991 void BDSMaterials::AddElement(G4Element* aElement, G4String aSymbol)
00992 {
00993   if(elements.insert(make_pair(aSymbol,aElement)).second){
00994 #ifdef BDSDEBUG
00995     G4cout << "New atom : " << aSymbol << G4endl;
00996 #endif
00997   }else{
00998     G4String exceptionString = "Atom "+aSymbol+" already exists\n";
00999     G4Exception(exceptionString.c_str(), "-1", FatalException, "");
01000   }
01001 }
01002 
01003 void BDSMaterials::AddElement(G4String aName, G4String aSymbol, G4double itsZ, G4double itsA)
01004 {
01005   G4Element* tmpElement = new G4Element(aName, aSymbol, itsZ, itsA*CLHEP::g/CLHEP::mole);
01006   if(elements.insert(make_pair(aSymbol,tmpElement)).second){
01007 #ifdef BDSDEBUG
01008     G4cout << "New atom : " << aSymbol << G4endl;
01009 #endif
01010   }else{
01011     G4String exceptionString = "Atom "+aSymbol+" already exists\n";
01012     G4Exception(exceptionString.c_str(), "-1", FatalException, "");
01013   }
01014 }
01015 
01016 G4Material* BDSMaterials::GetMaterial(G4String aMaterial)
01017 {
01018   G4String cmpStr1 ("G4_");
01019   G4String cmpStr2 (aMaterial, 3);
01020 #ifdef BDSDEBUG
01021   G4cout << "BDSMaterials::GetMaterial() - " << cmpStr1 << " " << cmpStr2 << " " << cmpStr1.compareTo(cmpStr2) << G4endl;
01022 #endif
01023   if (!cmpStr1.compareTo(cmpStr2)){
01024 #ifdef BDSDEBUG
01025     G4cout << "Using NIST material " << aMaterial << G4endl;
01026 #endif
01027     return G4NistManager::Instance()->FindOrBuildMaterial(aMaterial, true, true);
01028   } else {
01029     // find material regardless of capitalisation
01030     aMaterial.toLower();
01031     std::map<G4String,G4Material*>::iterator iter = materials.find(aMaterial);
01032     if(iter != materials.end()) return (*iter).second;
01033     else{
01034       G4String exceptionString = "BDSMaterials::GetMaterial - Material \""+aMaterial+"\" not known. Aborting.";
01035       G4Exception(exceptionString.c_str(), "-1", FatalException, "");
01036       exit(1);
01037     }
01038   }
01039 }
01040 
01041 G4Element* BDSMaterials::GetElement(G4String aSymbol)
01042 {
01043   G4String cmpStr1 ("G4_");
01044   G4String cmpStr2 (aSymbol, 3);
01045 #ifdef BDSDEBUG
01046   G4cout << cmpStr1 << " " << cmpStr2 << " " << cmpStr1.compareTo(cmpStr2) << G4endl;
01047 #endif
01048   if (!cmpStr1.compareTo(cmpStr2)){
01049 #ifdef BDSDEBUG
01050     G4cout << "Using NIST material " << aSymbol << G4endl;
01051 #endif
01052     return G4NistManager::Instance()->FindOrBuildElement(aSymbol, true);
01053   } else {
01054     std::map<G4String,G4Element*>::iterator iter = elements.find(aSymbol);
01055     if(iter != elements.end()) return (*iter).second;
01056     else{
01057       G4String exceptionString="BDSMaterials::GetElement - Element "+aSymbol+" not known. Aborting.";
01058       G4Exception(exceptionString.c_str(), "-1", FatalException, "");
01059       exit(1);
01060     }
01061   }
01062 }
01063 
01064 G4Element* BDSMaterials::GetElement(const char* aSymbol)
01065 {
01066   return GetElement((G4String)aSymbol);
01067 }
01068 
01069 G4bool BDSMaterials::CheckMaterial(G4String aMaterial)
01070 {
01071   aMaterial.toLower();
01072   std::map<G4String,G4Material*>::iterator iter = materials.find(aMaterial);
01073   if(iter != materials.end()) return true;
01074   else return false;
01075 }
01076 
01077 G4bool BDSMaterials::CheckElement(G4String aSymbol)
01078 {
01079   std::map<G4String,G4Element*>::iterator iter = elements.find(aSymbol);
01080   if(iter != elements.end()) return true;
01081   else return false;
01082 }
01083 
01084 void BDSMaterials::ListMaterials(){
01085   // would be better if automatically generated, but not trivial due to instantisation dependency of BDSGlobalConstants
01086   G4cout << "Available elements are:" << G4endl;
01087   G4cout << "Aluminium  - Al" << G4endl;
01088   G4cout << "Barium     - Ba" << G4endl;
01089   G4cout << "Beryllium  - Be" << G4endl;
01090   G4cout << "Boron      - B" << G4endl;
01091   G4cout << "Calcium    - Ca" << G4endl;
01092   G4cout << "Carbon     - C" << G4endl;
01093   G4cout << "Chromium   - Cr" << G4endl;
01094   G4cout << "Cobalt     - Co" << G4endl;
01095   G4cout << "Copper     - Cu" << G4endl;
01096   G4cout << "Europium   - Eu" << G4endl;
01097   G4cout << "Helium     - He" << G4endl;
01098   G4cout << "Hydrogen   - H" << G4endl;
01099   G4cout << "Iron       - Fe" << G4endl;
01100   G4cout << "Lead       - Pb" << G4endl;
01101   G4cout << "Magnesium  - Mg" << G4endl;
01102   G4cout << "Manganese  - Mn" << G4endl;
01103   G4cout << "Molybdenum - Mo" << G4endl;
01104   G4cout << "Nickel     - Ni" << G4endl;
01105   G4cout << "Niobium    - Nb" << G4endl;
01106   G4cout << "Nitrogen   - N" << G4endl;
01107   G4cout << "Oxygen     - O" << G4endl;
01108   G4cout << "Potassium  - K" << G4endl;
01109   G4cout << "Phosphorus - P" << G4endl;
01110   G4cout << "Rubidium   - Rb" << G4endl;
01111   G4cout << "Samarium   - Sm" << G4endl;
01112   G4cout << "Silicon    - Si" << G4endl;
01113   G4cout << "Sodium     - Na" << G4endl;
01114   G4cout << "Strontium  - Sr" << G4endl;
01115   G4cout << "Sulphur    - S" << G4endl;
01116   G4cout << "Titanium   - Ti" << G4endl;
01117   G4cout << "Tungsten   - W" << G4endl;
01118   G4cout << "Uranium    - U" << G4endl;
01119   G4cout << "Vanadium   - V" << G4endl;
01120   G4cout << "Yttrium    - Y" << G4endl;
01121   G4cout << "Zinc       - Zn" << G4endl;
01122   G4cout << "Zirkonium  - Zr" << G4endl;
01123   G4cout << "***************" << G4endl;
01124   G4cout << "Available materials are:" << G4endl;
01125   G4cout << "Air" << G4endl;
01126   G4cout << "Aluminium" << G4endl;
01127   G4cout << "AralditeF" << G4endl;
01128   G4cout << "AwakePlasma" << G4endl;
01129   G4cout << "Beryllium" << G4endl;
01130   G4cout << "CalciumCarbonate" << G4endl;
01131   G4cout << "CarbonMonoxide" << G4endl;
01132   G4cout << "BP_CarbonMonoxide" << G4endl;
01133   G4cout << "CarbonSteel" << G4endl;
01134   G4cout << "Cellulose" << G4endl;
01135   G4cout << "Clay" << G4endl;
01136   G4cout << "Concrete" << G4endl;
01137   G4cout << "LHCConcrete" << G4endl;
01138   G4cout << "Copper" << G4endl;
01139   G4cout << "FusedSilica" << G4endl;
01140   G4cout << "Graphite" << G4endl;
01141   G4cout << "GraphiteFoam" << G4endl;
01142   G4cout << "HY906" << G4endl;
01143   G4cout << "DY061" << G4endl;
01144   G4cout << "BN5000" << G4endl;
01145   G4cout << "EpoxyResin3" << G4endl;
01146   G4cout << "Invar" << G4endl;
01147   G4cout << "Iron" << G4endl;
01148   G4cout << "WeightIron" << G4endl;
01149   G4cout << "Kapton" << G4endl;
01150   G4cout << "Lanex" << G4endl;
01151   G4cout << "Lanex2" << G4endl;
01152   G4cout << "GOS_Lanex" << G4endl;
01153   G4cout << "GOS_ri1" << G4endl;
01154   G4cout << "PET_Lanex" << G4endl;
01155   G4cout << "LaserVac" << G4endl;
01156   G4cout << "Lead" << G4endl;
01157   G4cout << "LeadTungstate" << G4endl;
01158   G4cout << "LiquidHelium" << G4endl;
01159   G4cout << "Marl" << G4endl;
01160   G4cout << "ClayousMarl" << G4endl;
01161   G4cout << "LimousMarl" << G4endl;
01162   G4cout << "N-BK7" << G4endl;
01163   G4cout << "NbTi" << G4endl;
01164   G4cout << "Niobium" << G4endl;
01165   G4cout << "Nitrogen" << G4endl;  
01166   G4cout << "PET" << G4endl;
01167   G4cout << "PolyUrethane" << G4endl;
01168   G4cout << "Quartz" << G4endl;
01169   G4cout << "Silicon" << G4endl;
01170   G4cout << "SmCo" << G4endl;
01171   G4cout << "Soil" << G4endl;
01172   G4cout << "StainlessSteel" << G4endl;
01173   G4cout << "Titanium" << G4endl;
01174   G4cout << "TitaniumAlloy" << G4endl;
01175   G4cout << "Tungsten" << G4endl;
01176   G4cout << "Uranium" << G4endl;
01177   G4cout << "UPS923A" << G4endl;
01178   G4cout << "Vacuum" << G4endl;
01179   G4cout << "Vanadium" << G4endl;
01180   G4cout << "Water" << G4endl;
01181   G4cout << "YAG" << G4endl;
01182   G4cout << "****************************" << G4endl;
01183   G4cout << "Available NIST materials are:" << G4endl;
01184   G4String list="all";
01185   G4NistManager::Instance()->ListMaterials(list);
01186 }
01187 
01188 BDSMaterials::~BDSMaterials(){
01189   std::map<G4String,G4Material*>::iterator mIter;
01190   for(mIter = materials.begin(); mIter!=materials.end(); mIter++)
01191     delete (*mIter).second;
01192   materials.clear();
01193 
01194   std::map<G4String,G4Element*>::iterator eIter;
01195   for(eIter = elements.begin(); eIter!=elements.end(); eIter++)
01196     delete (*eIter).second;
01197   elements.clear();
01198 
01199   delete airMaterialPropertiesTable;
01200   delete celluloseMaterialPropertiesTable;
01201   delete fsMaterialPropertiesTable;
01202   delete petMaterialPropertiesTable;
01203   delete vacMaterialPropertiesTable;  
01204 
01205   _instance = 0;
01206 }
01207 
01208 void BDSMaterials::PrepareRequiredMaterials()
01209 {
01210   // This function uses the list from the parser and prepares
01211   // the necessary materials for this run.
01212   
01213   G4bool verbose = BDSExecOptions::Instance()->GetVerbose();
01214 #ifdef BDSDEBUG
01215   G4bool debug = true;
01216 #else
01217   G4bool debug = false;
01218 #endif
01219 
01220   // convert the parsed atom list to list of Geant4 G4Elements
01221   
01222   std::list<struct Element>::iterator it;
01223 
01224   if (verbose || debug) G4cout << "parsing the atom list..."<< G4endl;
01225   for(it = atom_list.begin();it!=atom_list.end();it++)
01226   {
01227 #ifdef BDSDEBUG
01228     G4cout << "---->adding Atom, "
01229            << "name= " << (*it).name << " "
01230            << "symbol= " << (*it).symbol << " "
01231            << "Z= " << (*it).Z << " "
01232            << "A= " << (*it).A << "g/mole "
01233            << G4endl;
01234 #endif
01235 
01236     AddElement((*it).name,(*it).symbol,(*it).Z,(*it).A);
01237   }
01238   if (verbose || debug) G4cout << "size of atom list: "<< atom_list.size() << G4endl;
01239   
01240   // convert the parsed material list to list of Geant4 G4Materials
01241   if (verbose || debug) G4cout << "parsing the material list..."<< G4endl;
01242   for(it = material_list.begin();it!=material_list.end();it++)
01243   {
01244     G4State itsState;
01245     if      ((*it).state=="solid")  itsState = kStateSolid;
01246     else if ((*it).state=="liquid") itsState = kStateLiquid;
01247     else if ((*it).state=="gas")    itsState = kStateGas;
01248     else {
01249       G4cout << "Unknown material state "<< (*it).state 
01250              << ", setting it to default (solid)"
01251              << G4endl;
01252       (*it).state="solid";
01253       itsState = kStateSolid;
01254     }
01255 
01256     if((*it).Z != 0) {
01257 #ifdef BDSDEBUG  
01258       G4cout << "---->adding Material, "
01259              << "name= "<< (*it).name << " "
01260              << "Z= " << (*it).Z << " "
01261              << "A= " << (*it).A << "g/mole "
01262              << "density= "<< (*it).density << "g/cm3 "
01263              << "state= " << (*it).state << " "
01264              << "T= " << (*it).temper << "K "
01265              << "P= " << (*it).pressure << "atm "
01266              << G4endl;
01267 #endif
01268       AddMaterial((*it).name,
01269                   (*it).Z,
01270                   (*it).A,
01271                   (*it).density,
01272                   itsState,
01273                   (*it).temper,
01274                   (*it).pressure);
01275     }
01276     else if((*it).components.size() != 0){
01277 #ifdef BDSDEBUG 
01278       G4cout << "---->adding Material, "
01279              << "name= "<< (*it).name << " "
01280              << "density= "<< (*it).density << "g/cm3 "
01281              << "state= " << (*it).state << " "
01282              << "T= " << (*it).temper << "K "
01283              << "P= " << (*it).pressure << "atm "
01284              << "ncomponents= " << (*it).components.size() << " "
01285              << G4endl;
01286 #endif
01287 
01288       if((*it).componentsWeights.size()==(*it).components.size()) {
01289         
01290         AddMaterial((G4String)(*it).name,
01291                     (G4double)(*it).density,
01292                     (G4State)itsState,
01293                     (G4double)(*it).temper,
01294                     (G4double)(*it).pressure,
01295                     (std::list<const char*>)(*it).components,
01296                     (std::list<G4int>)(*it).componentsWeights);
01297       }
01298       else if((*it).componentsFractions.size()==(*it).components.size()) {
01299 
01300         AddMaterial((*it).name,
01301                     (*it).density,
01302                     itsState,
01303                     (*it).temper,
01304                     (*it).pressure,
01305                     (*it).components,
01306                     (*it).componentsFractions);
01307       }
01308       else {
01309         G4Exception("Badly defined material - number of components is not equal to number of weights or mass fractions!", "-1", FatalErrorInArgument, "");
01310         exit(1);
01311       }
01312     }
01313     else {
01314       G4Exception("Badly defined material - need more information!", "-1", FatalErrorInArgument, "");
01315       exit(1);
01316     }
01317   }
01318   if (verbose || debug) G4cout << "size of material list: "<< material_list.size() << G4endl;
01319 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7