source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/geometryDef.xml @ 1358

Last change on this file since 1358 was 904, checked in by garnier, 16 years ago

ajout de la doc

File size: 9.4 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Changed by: Katsuya Amako,  6-Aug-1998                -->
5<!--    Changed by: Dennis Wright, 28-Nov-2001                -->
6<!--    Proof read by: Joe Chuma,  14-Jun-1999                -->
7<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
8<!--                                                          -->
9<!-- ******************************************************** -->
10
11
12<!-- ******************* Section (Level#1) ****************** -->
13<sect1 id="sect.HowToDefDetectorGeom">
14<title>
15How to Define a Detector Geometry
16</title>
17
18<!-- ******************* Section (Level#2) ****************** -->
19<sect2 id="sect.HowToDefDetectorGeom.BasicConcepts">
20<title>
21Basic Concepts
22</title>
23
24<para>
25A detector geometry in Geant4 is made of a number of volumes. The
26largest volume is called the <emphasis role="bold">World</emphasis> 
27volume. It must contain, with some margin, all other volumes
28in the detector geometry. The other volumes are created and placed
29inside previous volumes, included in the World volume.
30The most simple (and efficient) shape to describe the World is a box.
31</para>
32
33<para>
34Each volume is created by describing its shape and its physical
35characteristics, and then placing it inside a containing
36volume.
37</para>
38
39<para>
40When a volume is placed within another volume, we call the
41former volume the daughter volume and the latter the mother volume.
42The coordinate system used to specify where the daughter volume is
43placed, is the coordinate system of the mother volume.
44</para>
45
46<para>
47To describe a volume's shape, we use the concept of a solid. A
48solid is a geometrical object that has a shape and specific values
49for each of that shape's dimensions. A cube with a side of 10
50centimeters and a cylinder of radius 30 cm and length 75 cm are
51examples of solids.
52</para>
53
54<para>
55To describe a volume's full properties, we use a logical volume.
56It includes the geometrical properties of the solid, and adds
57physical characteristics: the material of the volume; whether it
58contains any sensitive detector elements; the magnetic field;
59etc.
60</para>
61
62<para>
63We have yet to describe how to position the volume. To do this
64you create a physical volume, which places a copy of the logical
65volume inside a larger, containing, volume.
66</para>
67
68</sect2>
69
70<!-- ******************* Section (Level#2) ****************** -->
71<sect2 id="sect.HowToDefDetectorGeom.CreateSimpleVol">
72<title>
73Create a Simple Volume
74</title>
75
76<para>
77What do you need to do to create a volume?
78<itemizedlist spacing="compact">
79  <listitem><para>
80  Create a solid.
81  </para></listitem>
82  <listitem><para>
83  Create a logical volume, using this solid, and adding other
84  attributes.
85  </para></listitem>
86</itemizedlist>
87</para>
88
89</sect2>
90
91<!-- ******************* Section (Level#2) ****************** -->
92<sect2 id="sect.HowToDefDetectorGeom.ChooseSolid">
93<title>Choose a Solid
94</title>
95
96<para>
97To create a simple box, you only need to define its name and its
98extent along each of the Cartesian axes. You can find an example
99how to do this in Novice Example N01.
100</para>
101
102<para>
103In the detector description in the source file
104<literal>ExN01DetectorConstruction.cc</literal>, you will find the following
105box definition:
106
107<example id="programlist_HowToDefDetectorGeom_1">
108<title>
109Creating a box.
110</title>
111<programlisting>
112  G4double expHall_x = 3.0*m;
113  G4double expHall_y = 1.0*m;
114  G4double expHall_z = 1.0*m;
115
116  G4Box* experimentalHall_box
117     = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
118</programlisting>
119</example>
120
121This creates a box named "expHall_box" with extent from -3.0
122meters to +3.0 meters along the X axis, from -1.0 to 1.0 meters in
123Y, and from -1.0 to 1.0 meters in Z.
124</para>
125
126<para>
127It is also very simple to create a cylinder. To do this, you can
128use the <emphasis>G4Tubs</emphasis> class.
129
130<example id="programlist_HowToDefDetectorGeom_2">
131<title>
132Creating a cylinder.
133</title>
134<programlisting>
135  G4double innerRadiusOfTheTube = 0.*cm;
136  G4double outerRadiusOfTheTube = 60.*cm;
137  G4double hightOfTheTube = 25.*cm;
138  G4double startAngleOfTheTube = 0.*deg;
139  G4double spanningAngleOfTheTube = 360.*deg;
140
141  G4Tubs* tracker_tube
142    = new G4Tubs("tracker_tube",
143                 innerRadiusOfTheTube,
144                 outerRadiusOfTheTube,
145                 hightOfTheTube,
146                 startAngleOfTheTube,
147                 spanningAngleOfTheTube);
148</programlisting>
149</example>
150
151This creates a full cylinder, named "tracker_tube", of radius 60
152centimeters and length 50 cm.
153</para>
154
155</sect2>
156
157<!-- ******************* Section (Level#2) ****************** -->
158<sect2 id="sect.HowToDefDetectorGeom.CreateLogicalVol">
159<title>
160Create a Logical Volume
161</title>
162
163<para>
164To create a logical volume, you must start with a solid and a
165material. So, using the box created above, you can create a simple
166logical volume filled with argon gas (see materials) by entering:
167
168<informalexample>
169<programlisting>
170 G4LogicalVolume* experimentalHall_log
171    = new G4LogicalVolume(experimentalHall_box,Ar,"expHall_log");
172</programlisting>
173</informalexample>
174
175This logical volume is named "expHall_log".
176</para>
177
178<para>
179Similarly we create a logical volume with the cylindrical solid
180filled with aluminium
181
182<informalexample>
183<programlisting>
184  G4LogicalVolume* tracker_log
185    = new G4LogicalVolume(tracker_tube,Al,"tracker_log");
186</programlisting>
187</informalexample>
188
189
190and named "tracker_log"
191</para>
192
193</sect2>
194
195<!-- ******************* Section (Level#2) ****************** -->
196<sect2 id="sect.HowToDefDetectorGeom.PlaceVolume">
197<title>
198Place a Volume
199</title>
200
201<para>
202How do you place a volume? You start with a logical volume, and
203then you decide the already existing volume inside of which to
204place it. Then you decide where to place its center within that
205volume, and how to rotate it. Once you have made these decisions,
206you can create a physical volume, which is the placed instance of
207the volume, and embodies all of these atributes.
208</para>
209
210</sect2>
211
212<!-- ******************* Section (Level#2) ****************** -->
213<sect2 id="sect.HowToDefDetectorGeom.CreatePhysicalVol">
214<title>Create a Physical Volume</title>
215
216<para>
217You create a physical volume starting with your logical volume.
218A physical volume is simply a placed instance of the logical
219volume. This instance must be placed inside a mother logical
220volume. For simplicity it is unrotated:
221</para>
222
223<example id="programlist_HowToDefDetectorGeom_3">
224<title>
225A simple physical volume.
226</title>
227<programlisting>
228  G4double trackerPos_x = -1.0*meter;
229  G4double trackerPos_y =  0.0*meter;
230  G4double trackerPos_z =  0.0*meter;
231
232  G4VPhysicalVolume* tracker_phys
233    = new G4PVPlacement(0,                       // no rotation
234                        G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),
235                                                 // translation position
236                        tracker_log,             // its logical volume
237                        "tracker",               // its name
238                        experimentalHall_log,    // its mother (logical) volume
239                        false,                   // no boolean operations
240                        0);                      // its copy number
241</programlisting>
242</example>
243
244<para>
245This places the logical volume <literal>tracker_log</literal> at the
246origin of the mother volume <literal>experimentalHall_log</literal>, shifted
247by one meter along X and unrotated. The resulting physical volume
248is named "tracker" and has a copy number of 0.
249</para>
250
251<para>
252An exception exists to the rule that a physical volume must be
253placed inside a mother volume. That exception is for the World
254volume, which is the largest volume created, and which contains all
255other volumes. This volume obviously cannot be contained in any
256other. Instead, it must be created as a <emphasis>G4PVPlacement</emphasis> 
257with a null mother pointer. It also must be unrotated, and it must be
258placed at the origin of the global coordinate system.
259</para>
260
261<para>
262Generally, it is best to choose a simple solid as the World
263volume, and in Example N01, we use the experimental hall:
264
265<example id="programlist_HowToDefDetectorGeom_4">
266<title>
267The World volume from Example N01.
268</title>
269<programlisting>
270  G4VPhysicalVolume* experimentalHall_phys
271      = new G4PVPlacement(0,                       // no rotation
272                          G4ThreeVector(0.,0.,0.), // translation position
273                          experimentalHall_log,    // its logical volume
274                          "expHall",               // its name
275                          0,                       // its mother volume
276                          false,                   // no boolean operations
277                          0);                      // its copy number
278</programlisting>
279</example>
280</para>
281
282</sect2>
283
284
285<!-- ******************* Section (Level#2) ****************** -->
286<sect2 id="sect.HowToDefDetectorGeom.CoordinateRotations">
287<title>
288Coordinate Systems and Rotations
289</title>
290
291<para>
292In Geant4, the rotation matrix associated to a placed physical
293volume represents the rotation of the reference system of this
294volume with respect to its mother.
295</para>
296
297<para>
298A rotation matrix is normally constructed as in CLHEP, by
299instantiating the identity matrix and then applying a rotation to
300it. This is also demonstrated in Example N04.
301</para>
302
303</sect2>
304</sect1>
Note: See TracBrowser for help on using the repository browser.