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 // by I.Hrivnacova, 27 Sep 99 00030 00031 #include <cmath> 00032 00033 #include "G4PhysicalConstants.hh" 00034 #include "G4SystemOfUnits.hh" 00035 #include "G3toG4.hh" 00036 #include "G3MatTable.hh" 00037 #include "G3EleTable.hh" 00038 #include "G4Material.hh" 00039 #include "G4Isotope.hh" 00040 #include "G4UnitsTable.hh" 00041 00042 void PG4gsmate(G4String *tokens) 00043 { 00044 // fill the parameter containers 00045 G3fillParams(tokens,PTgsmate); 00046 G4String name = Spar[0]; 00047 G4int imate = Ipar[0]; 00048 G4int nwbf = Ipar[1]; 00049 G4double a = Rpar[0]; 00050 G4double z = Rpar[1]; 00051 G4double dens = Rpar[2]; 00052 G4double radl = Rpar[3]; 00053 // G4double absl = Rpar[4]; 00054 G4double *ubuf = &Rpar[5]; 00055 00056 G4gsmate(imate, name, a, z, dens, radl, nwbf, ubuf); 00057 } 00058 00059 /* 00060 // replaced with G3EleTable 00061 // only used G4Elements are created; 00062 // !! no checking of given A of the element; 00063 // 00064 00065 G4Element* CreateElement(G4double zeff, G4double aeff, G4String matName) 00066 { 00067 // tolerance in Z, A for element definition 00068 const G4double tolerance = 0.001; 00069 00070 // define the symbol Z%A% of element 00071 // !! symbol is not unambiguous element identifier 00072 char symbol[20]; 00073 sprintf(symbol,"Z%dA%d",int(zeff),int(aeff/(g/mole))); 00074 G4String elSymbol = symbol; 00075 00076 // search element table for the element with given (Z,A) 00077 // 00078 G4int index = 0; 00079 const G4ElementTable* table = G4Element::GetElementTable(); 00080 for (G4int i=0; i<table->entries(); i++) { 00081 G4Element* entry = (*table)[i]; 00082 if (elSymbol == entry->GetSymbol()) index++; 00083 if ( std::abs(zeff - entry->GetZ()) < tolerance && 00084 (std::abs(aeff - entry->GetA())/(g/mole)) < tolerance ){ 00085 return entry; 00086 } 00087 } 00088 00089 // define a unique name En-Z%A% 00090 // (n - index of elements with the same int(Z), int(A)) 00091 char chIndex[4]; 00092 sprintf(chIndex,"%d",index); 00093 G4String elName = "E"; 00094 elName = elName + chIndex + "-"; 00095 elName = elName + elSymbol; 00096 00097 // create new element if it was not found in element table 00098 G4Element* element = new G4Element(elName, elSymbol, zeff, aeff); 00099 G4cout << "New element: " << element->GetName() 00100 << " for " << matName << " material has been created." << G4endl; 00101 return element; 00102 } 00103 */ 00104 00105 void G4gsmate(G4int imate, G4String name, G4double ain, G4double zin, 00106 G4double densin, G4double, G4int, G4double*) 00107 { 00108 G4double G3_minimum_density = 1.e-10*g/cm3; 00109 00110 // add units 00111 G4double z = zin; 00112 G4double a = ain*g/mole; 00113 G4double dens = densin*g/cm3; 00114 00115 G4Material* material=0; 00116 00117 G4String sname = name.strip(G4String::both); 00118 if (sname == "AIR") { 00119 // handle the built in AIR mixture 00120 G4double aa[2], zz[2], wmat[2]; 00121 aa[0] = 14.01*g/mole; 00122 aa[1] = 16.00*g/mole; 00123 zz[0] = 7; 00124 zz[1] = 8; 00125 wmat[0] = 0.7; 00126 wmat[1] = 0.3; 00127 // G4double theDensity = 1.2931*mg/cm3; 00128 G4double theDensity = 0.0012931; 00129 G4int n=2; 00130 G4gsmixt(imate, sname, aa, zz, theDensity, n, wmat); 00131 } 00132 else if ( z<1 || dens < G3_minimum_density ) { 00133 // define vacuum according to definition from N03 example 00134 G4double density = universe_mean_density; //from PhysicalConstants.h 00135 G4double pressure = 3.e-18*pascal; 00136 G4double temperature = 2.73*kelvin; 00137 material = new G4Material(name, z=1., a=1.01*g/mole, density, 00138 kStateGas,temperature,pressure); 00139 } 00140 else { 00141 //G4Element* element = CreateElement(z, a, name); 00142 G4Element* element = G3Ele.GetEle(z); 00143 material = new G4Material(name, dens, 1); 00144 material->AddElement(element, 1.); 00145 } 00146 00147 // add the material to the List 00148 G3Mat.put(imate, material); 00149 } 00150 00151 00152 00153 00154 00155 00156