[904] | 1 | <!-- ******************************************************** --> |
---|
| 2 | <!-- --> |
---|
| 3 | <!-- [History] --> |
---|
| 4 | <!-- Changed by: Katsuya Amako, 4-Aug-1998 --> |
---|
| 5 | <!-- Changed by: Dennis Wright, 28-Nov-2001 --> |
---|
| 6 | <!-- Proof read by: Joe Chuma, 15-Jun-1999 --> |
---|
| 7 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> |
---|
| 8 | <!-- --> |
---|
| 9 | <!-- ******************************************************** --> |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | <!-- ******************* Section (Level#1) ****************** --> |
---|
| 13 | <sect1 id="sect.HowToSpecMate"> |
---|
| 14 | <title> |
---|
| 15 | How to Specify Materials in the Detector |
---|
| 16 | </title> |
---|
| 17 | |
---|
| 18 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 19 | <sect2 id="sect.HowToSpecMate.GeneCons"> |
---|
| 20 | <title> |
---|
| 21 | General Considerations |
---|
| 22 | </title> |
---|
| 23 | |
---|
| 24 | <para> |
---|
| 25 | In nature, general materials (chemical compounds, mixtures) are |
---|
| 26 | made of elements, and elements are made of isotopes. Therefore, |
---|
| 27 | these are the three main classes designed in Geant4. Each of these |
---|
| 28 | classes has a table as a static data member, which is for keeping |
---|
| 29 | track of the instances created of the respective classes. |
---|
| 30 | </para> |
---|
| 31 | |
---|
| 32 | <para> |
---|
| 33 | The <emphasis>G4Element</emphasis> class describes the properties of the |
---|
| 34 | atoms: |
---|
| 35 | <itemizedlist spacing="compact"> |
---|
| 36 | <listitem><para> |
---|
| 37 | atomic number, |
---|
| 38 | </para></listitem> |
---|
| 39 | <listitem><para> |
---|
| 40 | number of nucleons, |
---|
| 41 | </para></listitem> |
---|
| 42 | <listitem><para> |
---|
| 43 | atomic mass, |
---|
| 44 | </para></listitem> |
---|
| 45 | <listitem><para> |
---|
| 46 | shell energy, |
---|
| 47 | </para></listitem> |
---|
| 48 | <listitem><para> |
---|
| 49 | as well as quantities such as cross sections per atom, etc. |
---|
| 50 | </para></listitem> |
---|
| 51 | </itemizedlist> |
---|
| 52 | </para> |
---|
| 53 | |
---|
| 54 | <para> |
---|
| 55 | The <emphasis>G4Material</emphasis> class describes the macroscopic properties |
---|
| 56 | of matter: |
---|
| 57 | <itemizedlist spacing="compact"> |
---|
| 58 | <listitem><para> |
---|
| 59 | density, |
---|
| 60 | </para></listitem> |
---|
| 61 | <listitem><para> |
---|
| 62 | state, |
---|
| 63 | </para></listitem> |
---|
| 64 | <listitem><para> |
---|
| 65 | temperature, |
---|
| 66 | </para></listitem> |
---|
| 67 | <listitem><para> |
---|
| 68 | pressure, |
---|
| 69 | </para></listitem> |
---|
| 70 | <listitem><para> |
---|
| 71 | as well as macroscopic quantities like radiation length, mean |
---|
| 72 | free path, dE/dx, etc. |
---|
| 73 | </para></listitem> |
---|
| 74 | </itemizedlist> |
---|
| 75 | </para> |
---|
| 76 | |
---|
| 77 | <para> |
---|
| 78 | The <emphasis>G4Material</emphasis> class is the one which is visible to the |
---|
| 79 | rest of the toolkit, and is used by the tracking, the geometry, and |
---|
| 80 | the physics. It contains all the information relative to the |
---|
| 81 | eventual elements and isotopes of which it is made, at the same |
---|
| 82 | time hiding the implementation details. |
---|
| 83 | </para> |
---|
| 84 | |
---|
| 85 | </sect2> |
---|
| 86 | |
---|
| 87 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 88 | <sect2 id="sect.HowToSpecMate.DefSimpleMate"> |
---|
| 89 | <title> |
---|
| 90 | Define a Simple Material |
---|
| 91 | </title> |
---|
| 92 | |
---|
| 93 | <para> |
---|
| 94 | In the example below, liquid argon is created, by specifying its |
---|
| 95 | name, density, mass per mole, and atomic number. |
---|
| 96 | <example id="programlist_HowToSpecMate_1"> |
---|
| 97 | <title> |
---|
| 98 | Creating liquid argon. |
---|
| 99 | </title> |
---|
| 100 | <programlisting> |
---|
| 101 | G4double density = 1.390*g/cm3; |
---|
| 102 | G4double a = 39.95*g/mole; |
---|
| 103 | G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density); |
---|
| 104 | </programlisting> |
---|
| 105 | </example> |
---|
| 106 | </para> |
---|
| 107 | |
---|
| 108 | <para> |
---|
| 109 | The pointer to the material, <emphasis>lAr</emphasis>, will be used to specify |
---|
| 110 | the matter of which a given logical volume is made: |
---|
| 111 | <informalexample> |
---|
| 112 | <programlisting> |
---|
| 113 | G4LogicalVolume* myLbox = new G4LogicalVolume(aBox,lAr,"Lbox",0,0,0); |
---|
| 114 | </programlisting> |
---|
| 115 | </informalexample> |
---|
| 116 | </para> |
---|
| 117 | |
---|
| 118 | </sect2> |
---|
| 119 | |
---|
| 120 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 121 | <sect2 id="sect.HowToSpecMate.DefineMolecule"> |
---|
| 122 | <title> |
---|
| 123 | Define a Molecule |
---|
| 124 | </title> |
---|
| 125 | |
---|
| 126 | <para> |
---|
| 127 | In the example below, the water, <emphasis>H2O</emphasis>, is built from its |
---|
| 128 | components, by specifying the number of atoms in the molecule. |
---|
| 129 | <example id="programlist_HowToSpecMate_2"> |
---|
| 130 | <title> |
---|
| 131 | Creating water by defining its molecular components. |
---|
| 132 | </title> |
---|
| 133 | <programlisting> |
---|
| 134 | a = 1.01*g/mole; |
---|
| 135 | G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a); |
---|
| 136 | |
---|
| 137 | a = 16.00*g/mole; |
---|
| 138 | G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); |
---|
| 139 | |
---|
| 140 | density = 1.000*g/cm3; |
---|
| 141 | G4Material* H2O = new G4Material(name="Water",density,ncomponents=2); |
---|
| 142 | H2O->AddElement(elH, natoms=2); |
---|
| 143 | H2O->AddElement(elO, natoms=1); |
---|
| 144 | </programlisting> |
---|
| 145 | </example> |
---|
| 146 | </para> |
---|
| 147 | |
---|
| 148 | </sect2> |
---|
| 149 | |
---|
| 150 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 151 | <sect2 id="sect.HowToSpecMate.DefMixtureByFractionalMass"> |
---|
| 152 | <title> |
---|
| 153 | Define a Mixture by Fractional Mass |
---|
| 154 | </title> |
---|
| 155 | |
---|
| 156 | <para> |
---|
| 157 | In the example below, air is built from nitrogen and oxygen, by |
---|
| 158 | giving the fractional mass of each component. |
---|
| 159 | |
---|
| 160 | <example id="programlist_HowToSpecMate_3"> |
---|
| 161 | <title> |
---|
| 162 | Creating air by defining the fractional mass of its components. |
---|
| 163 | </title> |
---|
| 164 | <programlisting> |
---|
| 165 | a = 14.01*g/mole; |
---|
| 166 | G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a); |
---|
| 167 | |
---|
| 168 | a = 16.00*g/mole; |
---|
| 169 | G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a); |
---|
| 170 | |
---|
| 171 | density = 1.290*mg/cm3; |
---|
| 172 | G4Material* Air = new G4Material(name="Air ",density,ncomponents=2); |
---|
| 173 | Air->AddElement(elN, fractionmass=70*perCent); |
---|
| 174 | Air->AddElement(elO, fractionmass=30*perCent); |
---|
| 175 | </programlisting> |
---|
| 176 | </example> |
---|
| 177 | </para> |
---|
| 178 | |
---|
| 179 | </sect2> |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 183 | <sect2 id="sect.HowToSpecMate.DefMateFromDatabase"> |
---|
| 184 | <title> |
---|
| 185 | Define a Material from the Geant4 Material Database |
---|
| 186 | </title> |
---|
| 187 | |
---|
| 188 | <para> |
---|
| 189 | In the example below, air and water are accessed via the Geant4 |
---|
| 190 | material database. |
---|
| 191 | <example id="programlist_HowToSpecMate_4"> |
---|
| 192 | <title> |
---|
| 193 | Defining air and water from the internal Geant4 database. |
---|
| 194 | </title> |
---|
| 195 | <programlisting> |
---|
| 196 | G4NistManager* man = G4NistManager::Instance(); |
---|
| 197 | |
---|
| 198 | G4Material* H2O = man->FindOrBuildMaterial("G4_WATER"); |
---|
| 199 | G4Material* Air = man->FindOrBuildMaterial("G4_AIR"); |
---|
| 200 | </programlisting> |
---|
| 201 | </example> |
---|
| 202 | </para> |
---|
| 203 | |
---|
| 204 | </sect2> |
---|
| 205 | |
---|
| 206 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 207 | <sect2 id="sect.HowToSpecMate.PrintMateInfo"> |
---|
| 208 | <title> |
---|
| 209 | Print Material Information |
---|
| 210 | </title> |
---|
| 211 | |
---|
| 212 | <para> |
---|
| 213 | <example id="programlist_HowToSpecMate_5"> |
---|
| 214 | <title> |
---|
| 215 | Printing information about materials. |
---|
| 216 | </title> |
---|
| 217 | <programlisting> |
---|
| 218 | G4cout << H2O; \\ print a given material |
---|
| 219 | G4cout << *(G4Material::GetMaterialTable()); \\ print the list of materials |
---|
| 220 | </programlisting> |
---|
| 221 | </example> |
---|
| 222 | |
---|
| 223 | In <literal>examples/novice/N03/N03DetectorConstruction.cc</literal>, you |
---|
| 224 | will find examples of all possible ways to build a material. |
---|
| 225 | </para> |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | </sect2> |
---|
| 229 | </sect1> |
---|