| 1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.2. Material</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="ch04.html" title="Chapter 4. Detector Definition and Response"><link rel="prev" href="ch04.html" title="Chapter 4. Detector Definition and Response"><link rel="next" href="ch04s03.html" title="4.3. Electromagnetic Field"><script language="JavaScript">
|
|---|
| 2 | function remote_win(fName)
|
|---|
| 3 | {
|
|---|
| 4 | var url = "AllResources/Detector/geometry.src/" + fName;
|
|---|
| 5 | RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
|
|---|
| 6 | RemoteWin.creator=self
|
|---|
| 7 | }
|
|---|
| 8 | </script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.2.
|
|---|
| 9 | Material
|
|---|
| 10 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 4.
|
|---|
| 11 | Detector Definition and Response
|
|---|
| 12 | </th><td width="20%" align="right"> <a accesskey="n" href="ch04s03.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.Mate"></a>4.2.
|
|---|
| 13 | Material
|
|---|
| 14 | </h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Mate.GenCons"></a>4.2.1.
|
|---|
| 15 | General considerations
|
|---|
| 16 | </h3></div></div></div><p>
|
|---|
| 17 | In nature, materials (chemical compounds, mixtures) are made of
|
|---|
| 18 | elements, and elements are made of isotopes. Geant4 has three main
|
|---|
| 19 | classes designed to reflect this organization. Each of these
|
|---|
| 20 | classes has a table, which is a static data member, used to keep
|
|---|
| 21 | track of the instances of the respective classes created.
|
|---|
| 22 |
|
|---|
| 23 | </p><div class="variablelist"><p class="title"><b></b></p><dl><dt><span class="term">
|
|---|
| 24 | <span class="emphasis"><em>G4Isotope</em></span>
|
|---|
| 25 | </span></dt><dd><p>
|
|---|
| 26 | This class describes the properties of atoms: atomic number,
|
|---|
| 27 | number of nucleons, mass per mole, etc.
|
|---|
| 28 | </p></dd><dt><span class="term">
|
|---|
| 29 | <span class="emphasis"><em>G4Element</em></span>
|
|---|
| 30 | </span></dt><dd><p>
|
|---|
| 31 | This class describes the properties of elements: effective
|
|---|
| 32 | atomic number, effective number of nucleons, effective mass per
|
|---|
| 33 | mole, number of isotopes, shell energy, and quantities like cross
|
|---|
| 34 | section per atom, etc.
|
|---|
| 35 | </p></dd><dt><span class="term">
|
|---|
| 36 | <span class="emphasis"><em>G4Material</em></span>
|
|---|
| 37 | </span></dt><dd><p>
|
|---|
| 38 | This class describes the macroscopic properties of matter:
|
|---|
| 39 | density, state, temperature, pressure, and macroscopic quantities
|
|---|
| 40 | like radiation length, mean free path, dE/dx, etc.
|
|---|
| 41 | </p></dd></dl></div><p>
|
|---|
| 42 | </p><p>
|
|---|
| 43 | Only the <span class="emphasis"><em>G4Material</em></span> class is visible to the rest of the
|
|---|
| 44 | toolkit and used by the tracking, the geometry and the physics. It
|
|---|
| 45 | contains all the information relevant to its constituent elements
|
|---|
| 46 | and isotopes, while at the same time hiding their implementation
|
|---|
| 47 | details.
|
|---|
| 48 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Mate.Intro"></a>4.2.2.
|
|---|
| 49 | Introduction to the Classes
|
|---|
| 50 | </h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Intro.Iso"></a>4.2.2.1.
|
|---|
| 51 | G4Isotope
|
|---|
| 52 | </h4></div></div></div><p>
|
|---|
| 53 | A <span class="emphasis"><em>G4Isotope</em></span> object has a name, atomic number, number of
|
|---|
| 54 | nucleons, mass per mole, and an index in the table. The constructor
|
|---|
| 55 | automatically stores "this" isotope in the isotopes table, which
|
|---|
| 56 | will assign it an index number.
|
|---|
| 57 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Intro.Ele"></a>4.2.2.2.
|
|---|
| 58 | G4Element
|
|---|
| 59 | </h4></div></div></div><p>
|
|---|
| 60 | A <span class="emphasis"><em>G4Element</em></span> object has a name, symbol, effective atomic
|
|---|
| 61 | number, effective number of nucleons, effective mass of a mole, an
|
|---|
| 62 | index in the elements table, the number of isotopes, a vector of
|
|---|
| 63 | pointers to such isotopes, and a vector of relative abundances
|
|---|
| 64 | referring to such isotopes (where relative abundance means the
|
|---|
| 65 | number of atoms per volume). In addition, the class has methods to
|
|---|
| 66 | add, one by one, the isotopes which are to form the element.
|
|---|
| 67 | </p><p>
|
|---|
| 68 | A <span class="emphasis"><em>G4Element</em></span> object can be constructed by directly
|
|---|
| 69 | providing the effective atomic number, effective number of
|
|---|
| 70 | nucleons, and effective mass of a mole, if the user explicitly
|
|---|
| 71 | wants to do so. Alternatively, a <span class="emphasis"><em>G4Element</em></span> object can be
|
|---|
| 72 | constructed by declaring the number of isotopes of which it will be
|
|---|
| 73 | composed. The constructor will "new" a vector of pointers to
|
|---|
| 74 | <span class="emphasis"><em>G4Isotopes</em></span> and a vector of doubles to store their relative
|
|---|
| 75 | abundances. Finally, the method to add an isotope must be invoked
|
|---|
| 76 | for each of the desired (pre-existing) isotope objects, providing
|
|---|
| 77 | their addresses and relative abundances. At the last isotope entry,
|
|---|
| 78 | the system will automatically compute the effective atomic number,
|
|---|
| 79 | effective number of nucleons and effective mass of a mole, and will
|
|---|
| 80 | store "this" element in the elements table.
|
|---|
| 81 | </p><p>
|
|---|
| 82 | A few quantities, with physical meaning or not, which are
|
|---|
| 83 | constant in a given element, are computed and stored here as
|
|---|
| 84 | "derived data members".
|
|---|
| 85 | </p><p>
|
|---|
| 86 | Using the internal Geant4 database, a <span class="emphasis"><em>G4Element</em></span> can be accessed
|
|---|
| 87 | by atomic number or by atomic symbol ("Al", "Fe", "Pb"...). In that
|
|---|
| 88 | case <span class="emphasis"><em>G4Element</em></span> will be found from the list of existing elements or
|
|---|
| 89 | will be constructed using data from the Geant4 database, which is
|
|---|
| 90 | derived from the
|
|---|
| 91 | <a href="http://physics.nist.gov/PhysRefData/Compositions/index.html" target="_top">NIST database
|
|---|
| 92 | of elements and isotope compositions</a>.
|
|---|
| 93 | Thus, the natural isotope composition can be built by default.
|
|---|
| 94 | The same element
|
|---|
| 95 | can be created as using the NIST database with the
|
|---|
| 96 | natural composition of isotopes
|
|---|
| 97 | and from scratch in user code with user defined isotope composition.
|
|---|
| 98 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Intro.Mate"></a>4.2.2.3.
|
|---|
| 99 | G4Material
|
|---|
| 100 | </h4></div></div></div><p>
|
|---|
| 101 | A <span class="emphasis"><em>G4Material</em></span> object has a name, density, physical state,
|
|---|
| 102 | temperature and pressure (by default the standard conditions), the
|
|---|
| 103 | number of elements and a vector of pointers to such elements, a
|
|---|
| 104 | vector of the fraction of mass for each element, a vector of the
|
|---|
| 105 | atoms (or molecules) numbers of each element, and an index in the
|
|---|
| 106 | materials table. In addition, the class has methods to add, one by
|
|---|
| 107 | one, the elements which will comprise the material.
|
|---|
| 108 | </p><p>
|
|---|
| 109 | A <span class="emphasis"><em>G4Material</em></span> object can be constructed by directly
|
|---|
| 110 | providing the resulting effective numbers, if the user explicitly
|
|---|
| 111 | wants to do so (an underlying element will be created with these
|
|---|
| 112 | numbers). Alternatively, a <span class="emphasis"><em>G4Material</em></span> object can be
|
|---|
| 113 | constructed by declaring the number of elements of which it will be
|
|---|
| 114 | composed. The constructor will "new" a vector of pointers to
|
|---|
| 115 | <span class="emphasis"><em>G4Element</em></span> and a vector of doubles to store their fraction of
|
|---|
| 116 | mass. Finally, the method to add an element must be invoked for
|
|---|
| 117 | each of the desired (pre-existing) element objects, providing their
|
|---|
| 118 | addresses and mass fractions. At the last element entry, the system
|
|---|
| 119 | will automatically compute the vector of the number of atoms of
|
|---|
| 120 | each element per volume, the total number of electrons per volume,
|
|---|
| 121 | and will store "this" material in the materials table. In the same
|
|---|
| 122 | way, a material can be constructed as a mixture of other materials
|
|---|
| 123 | and elements.
|
|---|
| 124 | </p><p>
|
|---|
| 125 | It should be noted that if the user provides the number of atoms
|
|---|
| 126 | (or molecules) for each element comprising the chemical compound,
|
|---|
| 127 | the system automatically computes the mass fraction. A few
|
|---|
| 128 | quantities, with physical meaning or not, which are constant in a
|
|---|
| 129 | given material, are computed and stored here as "derived data
|
|---|
| 130 | members".
|
|---|
| 131 | </p><p>
|
|---|
| 132 | Some materials are included in the internal Geant4 database,
|
|---|
| 133 | which were derived from the
|
|---|
| 134 | <a href="http://physics.nist.gov/PhysRefData/Star/Text/method.html" target="_top">NIST database
|
|---|
| 135 | of material properties</a>.
|
|---|
| 136 | Additionally a number of materials friquently used in HEP is
|
|---|
| 137 | included in the database. Materials are interrogated or constructed
|
|---|
| 138 | by their <span class="emphasis"><em>names</em></span> (<a href="apas08.html" title="8.
|
|---|
| 139 | Geant4 Material Database
|
|---|
| 140 | ">Section 8</a>).
|
|---|
| 141 | There are UI commands for the material category, which provide
|
|---|
| 142 | an interactive access to the database. If material is created
|
|---|
| 143 | using the NIST database by it will
|
|---|
| 144 | consist by default of elements with the natural composition of isotopes.
|
|---|
| 145 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Intro.Fin"></a>4.2.2.4.
|
|---|
| 146 | Final Considerations
|
|---|
| 147 | </h4></div></div></div><p>
|
|---|
| 148 | The classes will automatically decide
|
|---|
| 149 | if the total of the mass fractions is correct, and perform the
|
|---|
| 150 | necessary checks. The main reason why a fixed index is kept as a
|
|---|
| 151 | data member is that many cross section and energy tables will be
|
|---|
| 152 | built in the physics processes "by rows of materials (or elements,
|
|---|
| 153 | or even isotopes)". The tracking gives the physics process the
|
|---|
| 154 | address of a material object (the material of the current volume).
|
|---|
| 155 | If the material has an index according to which the cross section
|
|---|
| 156 | table has been built, then direct access is available when a number
|
|---|
| 157 | in such a table must be accessed. We get directly to the correct
|
|---|
| 158 | row, and the energy of the particle will tell us the column.
|
|---|
| 159 | Without such an index, every access to the cross section or energy
|
|---|
| 160 | tables would imply a search to get to the correct material's row.
|
|---|
| 161 | More details will be given in the section on processes.
|
|---|
| 162 | </p><p>
|
|---|
| 163 | Isotopes, elements and materials must be instantiated dynamically
|
|---|
| 164 | in the user application; they are automatically registered in
|
|---|
| 165 | internal stores and the system takes care to free the memory
|
|---|
| 166 | allocated at the end of the job.
|
|---|
| 167 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Mate.Recep"></a>4.2.3.
|
|---|
| 168 | Recipes for Building Elements and Materials
|
|---|
| 169 | </h3></div></div></div><p>
|
|---|
| 170 | <a href="ch04s02.html#programlist_Mate_1" title="Example 4.10.
|
|---|
| 171 | A program which illustrates the different ways to define materials.
|
|---|
| 172 | ">Example 4.10</a> illustrates the different ways to define
|
|---|
| 173 | materials.
|
|---|
| 174 | </p><div class="example"><a name="programlist_Mate_1"></a><p class="title"><b>Example 4.10.
|
|---|
| 175 | A program which illustrates the different ways to define materials.
|
|---|
| 176 | </b></p><div class="example-contents"><pre class="programlisting">
|
|---|
| 177 | #include "G4Isotope.hh"
|
|---|
| 178 | #include "G4Element.hh"
|
|---|
| 179 | #include "G4Material.hh"
|
|---|
| 180 | #include "G4UnitsTable.hh"
|
|---|
| 181 |
|
|---|
| 182 | int main() {
|
|---|
| 183 | G4String name, symbol; // a=mass of a mole;
|
|---|
| 184 | G4double a, z, density; // z=mean number of protons;
|
|---|
| 185 | G4int iz, n; // iz=nb of protons in an isotope;
|
|---|
| 186 | // n=nb of nucleons in an isotope;
|
|---|
| 187 | G4int ncomponents, natoms;
|
|---|
| 188 | G4double abundance, fractionmass;
|
|---|
| 189 | G4double temperature, pressure;
|
|---|
| 190 |
|
|---|
| 191 | G4UnitDefinition::BuildUnitsTable();
|
|---|
| 192 |
|
|---|
| 193 | // define Elements
|
|---|
| 194 | a = 1.01*g/mole;
|
|---|
| 195 | G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
|
|---|
| 196 |
|
|---|
| 197 | a = 12.01*g/mole;
|
|---|
| 198 | G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
|
|---|
| 199 |
|
|---|
| 200 | a = 14.01*g/mole;
|
|---|
| 201 | G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
|
|---|
| 202 |
|
|---|
| 203 | a = 16.00*g/mole;
|
|---|
| 204 | G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
|
|---|
| 205 |
|
|---|
| 206 | a = 28.09*g/mole;
|
|---|
| 207 | G4Element* elSi = new G4Element(name="Silicon", symbol="Si", z=14., a);
|
|---|
| 208 |
|
|---|
| 209 | a = 55.85*g/mole;
|
|---|
| 210 | G4Element* elFe = new G4Element(name="Iron" ,symbol="Fe", z=26., a);
|
|---|
| 211 |
|
|---|
| 212 | a = 183.84*g/mole;
|
|---|
| 213 | G4Element* elW = new G4Element(name="Tungsten" ,symbol="W", z=74., a);
|
|---|
| 214 |
|
|---|
| 215 | a = 207.20*g/mole;
|
|---|
| 216 | G4Element* elPb = new G4Element(name="Lead" ,symbol="Pb", z=82., a);
|
|---|
| 217 |
|
|---|
| 218 | // define an Element from isotopes, by relative abundance
|
|---|
| 219 | G4Isotope* U5 = new G4Isotope(name="U235", iz=92, n=235, a=235.01*g/mole);
|
|---|
| 220 | G4Isotope* U8 = new G4Isotope(name="U238", iz=92, n=238, a=238.03*g/mole);
|
|---|
| 221 |
|
|---|
| 222 | G4Element* elU = new G4Element(name="enriched Uranium", symbol="U", ncomponents=2);
|
|---|
| 223 | elU->AddIsotope(U5, abundance= 90.*perCent);
|
|---|
| 224 | elU->AddIsotope(U8, abundance= 10.*perCent);
|
|---|
| 225 |
|
|---|
| 226 | cout << *(G4Isotope::GetIsotopeTable()) << endl;
|
|---|
| 227 | cout << *(G4Element::GetElementTable()) << endl;
|
|---|
| 228 | </pre></div></div><br class="example-break"><div class="informalexample"><pre class="programlisting">
|
|---|
| 229 | // define simple materials
|
|---|
| 230 | density = 2.700*g/cm3;
|
|---|
| 231 | a = 26.98*g/mole;
|
|---|
| 232 | G4Material* Al = new G4Material(name="Aluminum", z=13., a, density);
|
|---|
| 233 |
|
|---|
| 234 | density = 1.390*g/cm3;
|
|---|
| 235 | a = 39.95*g/mole;
|
|---|
| 236 | vG4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
|
|---|
| 237 |
|
|---|
| 238 | density = 8.960*g/cm3;
|
|---|
| 239 | a = 63.55*g/mole;
|
|---|
| 240 | G4Material* Cu = new G4Material(name="Copper" , z=29., a, density);
|
|---|
| 241 |
|
|---|
| 242 | // define a material from elements. case 1: chemical molecule
|
|---|
| 243 | density = 1.000*g/cm3;
|
|---|
| 244 | G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
|
|---|
| 245 | H2O->AddElement(elH, natoms=2);
|
|---|
| 246 | H2O->AddElement(elO, natoms=1);
|
|---|
| 247 |
|
|---|
| 248 | density = 1.032*g/cm3;
|
|---|
| 249 | G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
|
|---|
| 250 | Sci->AddElement(elC, natoms=9);
|
|---|
| 251 | Sci->AddElement(elH, natoms=10);
|
|---|
| 252 |
|
|---|
| 253 | density = 2.200*g/cm3;
|
|---|
| 254 | G4Material* SiO2 = new G4Material(name="quartz", density, ncomponents=2);
|
|---|
| 255 | SiO2->AddElement(elSi, natoms=1);
|
|---|
| 256 | SiO2->AddElement(elO , natoms=2);
|
|---|
| 257 |
|
|---|
| 258 | density = 8.280*g/cm3;
|
|---|
| 259 | G4Material* PbWO4= new G4Material(name="PbWO4", density, ncomponents=3);
|
|---|
| 260 | PbWO4->AddElement(elO , natoms=4);
|
|---|
| 261 | PbWO4->AddElement(elW , natoms=1);
|
|---|
| 262 | PbWO4->AddElement(elPb, natoms=1);
|
|---|
| 263 |
|
|---|
| 264 | // define a material from elements. case 2: mixture by fractional mass
|
|---|
| 265 | density = 1.290*mg/cm3;
|
|---|
| 266 | G4Material* Air = new G4Material(name="Air " , density, ncomponents=2);
|
|---|
| 267 | Air->AddElement(elN, fractionmass=0.7);
|
|---|
| 268 | Air->AddElement(elO, fractionmass=0.3);
|
|---|
| 269 |
|
|---|
| 270 | // define a material from elements and/or others materials (mixture of mixtures)
|
|---|
| 271 | density = 0.200*g/cm3;
|
|---|
| 272 | G4Material* Aerog = new G4Material(name="Aerogel", density, ncomponents=3);
|
|---|
| 273 | Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
|
|---|
| 274 | Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
|
|---|
| 275 | Aerog->AddElement (elC , fractionmass= 0.1*perCent);
|
|---|
| 276 | </pre></div><div class="informalexample"><pre class="programlisting">
|
|---|
| 277 | // examples of gas in non STP conditions
|
|---|
| 278 | density = 27.*mg/cm3;
|
|---|
| 279 | pressure = 50.*atmosphere;
|
|---|
| 280 | temperature = 325.*kelvin;
|
|---|
| 281 | G4Material* CO2 = new G4Material(name="Carbonic gas", density, ncomponents=2,
|
|---|
| 282 | kStateGas,temperature,pressure);
|
|---|
| 283 | CO2->AddElement(elC, natoms=1);
|
|---|
| 284 | CO2->AddElement(elO, natoms=2);
|
|---|
| 285 |
|
|---|
| 286 | density = 0.3*mg/cm3;
|
|---|
| 287 | pressure = 2.*atmosphere;
|
|---|
| 288 | temperature = 500.*kelvin;
|
|---|
| 289 | G4Material* steam = new G4Material(name="Water steam ", density, ncomponents=1,
|
|---|
| 290 | kStateGas,temperature,pressure);
|
|---|
| 291 | steam->AddMaterial(H2O, fractionmass=1.);
|
|---|
| 292 |
|
|---|
| 293 | // What about vacuum ? Vacuum is an ordinary gas with very low density
|
|---|
| 294 | density = universe_mean_density; //from PhysicalConstants.h
|
|---|
| 295 | pressure = 1.e-19*pascal;
|
|---|
| 296 | temperature = 0.1*kelvin;
|
|---|
| 297 | new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,
|
|---|
| 298 | kStateGas,temperature,pressure);
|
|---|
| 299 |
|
|---|
| 300 | density = 1.e-5*g/cm3;
|
|---|
| 301 | pressure = 2.e-2*bar;
|
|---|
| 302 | temperature = STP_Temperature; //from PhysicalConstants.h
|
|---|
| 303 | G4Material* beam = new G4Material(name="Beam ", density, ncomponents=1,
|
|---|
| 304 | kStateGas,temperature,pressure);
|
|---|
| 305 | beam->AddMaterial(Air, fractionmass=1.);
|
|---|
| 306 |
|
|---|
| 307 | // print the table of materials
|
|---|
| 308 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 309 |
|
|---|
| 310 | return EXIT_SUCCESS;
|
|---|
| 311 | }
|
|---|
| 312 | </pre></div><p>
|
|---|
| 313 | As can be seen in the later examples, a material has a state:
|
|---|
| 314 | solid (the default), liquid, or gas. The constructor checks the
|
|---|
| 315 | density and automatically sets the state to gas below a given
|
|---|
| 316 | threshold (10 mg/cm3).
|
|---|
| 317 | </p><p>
|
|---|
| 318 | In the case of a gas, one may specify the temperature and
|
|---|
| 319 | pressure. The defaults are STP conditions defined in
|
|---|
| 320 | <code class="literal">PhysicalConstants.hh</code>.
|
|---|
| 321 | </p><p>
|
|---|
| 322 | An element must have the number of nucleons >= number of
|
|---|
| 323 | protons >= 1.
|
|---|
| 324 | </p><p>
|
|---|
| 325 | A material must have non-zero values of density, temperature and
|
|---|
| 326 | pressure.
|
|---|
| 327 | </p><p>
|
|---|
| 328 | Materials can also be defined using the internal Geant4
|
|---|
| 329 | database. <a href="ch04s02.html#programlist_Mate_2" title="Example 4.11.
|
|---|
| 330 | A program which shows how to define materials from the internal database.
|
|---|
| 331 | ">Example 4.11</a> illustrates
|
|---|
| 332 | how to do this for the same materials used in
|
|---|
| 333 | <a href="ch04s02.html#programlist_Mate_1" title="Example 4.10.
|
|---|
| 334 | A program which illustrates the different ways to define materials.
|
|---|
| 335 | ">Example 4.10</a>.
|
|---|
| 336 | There are also UI commands which allow the database to be accessed.
|
|---|
| 337 | <span class="emphasis"><em>The list of currently avalable material names</em></span>
|
|---|
| 338 | (<a href="apas08.html" title="8.
|
|---|
| 339 | Geant4 Material Database
|
|---|
| 340 | ">Section 8</a>) is extended permanetly.
|
|---|
| 341 | </p><div class="example"><a name="programlist_Mate_2"></a><p class="title"><b>Example 4.11.
|
|---|
| 342 | A program which shows how to define materials from the internal database.
|
|---|
| 343 | </b></p><div class="example-contents"><pre class="programlisting">
|
|---|
| 344 | #include "globals.hh"
|
|---|
| 345 | #include "G4Material.hh"
|
|---|
| 346 | #include "G4NistManager.hh"
|
|---|
| 347 |
|
|---|
| 348 | int main() {
|
|---|
| 349 | G4NistManager* man = G4NistManager::Instance();
|
|---|
| 350 | man->SetVerbose(1);
|
|---|
| 351 |
|
|---|
| 352 | // define elements
|
|---|
| 353 | G4Element* C = man->FindOrBuildElement("C");
|
|---|
| 354 | G4Element* Pb = man->FindOrBuildMaterial("Pb");
|
|---|
| 355 |
|
|---|
| 356 | // define pure NIST materials
|
|---|
| 357 | G4Material* Al = man->FindOrBuildMaterial("G4_Al");
|
|---|
| 358 | G4Material* Cu = man->FindOrBuildMaterial("G4_Cu");
|
|---|
| 359 |
|
|---|
| 360 | // define NIST materials
|
|---|
| 361 | G4Material* H2O = man->FindOrBuildMaterial("G4_WATER");
|
|---|
| 362 | G4Material* Sci = man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
|---|
| 363 | G4Material* SiO2 = man->FindOrBuildMaterial("G4_SILICON_DIOXIDE");
|
|---|
| 364 | G4Material* Air = man->FindOrBuildMaterial("G4_AIR");
|
|---|
| 365 |
|
|---|
| 366 | // HEP materials
|
|---|
| 367 | G4Material* PbWO4 = man->FindOrBuildMaterial("G4_PbWO4");
|
|---|
| 368 | G4Material* lAr = man->FindOrBuildMaterial("G4_lAr");
|
|---|
| 369 | G4Material* vac = man->FindOrBuildMaterial("G4_Galactic");
|
|---|
| 370 |
|
|---|
| 371 | // define gas material at non STP conditions (T = 120K, P=0.5atm)
|
|---|
| 372 | G4Material* coldAr = man->ConstructNewGasdMaterial("ColdAr","G4_Ar",120.*kelvin,0.5*atmosphere);
|
|---|
| 373 |
|
|---|
| 374 | // print the table of materials
|
|---|
| 375 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 376 |
|
|---|
| 377 | return EXIT_SUCCESS;
|
|---|
| 378 | }
|
|---|
| 379 | </pre></div></div><br class="example-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Mate.Tables"></a>4.2.4.
|
|---|
| 380 | The Tables
|
|---|
| 381 | </h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Tables.PrintCons"></a>4.2.4.1.
|
|---|
| 382 | Print a constituent
|
|---|
| 383 | </h4></div></div></div><p>
|
|---|
| 384 | The following shows how to print a constituent:
|
|---|
| 385 |
|
|---|
| 386 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 387 | G4cout << elU << endl;
|
|---|
| 388 | G4cout << Air << endl;
|
|---|
| 389 | </pre></div><p>
|
|---|
| 390 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Mate.Tables.PrintTab"></a>4.2.4.2.
|
|---|
| 391 | Print the table of materials
|
|---|
| 392 | </h4></div></div></div><p>
|
|---|
| 393 | The following shows how to print the table of materials:
|
|---|
| 394 |
|
|---|
| 395 | </p><div class="informalexample"><pre class="programlisting">
|
|---|
| 396 | G4cout << *(G4Material::GetMaterialTable()) << endl;
|
|---|
| 397 | </pre></div><p>
|
|---|
| 398 | </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s03.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4.
|
|---|
| 399 | Detector Definition and Response
|
|---|
| 400 | </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> 4.3.
|
|---|
| 401 | Electromagnetic Field
|
|---|
| 402 | </td></tr></table></div></body></html>
|
|---|