G3EleTable.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #include <sstream>
00031 
00032 #include "G3EleTable.hh"
00033 
00034 #include "G4Types.hh"
00035 #include "G4PhysicalConstants.hh"
00036 #include "G4SystemOfUnits.hh"
00037 #include "G4ios.hh"
00038 
00039 G3EleTable::G3EleTable() :_MaxEle(109){
00040   _EleNames = new char*[_MaxEle];
00041   // create an array of pointers to elements
00042   _Ele = new G4Element*[_MaxEle];
00043   LoadUp();
00044 }
00045 
00046 G3EleTable::~G3EleTable(){
00047   delete [] _EleNames;
00048   delete [] _Ele;
00049 }
00050 
00051 G4Element* 
00052 G3EleTable::GetEle(G4double Z){
00053   G4double A;
00054   char name[20], sym[3];
00055   G4int index = (G4int) Z-1;
00056   if (!parse(Z, name, sym, A)) {
00057     G4String na(name);
00058     G4String sy(sym);
00059     if (_Ele[index] == 0) {
00060       // add an element to the element table here
00061       _Ele[index] = new G4Element(na, sy, Z, A*g/mole);
00062     }
00063   }
00064   return _Ele[index];
00065 }
00066 
00067 G4int 
00068 G3EleTable::parse(G4double& Z, char* name, char* sym, G4double& A){ 
00069  G4int rc = 0;
00070   if (Z>0 && Z <=_MaxEle){
00071     G4int z = (G4int) Z-1;
00072     std::istringstream in(_EleNames[z]);
00073     in >> name >> sym >> A;
00074   } else {
00075     rc = -1;
00076   }
00077   return rc;
00078 }
00079 
00080 void
00081 G3EleTable::LoadUp(){
00082   G4int i=0;
00083   _EleNames[i]=(char *)"Hydrogen H 1.00794"; i++;
00084   _EleNames[i]=(char *)"Helium He 4.0026"; i++;
00085   _EleNames[i]=(char *)"Lithium Li 6.941"; i++;
00086   _EleNames[i]=(char *)"Beryllium Be 9.012182"; i++;
00087   _EleNames[i]=(char *)"Boron B 10.811"; i++;
00088   _EleNames[i]=(char *)"Carbon C 12.011"; i++;
00089   _EleNames[i]=(char *)"Nitrogen N 14.00674"; i++;
00090   _EleNames[i]=(char *)"Oxygen O 15.9994"; i++;
00091   _EleNames[i]=(char *)"Fluorine F 18.9984032"; i++;
00092   _EleNames[i]=(char *)"Neon Ne 20.1797"; i++;
00093 
00094   _EleNames[i]=(char *)"Sodium Na 22.989768"; i++;
00095   _EleNames[i]=(char *)"Magnesium Mg 24.3050"; i++;
00096   _EleNames[i]=(char *)"Aluminum Al 26.981539"; i++;
00097   _EleNames[i]=(char *)"Silicon Si 28.0855"; i++;
00098   _EleNames[i]=(char *)"Phosphorus P 30.973762"; i++;
00099   _EleNames[i]=(char *)"Sulfur S 32.066"; i++;
00100   _EleNames[i]=(char *)"Chlorine Cl 35.4527"; i++;
00101   _EleNames[i]=(char *)"Argon Ar 39.948"; i++;
00102   _EleNames[i]=(char *)"Potassium K 39.0983"; i++;
00103   _EleNames[i]=(char *)"Calcium Ca 40.078"; i++;
00104 
00105   _EleNames[i]=(char *)"Scandium Sc 44.955910"; i++;
00106   _EleNames[i]=(char *)"Titanium Ti 47.867"; i++;
00107   _EleNames[i]=(char *)"Vanadium V 50.9415"; i++;
00108   _EleNames[i]=(char *)"Chromium Cr 51.9961"; i++;
00109   _EleNames[i]=(char *)"Manganese Mn 54.93805"; i++;
00110   _EleNames[i]=(char *)"Iron Fe 55.845"; i++;
00111   _EleNames[i]=(char *)"Cobalt Co 58.93320"; i++;
00112   _EleNames[i]=(char *)"Nickel Ni 58.6934"; i++;
00113   _EleNames[i]=(char *)"Copper Cu 63.546"; i++;
00114   _EleNames[i]=(char *)"Zinc Zn 65.39"; i++;
00115 
00116   _EleNames[i]=(char *)"Gallium Ga 69.723"; i++;
00117   _EleNames[i]=(char *)"Germanium Ge 72.61"; i++;
00118   _EleNames[i]=(char *)"Arsenic As 74.92159"; i++;
00119   _EleNames[i]=(char *)"Selenium Se 78.96"; i++;
00120   _EleNames[i]=(char *)"Bromine Br 79.904"; i++;
00121   _EleNames[i]=(char *)"Krypton Kr 83.80"; i++;
00122   _EleNames[i]=(char *)"Rubidium Rb 85.4678"; i++;
00123   _EleNames[i]=(char *)"Strontium Sr 87.62"; i++;
00124   _EleNames[i]=(char *)"Yttrium Y 88.90585"; i++;
00125   _EleNames[i]=(char *)"Zirconium Zr 91.224"; i++;
00126 
00127   _EleNames[i]=(char *)"Niobium Nb 92.90638"; i++;
00128   _EleNames[i]=(char *)"Molybdenum Mo 95.94"; i++;
00129   _EleNames[i]=(char *)"Technetium Tc 97.907215"; i++;
00130   _EleNames[i]=(char *)"Ruthenium Ru 101.07"; i++;
00131   _EleNames[i]=(char *)"Rhodium Rh 102.90550"; i++;
00132   _EleNames[i]=(char *)"Palladium Pd 106.42"; i++;
00133   _EleNames[i]=(char *)"Silver Ag 107.8682"; i++;
00134   _EleNames[i]=(char *)"Cadmium Cd 112.41"; i++;
00135   _EleNames[i]=(char *)"Indium In 114.818"; i++;
00136   _EleNames[i]=(char *)"Tin Sn 118.710"; i++;
00137 
00138   _EleNames[i]=(char *)"Antimony Sb 121.760"; i++;
00139   _EleNames[i]=(char *)"Tellurium Te 127.60"; i++;
00140   _EleNames[i]=(char *)"Iodine I 126.90447"; i++;
00141   _EleNames[i]=(char *)"Xenon Xe 131.29"; i++;
00142   _EleNames[i]=(char *)"Cesium Cs 132.90543"; i++;
00143   _EleNames[i]=(char *)"Barium Ba 137.27"; i++;
00144   _EleNames[i]=(char *)"Lanthanum La 138.9055"; i++;
00145   _EleNames[i]=(char *)"Cerium Ce 140.115"; i++;
00146   _EleNames[i]=(char *)"Praeseodymium Pr 140.90765"; i++;
00147   _EleNames[i]=(char *)"NeoDymium Nd 144.24"; i++;
00148   
00149   _EleNames[i]=(char *)"Promethium Pm 144.912745"; i++;
00150   _EleNames[i]=(char *)"Samarium Sm 150.36"; i++;
00151   _EleNames[i]=(char *)"Europium Eu 151.965"; i++;
00152   _EleNames[i]=(char *)"Gadolinium Gd 157.25"; i++;
00153   _EleNames[i]=(char *)"Terbium Tb 158.92534"; i++;
00154   _EleNames[i]=(char *)"Dysprosium Dy 162.50"; i++;
00155   _EleNames[i]=(char *)"Holmium Ho 164.93032"; i++;
00156   _EleNames[i]=(char *)"Erbium Er 167.26"; i++;
00157   _EleNames[i]=(char *)"Thulium Tm 168.93421"; i++;
00158   _EleNames[i]=(char *)"Ytterbium Yb 173.04"; i++;
00159 
00160   _EleNames[i]=(char *)"Lutetium Lu 174.967"; i++;
00161   _EleNames[i]=(char *)"Hafnium Hf 178.49"; i++;
00162   _EleNames[i]=(char *)"Tantalum Ta 180.9479"; i++;
00163   _EleNames[i]=(char *)"Tungsten W 183.84"; i++;
00164   _EleNames[i]=(char *)"Rhenium Re 186.207"; i++;
00165   _EleNames[i]=(char *)"Osmium Os 190.23"; i++;
00166   _EleNames[i]=(char *)"Iridium Ir 192.217"; i++;
00167   _EleNames[i]=(char *)"Platinum Pt 195.08"; i++;
00168   _EleNames[i]=(char *)"Gold Au 196.96654"; i++;
00169   _EleNames[i]=(char *)"Mercury Hg 200.59"; i++;
00170 
00171   _EleNames[i]=(char *)"Thallium Tl 204.3833"; i++;
00172   _EleNames[i]=(char *)"Lead Pb 207.2"; i++;
00173   _EleNames[i]=(char *)"Bismuth Bi 208.98037"; i++;
00174   _EleNames[i]=(char *)"Polonium Po 208.982415"; i++;
00175   _EleNames[i]=(char *)"Astatine At 209.987131"; i++;
00176   _EleNames[i]=(char *)"Radon Rn 222.017570"; i++;
00177   _EleNames[i]=(char *)"Francium Fr 223.019731"; i++;
00178   _EleNames[i]=(char *)"Radium Ra 226.025402"; i++;
00179   _EleNames[i]=(char *)"Actinium Ac 227.027747"; i++;
00180   _EleNames[i]=(char *)"Thorium Th 232.0381"; i++;
00181 
00182   _EleNames[i]=(char *)"Protactinium Pa 231.03588"; i++;
00183   _EleNames[i]=(char *)"Uranium U 238.0289"; i++;
00184   _EleNames[i]=(char *)"Neptunium Np 237.048166"; i++;
00185   _EleNames[i]=(char *)"Plutonium Pu 244.064197"; i++;
00186   _EleNames[i]=(char *)"Americium Am 243.061372"; i++;
00187   _EleNames[i]=(char *)"Curium Cm 247.070346"; i++;
00188   _EleNames[i]=(char *)"Berkelium Bk 247.070298"; i++;
00189   _EleNames[i]=(char *)"Californium Cf 251.079579"; i++;
00190   _EleNames[i]=(char *)"Einsteinium Es 252.08297"; i++;
00191   _EleNames[i]=(char *)"Fermium Fm 257.095096"; i++;
00192 
00193   _EleNames[i]=(char *)"Mendelevium Md 258.098427"; i++;
00194   _EleNames[i]=(char *)"Nobelium No 259.1011"; i++;
00195   _EleNames[i]=(char *)"Lawrencium Lr 262.1098"; i++;
00196   _EleNames[i]=(char *)"Rutherfordium Rf 261.1089";  i++;
00197   _EleNames[i]=(char *)"Hahnium Ha 262.1144";  i++;
00198   _EleNames[i]=(char *)"Seaborgium Sg 263.1186";  i++;
00199   _EleNames[i]=(char *)"Nielsborium Ns 262.1231";  i++;
00200   _EleNames[i]=(char *)"Hassium Hs 265.1306";  i++;
00201   _EleNames[i]=(char *)"Meitnerium Mt 266.1378";  i++;
00202 
00203   // initialize element pointers to 0
00204   for (G4int j=0; j<i; j++) {
00205     _Ele[j]=0;
00206   }
00207 }
00208 
00209 

Generated on Mon May 27 17:47:35 2013 for Geant4 by  doxygen 1.4.7