source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/GettingStarted/materialDef.html @ 1358

Last change on this file since 1358 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 5.4 KB
Line 
1<HTML>
2<TITLE>
3</TITLE>
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
8<BODY>
9<TABLE WIDTH="100%"><TR>
10<TD>
11
12
13<A HREF="index.html">
14<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></A>
15<A HREF="geometryDef.html">
16<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous">
17<A HREF="particleDef.html">
18<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></A>
19</TD>
20<TD ALIGN="Right">
21<FONT SIZE="-1" COLOR="#238E23">
22<B>Geant4 User's Guide</B>
23<BR>
24<B>For Application Developers</B>
25<BR>
26<B>Getting Started with Geant4</B>
27</FONT>
28</TD>
29</TR></TABLE>
30<BR>
31
32<P ALIGN="Center">
33<FONT SIZE="+3" COLOR="#238E23">
34<B>2.3 How to Specify Materials in the Detector</B>
35</FONT>
36<P><BR>
37
38<HR ALIGN="Center" SIZE="7%">
39<p>
40
41<a name="2.3.1">
42<H2>2.3.1 General Considerations</H2></a>
43
44 In nature, general materials (chemical compounds, mixtures) are made of
45 elements, and elements are made of isotopes.
46 Therefore, these are the three main classes designed in Geant4.
47 Each of these classes has a table as a static data member,
48 which is for keeping track of the instances created of the respective
49 classes.
50<P>
51 The <i>G4Element</i> class describes the properties of the atoms:
52<ul>
53 <li>atomic number,
54 <li>number of nucleons,
55 <li>atomic mass,
56 <li>shell energy,
57 <li>as well as quantities such as cross sections per atom, etc.
58</ul>
59<P>
60 The <i>G4Material</i> class describes the macroscopic properties of matter:
61<ul>
62 <li>density,
63 <li>state,
64 <li>temperature,
65 <li>pressure,
66 <li>as well as macroscopic quantities like radiation length, mean free path, dE/dx, etc.
67</ul>
68<P>
69 The <i>G4Material</i> class is the one which is visible to the rest
70 of the toolkit, and is used by the tracking, the geometry, and
71 the physics. It contains all the information relative to
72 the eventual elements and isotopes of which it is made, at the same time hiding
73 the implementation details.
74<P>
75
76<HR>
77<a name="2.3.2">
78<H2>2.3.2 Define a Simple Material</H2></a>
79
80 In the example below, liquid argon is created, by specifying its name,
81 density, mass per mole, and atomic number.
82<P>
83<center>
84<table border=2 cellpadding=10>
85<tr>
86<td>
87<PRE>
88  G4double density = 1.390*g/cm3;
89  G4double a = 39.95*g/mole;
90  G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
91</PRE>
92</td>
93</tr>
94<tr>
95<td align=center>
96 Source listing 2.3.1<BR>
97 Creating liquid argon.
98</td>
99</tr>
100</table></center>
101<p>
102 The pointer to the material, <i>lAr</i>, will be used to specify the matter of which
103 a given logical volume is made:
104<P>
105<PRE>
106  G4LogicalVolume* myLbox = new G4LogicalVolume(aBox,lAr,"Lbox",0,0,0);
107</PRE>
108<P>
109
110<HR>
111<a name="2.3.3">
112<H2>2.3.3 Define a Molecule</H2></a>
113
114 In the example below, the water, <i>H2O</i>, is built from its components,
115 by specifying the number of atoms in the molecule.
116<P>
117<center>
118<table border=2 cellpadding=10>
119<tr>
120<td>
121<PRE>
122  a = 1.01*g/mole;
123  G4Element* elH  = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
124
125  a = 16.00*g/mole;
126  G4Element* elO  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
127
128  density = 1.000*g/cm3;
129  G4Material* H2O = new G4Material(name="Water",density,ncomponents=2);
130  H2O->AddElement(elH, natoms=2);
131  H2O->AddElement(elO, natoms=1);
132</PRE>
133</td>
134</tr>
135<tr>
136<td align=center>
137 Source listing 2.3.2<BR>
138 Creating water by defining its molecular components.
139</td>
140</tr>
141</table></center>
142<P>
143
144<HR>
145<a name+"2.3.4">
146<H2>2.3.4 Define a Mixture by Fractional Mass</H2></a>
147
148 In the example below, air is built from nitrogen and oxygen, by giving the
149 fractional mass of each component.
150<P>
151<center>
152<table border=2 cellpadding=10>
153<tr>
154<td>
155<PRE>
156  a = 14.01*g/mole;
157  G4Element* elN  = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
158
159  a = 16.00*g/mole;
160  G4Element* elO  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
161
162  density = 1.290*mg/cm3;
163  G4Material* Air = new G4Material(name="Air  ",density,ncomponents=2);
164  Air->AddElement(elN, fractionmass=70*perCent);
165  Air->AddElement(elO, fractionmass=30*perCent);
166</PRE>
167</td>
168</tr>
169<tr>
170<td align=center>
171 Source listing 2.3.3<BR>
172 Creating air by defining the fractional mass of its components.
173</td>
174</tr>
175</table></center>
176<P>
177
178<HR>
179<a name+"2.3.5">
180<H2>2.3.5 Define a Material from the Geant4 Material Database</H2></a>
181
182 In the example below, air and water are accessed via the Geant4 material database.
183<P>
184<center>
185<table border=2 cellpadding=10>
186<tr>
187<td>
188<PRE>
189
190  G4NistManager* man = G4NistManager::Instance();
191
192  G4Material* H2O  = man->FindOrBuildMaterial("G4_WATER");
193  G4Material* Air  = man->FindOrBuildMaterial("G4_AIR");
194
195</PRE>
196</td>
197</tr>
198<tr>
199<td align=center>
200 Source listing 2.3.4<BR>
201 Defining air and water from the internal Geant4 database.
202</td>
203</tr>
204</table></center>
205<P>
206
207<HR>
208<a name="2.3.6">
209<H2>2.3.6 Print Material Information</H2></a>
210
211<center>
212<table border=2 cellpadding=10>
213<tr>
214<td>
215<PRE>
216  G4cout << H2O;                                \\ print a given material
217  G4cout << *(G4Material::GetMaterialTable());  \\ print the list of materials
218</PRE>
219</td>
220</tr>
221<tr>
222<td align=center>
223 Source listing 2.3.5<BR>
224 Printing information about materials.
225</td>
226</tr>
227</table></center>
228<P>
229 In <tt>examples/novice/N03/N03DetectorConstruction.cc</tt>, you will
230 find examples of all possible ways to build a material.
231<P>
232
233<HR>
234<A HREF="../../../../Authors/html/subjectsToAuthors.html">
235<I>About the authors</I></A>
236
237</BODY>
238</HTML>
Note: See TracBrowser for help on using the repository browser.