| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|---|
| 2 | <HTML>
|
|---|
| 3 | <HEAD>
|
|---|
| 4 | <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (X11; I; OSF1 V4.0 alpha) [Netscape]">
|
|---|
| 5 | </HEAD>
|
|---|
| 6 | <BODY>
|
|---|
| 7 |
|
|---|
| 8 | <!-- Changed by: Katsuya Amako, 14-Jul-1998 -->
|
|---|
| 9 | <!-- Proof read by: Joe Chuma, 29-Jun-1999 -->
|
|---|
| 10 |
|
|---|
| 11 | <TABLE WIDTH="100%" >
|
|---|
| 12 | <TR>
|
|---|
| 13 | <TD>
|
|---|
| 14 | </A>
|
|---|
| 15 | <A HREF="index.html">
|
|---|
| 16 | <IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents" HEIGHT=16 WIDTH=59></A>
|
|---|
| 17 | <A HREF="geometry.html">
|
|---|
| 18 | <IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous" HEIGHT=16 WIDTH=59></A>
|
|---|
| 19 | <A HREF="electroMagneticField.html">
|
|---|
| 20 | <IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next" HEIGHT=16 WIDTH=59></A>
|
|---|
| 21 | </TD>
|
|---|
| 22 |
|
|---|
| 23 | <TD ALIGN="Right"><FONT COLOR="#238E23"><FONT SIZE=-1>
|
|---|
| 24 | <B>Geant4 User's Guide</B> <BR>
|
|---|
| 25 | <B>For Application Developers</B> <BR>
|
|---|
| 26 | <B>Detector Definition and Response</B> </FONT></FONT> </TD>
|
|---|
| 27 | </TR>
|
|---|
| 28 | </TABLE>
|
|---|
| 29 | <P><BR>
|
|---|
| 30 |
|
|---|
| 31 | <CENTER><FONT COLOR="#238E23"><FONT SIZE=+3>
|
|---|
| 32 | <B>4.2 Material</B> </FONT></FONT>
|
|---|
| 33 | </CENTER>
|
|---|
| 34 | <BR>
|
|---|
| 35 | <BR>
|
|---|
| 36 |
|
|---|
| 37 | <HR ALIGN="Center" SIZE="7%">
|
|---|
| 38 | <p>
|
|---|
| 39 |
|
|---|
| 40 | <a name="4.2.1">
|
|---|
| 41 | <H2>4.2.1 General considerations</H2></a>
|
|---|
| 42 |
|
|---|
| 43 | In nature, materials (chemical compounds, mixtures) are made of elements,
|
|---|
| 44 | and elements are made of isotopes. Geant4 has three main classes
|
|---|
| 45 | designed to reflect this organization. Each of these classes has a table,
|
|---|
| 46 | which is a static data member, used to keep track of the instances of the
|
|---|
| 47 | respective classes created.
|
|---|
| 48 | <p>
|
|---|
| 49 | <dl><dl>
|
|---|
| 50 | <dt><i>G4Isotope</i>
|
|---|
| 51 | <dd>This class describes the properties of atoms: atomic number, number of
|
|---|
| 52 | nucleons, mass per mole, etc.
|
|---|
| 53 | </p>
|
|---|
| 54 | <p>
|
|---|
| 55 | <dt><i>G4Element</i>
|
|---|
| 56 | <dd>This class describes the properties of elements: effective atomic number,
|
|---|
| 57 | effective number of nucleons, effective mass per mole, number of isotopes,
|
|---|
| 58 | shell energy, and quantities like cross section per atom, etc.
|
|---|
| 59 | </p>
|
|---|
| 60 | <p>
|
|---|
| 61 | <dt><i>G4Material</i>
|
|---|
| 62 | <dd>This class describes the macroscopic properties of matter:
|
|---|
| 63 | density, state, temperature, pressure, and macroscopic quantities like
|
|---|
| 64 | radiation length, mean free path, dE/dx, etc.
|
|---|
| 65 | </p>
|
|---|
| 66 | </dl></dl>
|
|---|
| 67 | <p>
|
|---|
| 68 | Only the <i>G4Material</i> class is visible to the rest of the toolkit and
|
|---|
| 69 | used by the tracking, the geometry and the physics. It contains all the
|
|---|
| 70 | information relevant to its constituent elements and isotopes, while at
|
|---|
| 71 | the same time hiding their implementation details.
|
|---|
| 72 | </p>
|
|---|
| 73 |
|
|---|
| 74 | <hr>
|
|---|
| 75 | <a name="4.2.2">
|
|---|
| 76 | <h2>4.2.2 Introduction to the Classes</h2></a>
|
|---|
| 77 |
|
|---|
| 78 | <b><i>G4Isotope</i></b>
|
|---|
| 79 | <p>
|
|---|
| 80 | A <i>G4Isotope</i> object has a name, atomic number, number of nucleons, mass
|
|---|
| 81 | per mole, and an index in the table. The constructor automatically stores
|
|---|
| 82 | "this" isotope in the isotopes table, which will assign it an index number.
|
|---|
| 83 | </p>
|
|---|
| 84 | <br>
|
|---|
| 85 |
|
|---|
| 86 | <b><i>G4Element</i></b>
|
|---|
| 87 | <p>
|
|---|
| 88 | A <i>G4Element</i> object has a name, symbol, effective atomic number,
|
|---|
| 89 | effective number of nucleons, effective mass of a mole, an index in the
|
|---|
| 90 | elements table, the number of isotopes, a vector of pointers to such isotopes,
|
|---|
| 91 | and a vector of relative abundances referring to such isotopes (where relative
|
|---|
| 92 | abundance means the number of atoms per volume). In addition, the class has
|
|---|
| 93 | methods to add, one by one, the isotopes which are to form the element.
|
|---|
| 94 | </p>
|
|---|
| 95 | <p>
|
|---|
| 96 | A <i>G4Element</i> object can be constructed by directly providing the
|
|---|
| 97 | effective atomic number, effective number of nucleons, and effective mass of
|
|---|
| 98 | a mole, if the user explicitly wants to do so. Alternatively, a
|
|---|
| 99 | <i>G4Element</i> object can be constructed by declaring the number of
|
|---|
| 100 | isotopes of which it will be composed. The constructor will "new" a vector
|
|---|
| 101 | of pointers to <i>G4Isotopes</i> and a vector of doubles to store their
|
|---|
| 102 | relative abundances. Finally, the method to add an isotope must be invoked
|
|---|
| 103 | for each of the desired (pre-existing) isotope objects, providing their
|
|---|
| 104 | addresses and relative abundances. At the last isotope entry, the system will
|
|---|
| 105 | automatically compute the effective atomic number, effective number of
|
|---|
| 106 | nucleons and effective mass of a mole, and will store "this" element in the
|
|---|
| 107 | elements table.
|
|---|
| 108 | </p>
|
|---|
| 109 | <p>
|
|---|
| 110 | A few quantities, with physical meaning or not, which are constant in
|
|---|
| 111 | a given element, are computed and stored here as "derived data members".
|
|---|
| 112 | </p>
|
|---|
| 113 | <p>
|
|---|
| 114 | Using the internal Geant4 database, a G4Element can be accessed by atomic
|
|---|
| 115 | number or by atomic symbol ("Al", "Fe", "Pb"...). In that case
|
|---|
| 116 | G4Element will be found from the list of existing elements or
|
|---|
| 117 | will be constructed using data from the Geant4 database, which is derived
|
|---|
| 118 | from the NIST database of elements and isotope compositions
|
|---|
| 119 | (http://physics.nist.gov/PhysRefData/Compositions/index.html). Thus,
|
|---|
| 120 | the natural isotope composition can be built by default. The same element
|
|---|
| 121 | can be created as using the NIST database with natural composition of isotopes
|
|---|
| 122 | and from scratch in user code with user defined isotope composition.
|
|---|
| 123 | </p>
|
|---|
| 124 | <br>
|
|---|
| 125 |
|
|---|
| 126 | <b><i>G4Material</i></b>
|
|---|
| 127 | <p>
|
|---|
| 128 | A <i>G4Material</i> object has a name, density, physical state, temperature
|
|---|
| 129 | and pressure (by default the standard conditions), the number of elements and
|
|---|
| 130 | a vector of pointers to such elements, a vector of the fraction of mass for
|
|---|
| 131 | each element, a vector of the atoms (or molecules) numbers of each element,
|
|---|
| 132 | and an index in the materials table. In addition, the class has methods to
|
|---|
| 133 | add, one by one, the elements which will comprise the material.
|
|---|
| 134 | </p>
|
|---|
| 135 | <p>
|
|---|
| 136 | A <i>G4Material</i> object can be constructed by directly providing the
|
|---|
| 137 | resulting effective numbers, if the user explicitly wants to do so (an
|
|---|
| 138 | underlying element will be created with these numbers). Alternatively, a
|
|---|
| 139 | <i>G4Material</i> object can be constructed by declaring the number of
|
|---|
| 140 | elements of which it will be composed. The constructor will "new" a vector
|
|---|
| 141 | of pointers to <i>G4Element</i> and a vector of doubles to store their
|
|---|
| 142 | fraction of mass. Finally, the method to add an element must be invoked
|
|---|
| 143 | for each of the desired (pre-existing) element objects, providing their
|
|---|
| 144 | addresses and mass fractions. At the last element entry, the system will
|
|---|
| 145 | automatically compute the vector of the number of atoms of each element per
|
|---|
| 146 | volume, the total number of electrons per volume, and will store "this"
|
|---|
| 147 | material in the materials table. In the same way, a material can be
|
|---|
| 148 | constructed as a mixture of other materials and elements.
|
|---|
| 149 | </p>
|
|---|
| 150 | <p>
|
|---|
| 151 | It should be noted that if the user provides the number of atoms (or
|
|---|
| 152 | molecules) for each element comprising the chemical compound, the system
|
|---|
| 153 | automatically computes the mass fraction. A few quantities, with physical
|
|---|
| 154 | meaning or not, which are constant in a given material, are computed and
|
|---|
| 155 | stored here as "derived data members".
|
|---|
| 156 | </p>
|
|---|
| 157 | <p>
|
|---|
| 158 | Some materials are included in the internal Geant4 database, which
|
|---|
| 159 | were derived from the NIST database of material properties
|
|---|
| 160 | (http://physics.nist.gov/PhysRefData/Star/Text/method.html).
|
|---|
| 161 | Additionally a number of materials frequently used in HEP is included
|
|---|
| 162 | in the database.
|
|---|
| 163 | Materials are interrogated or constructed by their <a href="materialNames.html">
|
|---|
| 164 | <i>names</a></i>. There are UI
|
|---|
| 165 | commands for the material category, which provide an interactive
|
|---|
| 166 | access to the database. If material is created using the NIST database it will
|
|---|
| 167 | consist of elements with natural composition of isotopes.
|
|---|
| 168 | </p>
|
|---|
| 169 | <br>
|
|---|
| 170 |
|
|---|
| 171 | <b>Final Considerations</b>
|
|---|
| 172 |
|
|---|
| 173 | The classes will automatically decide if the total of the mass fractions
|
|---|
| 174 | is correct, and perform the necessary checks. The main reason why a fixed
|
|---|
| 175 | index is kept as a data member is that many cross section and energy tables
|
|---|
| 176 | will be built in the physics processes "by rows of materials (or elements,
|
|---|
| 177 | or even isotopes)". The tracking gives the physics process the address of
|
|---|
| 178 | a material object (the material of the current volume).
|
|---|
| 179 | If the material has an index according to which the cross section table
|
|---|
| 180 | has been built, then direct access is available when a number in such a
|
|---|
| 181 | table must be accessed. We get directly to the correct row, and the energy
|
|---|
| 182 | of the particle will tell us the column. Without such an index, every access
|
|---|
| 183 | to the cross section or energy tables would imply a search to get to the
|
|---|
| 184 | correct material's row. More details will be given in the section on
|
|---|
| 185 | processes.
|
|---|
| 186 | </p>
|
|---|
| 187 | <br>
|
|---|
| 188 |
|
|---|
| 189 | <hr>
|
|---|
| 190 | <a name="4.2.3">
|
|---|
| 191 | <h2>4.2.3 Recipes for Building Elements and Materials</h2></a>
|
|---|
| 192 |
|
|---|
| 193 | Source listing 4.2.1 illustrates the different ways to define materials.
|
|---|
| 194 | <p>
|
|---|
| 195 | <center>
|
|---|
| 196 | <table border=2 cellpadding=10>
|
|---|
| 197 | <tr>
|
|---|
| 198 | <td>
|
|---|
| 199 | <PRE>
|
|---|
| 200 | #include "G4Isotope.hh"
|
|---|
| 201 | #include "G4Element.hh"
|
|---|
| 202 | #include "G4Material.hh"
|
|---|
| 203 | #include "G4UnitsTable.hh"
|
|---|
| 204 |
|
|---|
| 205 | int main() {
|
|---|
| 206 |
|
|---|
| 207 | G4String name, symbol; // a=mass of a mole;
|
|---|
| 208 | G4double a, z, density; // z=mean number of protons;
|
|---|
| 209 | G4int iz, n; //iz=nb of protons in an isotope;
|
|---|
| 210 | // n=nb of nucleons in an isotope;
|
|---|
| 211 |
|
|---|
| 212 | G4int ncomponents, natoms;
|
|---|
| 213 | G4double abundance, fractionmass;
|
|---|
| 214 | G4double temperature, pressure;
|
|---|
| 215 |
|
|---|
| 216 | G4UnitDefinition::BuildUnitsTable();
|
|---|
| 217 |
|
|---|
| 218 | //
|
|---|
| 219 | // define Elements
|
|---|
| 220 | //
|
|---|
| 221 |
|
|---|
| 222 | a = 1.01*g/mole;
|
|---|
| 223 | G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
|
|---|
| 224 |
|
|---|
| 225 | a = 12.01*g/mole;
|
|---|
| 226 | G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
|
|---|
| 227 |
|
|---|
| 228 | a = 14.01*g/mole;
|
|---|
| 229 | G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
|---|
| 230 |
|
|---|
| 231 | a = 16.00*g/mole;
|
|---|
| 232 | G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
|---|
| 233 |
|
|---|
| 234 | a = 28.09*g/mole;
|
|---|
| 235 | G4Element* elSi = new G4Element(name="Silicon", symbol="Si", z=14., a);
|
|---|
| 236 |
|
|---|
| 237 | a = 55.85*g/mole;
|
|---|
| 238 | G4Element* elFe = new G4Element(name="Iron" ,symbol="Fe", z=26., a);
|
|---|
| 239 |
|
|---|
| 240 | a = 183.84*g/mole;
|
|---|
| 241 | G4Element* elW = new G4Element(name="Tungsten" ,symbol="W", z=74., a);
|
|---|
| 242 |
|
|---|
| 243 | a = 207.20*g/mole;
|
|---|
| 244 | G4Element* elPb = new G4Element(name="Lead" ,symbol="Pb", z=82., a);
|
|---|
| 245 |
|
|---|
| 246 | //
|
|---|
| 247 | // define an Element from isotopes, by relative abundance
|
|---|
| 248 | //
|
|---|
| 249 |
|
|---|
| 250 | G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole);
|
|---|
| 251 | G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole);
|
|---|
| 252 |
|
|---|
| 253 | G4Element* elU = new G4Element(name="enriched Uranium", symbol="U", ncomponents=2);
|
|---|
| 254 | elU->AddIsotope(U5, abundance= 90.*perCent);
|
|---|
| 255 | elU->AddIsotope(U8, abundance= 10.*perCent);
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 | cout << *(G4Isotope::GetIsotopeTable()) << endl;
|
|---|
| 259 |
|
|---|
| 260 | cout << *(G4Element::GetElementTable()) << endl;
|
|---|
| 261 |
|
|---|
| 262 | //
|
|---|
| 263 | // define simple materials
|
|---|
| 264 | //
|
|---|
| 265 |
|
|---|
| 266 | density = 2.700*g/cm3;
|
|---|
| 267 | a = 26.98*g/mole;
|
|---|
| 268 | G4Material* Al = new G4Material(name="Aluminum", z=13., a, density);
|
|---|
| 269 |
|
|---|
| 270 | density = 1.390*g/cm3;
|
|---|
| 271 | a = 39.95*g/mole;
|
|---|
| 272 | G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
|
|---|
| 273 |
|
|---|
| 274 | density = 8.960*g/cm3;
|
|---|
| 275 | a = 63.55*g/mole;
|
|---|
| 276 | G4Material* Cu = new G4Material(name="Copper" , z=29., a, density);
|
|---|
| 277 |
|
|---|
| 278 | //
|
|---|
| 279 | // define a material from elements. case 1: chemical molecule
|
|---|
| 280 | //
|
|---|
| 281 |
|
|---|
| 282 | density = 1.000*g/cm3;
|
|---|
| 283 | G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
|
|---|
| 284 | H2O->AddElement(elH, natoms=2);
|
|---|
| 285 | H2O->AddElement(elO, natoms=1);
|
|---|
| 286 |
|
|---|
| 287 | density = 1.032*g/cm3;
|
|---|
| 288 | G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
|
|---|
| 289 | Sci->AddElement(elC, natoms=9);
|
|---|
| 290 | Sci->AddElement(elH, natoms=10);
|
|---|
| 291 |
|
|---|
| 292 | density = 2.200*g/cm3;
|
|---|
| 293 | G4Material* SiO2 = new G4Material(name="quartz", density, ncomponents=2);
|
|---|
| 294 | SiO2->AddElement(elSi, natoms=1);
|
|---|
| 295 | SiO2->AddElement(elO , natoms=2);
|
|---|
| 296 |
|
|---|
| 297 | density = 8.280*g/cm3;
|
|---|
| 298 | G4Material* PbWO4= new G4Material(name="PbWO4", density, ncomponents=3);
|
|---|
| 299 | PbWO4->AddElement(elO , natoms=4);
|
|---|
| 300 | PbWO4->AddElement(elW , natoms=1);
|
|---|
| 301 | PbWO4->AddElement(elPb, natoms=1);
|
|---|
| 302 |
|
|---|
| 303 | //
|
|---|
| 304 | // define a material from elements. case 2: mixture by fractional mass
|
|---|
| 305 | //
|
|---|
| 306 |
|
|---|
| 307 | density = 1.290*mg/cm3;
|
|---|
| 308 | G4Material* Air = new G4Material(name="Air " , density, ncomponents=2);
|
|---|
| 309 | Air->AddElement(elN, fractionmass=0.7);
|
|---|
| 310 | Air->AddElement(elO, fractionmass=0.3);
|
|---|
| 311 |
|
|---|
| 312 | //
|
|---|
| 313 | // define a material from elements and/or others materials (mixture of mixtures)
|
|---|
| 314 | //
|
|---|
| 315 |
|
|---|
| 316 | density = 0.200*g/cm3;
|
|---|
| 317 | G4Material* Aerog = new G4Material(name="Aerogel", density, ncomponents=3);
|
|---|
| 318 | Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
|
|---|
| 319 | Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
|
|---|
| 320 | Aerog->AddElement (elC , fractionmass= 0.1*perCent);
|
|---|
| 321 |
|
|---|
| 322 | //
|
|---|
| 323 | // examples of gas in non STP conditions
|
|---|
| 324 | //
|
|---|
| 325 |
|
|---|
| 326 | density = 27.*mg/cm3;
|
|---|
| 327 | pressure = 50.*atmosphere;
|
|---|
| 328 | temperature = 325.*kelvin;
|
|---|
| 329 | G4Material* CO2 = new G4Material(name="Carbonic gas", density, ncomponents=2,
|
|---|
| 330 | kStateGas,temperature,pressure);
|
|---|
| 331 | CO2->AddElement(elC, natoms=1);
|
|---|
| 332 | CO2->AddElement(elO, natoms=2);
|
|---|
| 333 |
|
|---|
| 334 | density = 0.3*mg/cm3;
|
|---|
| 335 | pressure = 2.*atmosphere;
|
|---|
| 336 | temperature = 500.*kelvin;
|
|---|
| 337 | G4Material* steam = new G4Material(name="Water steam ", density, ncomponents=1,
|
|---|
| 338 | kStateGas,temperature,pressure);
|
|---|
| 339 | steam->AddMaterial(H2O, fractionmass=1.);
|
|---|
| 340 |
|
|---|
| 341 | //
|
|---|
| 342 | // What about vacuum ? Vacuum is an ordinary gas with very low density
|
|---|
| 343 | //
|
|---|
| 344 |
|
|---|
| 345 | density = universe_mean_density; //from PhysicalConstants.h
|
|---|
| 346 | pressure = 1.e-19*pascal;
|
|---|
| 347 | temperature = 0.1*kelvin;
|
|---|
| 348 | new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,
|
|---|
| 349 | kStateGas,temperature,pressure);
|
|---|
| 350 |
|
|---|
| 351 | density = 1.e-5*g/cm3;
|
|---|
| 352 | pressure = 2.e-2*bar;
|
|---|
| 353 | temperature = STP_Temperature; //from PhysicalConstants.h
|
|---|
| 354 | G4Material* beam = new G4Material(name="Beam ", density, ncomponents=1,
|
|---|
| 355 | kStateGas,temperature,pressure);
|
|---|
| 356 | beam->AddMaterial(Air, fractionmass=1.);
|
|---|
| 357 |
|
|---|
| 358 | //
|
|---|
| 359 | // print the table of materials
|
|---|
| 360 | //
|
|---|
| 361 |
|
|---|
| 362 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 363 |
|
|---|
| 364 | return EXIT_SUCCESS;
|
|---|
| 365 | }
|
|---|
| 366 | </PRE>
|
|---|
| 367 | </td>
|
|---|
| 368 | </tr>
|
|---|
| 369 | <tr>
|
|---|
| 370 | <td align=center>
|
|---|
| 371 | Source listing 4.2.1<BR>
|
|---|
| 372 | A program which illustrates the different ways to define materials.
|
|---|
| 373 | </td>
|
|---|
| 374 | </tr>
|
|---|
| 375 | </table></center>
|
|---|
| 376 | <p>
|
|---|
| 377 | As can be seen in the later examples, a material has a state: solid (the
|
|---|
| 378 | default), liquid, or gas. The constructor checks the density and
|
|---|
| 379 | automatically sets the state to gas below a given threshold (10 mg/cm3).
|
|---|
| 380 | </p>
|
|---|
| 381 | <p>
|
|---|
| 382 | In the case of a gas, one may specify the temperature and pressure. The
|
|---|
| 383 | defaults are STP conditions defined in <tt>PhysicalConstants.hh</tt>.
|
|---|
| 384 | </p>
|
|---|
| 385 | <p>
|
|---|
| 386 | An element must have the number of nucleons >= number of protons >= 1.
|
|---|
| 387 | </p>
|
|---|
| 388 | <p>
|
|---|
| 389 | A material must have non-zero values of density, temperature and pressure.
|
|---|
| 390 | </p>
|
|---|
| 391 | <p>
|
|---|
| 392 | Materials can also be defined using the internal Geant4 database.
|
|---|
| 393 | Source listing 4.2.2 illustrates how to do this for the same materials
|
|---|
| 394 | used in 4.2.1. There are also UI commands which allow the database to
|
|---|
| 395 | be accessed. <a href="materialNames.html">
|
|---|
| 396 | <i>The list of currently available material names</a></i> is extended permanently.
|
|---|
| 397 | </p>
|
|---|
| 398 | <p>
|
|---|
| 399 | <center>
|
|---|
| 400 | <table border=2 cellpadding=10>
|
|---|
| 401 | <tr>
|
|---|
| 402 | <td>
|
|---|
| 403 | <PRE>
|
|---|
| 404 | #include "globals.hh"
|
|---|
| 405 | #include "G4Material.hh"
|
|---|
| 406 | #include "G4NistManager.hh"
|
|---|
| 407 |
|
|---|
| 408 | int main() {
|
|---|
| 409 |
|
|---|
| 410 | G4NistManager* man = G4NistManager::Instance();
|
|---|
| 411 | man->SetVerbose(1);
|
|---|
| 412 |
|
|---|
| 413 | //
|
|---|
| 414 | // define elements
|
|---|
| 415 | //
|
|---|
| 416 |
|
|---|
| 417 | G4Element* C = man->FindOrBuildElement("C");
|
|---|
| 418 | G4Element* Pb = man->FindOrBuildMaterial("Pb");
|
|---|
| 419 |
|
|---|
| 420 | //
|
|---|
| 421 | // define pure NIST materials
|
|---|
| 422 | //
|
|---|
| 423 |
|
|---|
| 424 | G4Material* Al = man->FindOrBuildMaterial("G4_Al");
|
|---|
| 425 | G4Material* Cu = man->FindOrBuildMaterial("G4_Cu");
|
|---|
| 426 |
|
|---|
| 427 | //
|
|---|
| 428 | // define NIST materials
|
|---|
| 429 | //
|
|---|
| 430 |
|
|---|
| 431 | G4Material* H2O = man->FindOrBuildMaterial("G4_WATER");
|
|---|
| 432 | G4Material* Sci = man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
|---|
| 433 | G4Material* SiO2 = man->FindOrBuildMaterial("G4_SILICON_DIOXIDE");
|
|---|
| 434 | G4Material* Air = man->FindOrBuildMaterial("G4_AIR");
|
|---|
| 435 |
|
|---|
| 436 | //
|
|---|
| 437 | // HEP materials
|
|---|
| 438 | //
|
|---|
| 439 |
|
|---|
| 440 | G4Material* PbWO4 = man->FindOrBuildMaterial("G4_PbWO4");
|
|---|
| 441 | G4Material* lAr = man->FindOrBuildMaterial("G4_lAr");
|
|---|
| 442 | G4Material* vac = man->FindOrBuildMaterial("G4_Galactic");
|
|---|
| 443 |
|
|---|
| 444 | //
|
|---|
| 445 | // define gas material at non STP conditions (T = 120K, P=0.5atm)
|
|---|
| 446 | //
|
|---|
| 447 |
|
|---|
| 448 | G4Material* coldAr = man->ConstructNewGasdMaterial("ColdAr","G4_Ar",120.*kelvin,0.5*atmosphere);
|
|---|
| 449 |
|
|---|
| 450 | //
|
|---|
| 451 | // print the table of materials
|
|---|
| 452 | //
|
|---|
| 453 |
|
|---|
| 454 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 455 |
|
|---|
| 456 | return EXIT_SUCCESS;
|
|---|
| 457 | }
|
|---|
| 458 | </PRE>
|
|---|
| 459 | </td>
|
|---|
| 460 | </tr>
|
|---|
| 461 | <tr>
|
|---|
| 462 | <td align=center>
|
|---|
| 463 | Source listing 4.2.2<BR>
|
|---|
| 464 | A program which shows how to define materials from the internal database.
|
|---|
| 465 | </td>
|
|---|
| 466 | </tr>
|
|---|
| 467 | </table></center>
|
|---|
| 468 |
|
|---|
| 469 | <hr>
|
|---|
| 470 | <a name="4.2.4">
|
|---|
| 471 | <h2>4.2.4 The Tables</h2></a>
|
|---|
| 472 |
|
|---|
| 473 | <b>Print a constituent</b>
|
|---|
| 474 | <p>
|
|---|
| 475 | The following shows how to print a constituent:
|
|---|
| 476 |
|
|---|
| 477 | <PRE>
|
|---|
| 478 | G4cout << elU << endl;
|
|---|
| 479 | G4cout << Air << endl;
|
|---|
| 480 | </PRE>
|
|---|
| 481 | <p>
|
|---|
| 482 | <b>Print the table of materials</b>
|
|---|
| 483 | <p>
|
|---|
| 484 | The following shows how to print the table of materials:
|
|---|
| 485 |
|
|---|
| 486 | <PRE>
|
|---|
| 487 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 488 | </PRE>
|
|---|
| 489 | <br>
|
|---|
| 490 | <br>
|
|---|
| 491 |
|
|---|
| 492 | <hr><a href="../../../../Authors/html/subjectsToAuthors.html">
|
|---|
| 493 | <i>About the authors</a></i>
|
|---|
| 494 | </p>
|
|---|
| 495 |
|
|---|
| 496 | </BODY>
|
|---|
| 497 | </HTML>
|
|---|