1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 4. Detector Definition and Response</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="index.html" title="Geant4 User's Guide for Application Developers"><link rel="prev" href="ch03s07.html" title="3.7. Event Biasing Techniques"><link rel="next" href="ch04s02.html" title="4.2. Material"><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">Chapter 4. |
---|
9 | Detector Definition and Response |
---|
10 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="chap.DetectorDefRespond"></a>Chapter 4. |
---|
11 | Detector Definition and Response |
---|
12 | </h2></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.Geom"></a>4.1. |
---|
13 | Geometry |
---|
14 | </h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Intro"></a>4.1.1. |
---|
15 | Introduction |
---|
16 | </h3></div></div></div><p> |
---|
17 | The detector definition requires the representation of its |
---|
18 | geometrical elements, their materials and electronics properties, |
---|
19 | together with visualization attributes and user defined properties. |
---|
20 | The geometrical representation of detector elements focuses on the |
---|
21 | definition of solid models and their spatial position, as well as |
---|
22 | their logical relations to one another, such as in the case of |
---|
23 | containment. |
---|
24 | </p><p> |
---|
25 | Geant4 uses the concept of "Logical Volume" to manage the |
---|
26 | representation of detector element properties. The concept of |
---|
27 | "Physical Volume" is used to manage the representation of the |
---|
28 | spatial positioning of detector elements and their logical |
---|
29 | relations. The concept of "Solid" is used to manage the |
---|
30 | representation of the detector element solid modeling. |
---|
31 | Volumes and solids must be dynamically allocated in the user |
---|
32 | program; objects allocated are automatically registered in |
---|
33 | dedicated stores which also take care to free the memory at |
---|
34 | the end of a job. |
---|
35 | </p><p> |
---|
36 | The Geant4 solid modeler is STEP compliant. STEP is the ISO |
---|
37 | standard defining the protocol for exchanging geometrical data |
---|
38 | between CAD systems. This is achieved by standardizing the |
---|
39 | representation of solid models via the EXPRESS object definition |
---|
40 | language, which is part of the STEP ISO standard. |
---|
41 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Solids"></a>4.1.2. |
---|
42 | Solids |
---|
43 | </h3></div></div></div><p> |
---|
44 | The STEP standard supports multiple solid representations. |
---|
45 | Constructive Solid Geometry (CSG) representations and Boundary |
---|
46 | Represented Solids (BREPs) are available. Different representations |
---|
47 | are suitable for different purposes, applications, required |
---|
48 | complexity, and levels of detail. CSG representations are easy to |
---|
49 | use and normally give superior performance, but they cannot |
---|
50 | reproduce complex solids such as those used in CAD systems. BREP |
---|
51 | representations can handle more extended topologies and reproduce |
---|
52 | the most complex solids. |
---|
53 | </p><p> |
---|
54 | All constructed solids can stream out their contents via |
---|
55 | appropriate methods and streaming operators. |
---|
56 | </p><p> |
---|
57 | For all solids it is possible to estimate the geometrical volume and the |
---|
58 | surface area by invoking the methods: |
---|
59 | |
---|
60 | </p><div class="informalexample"><pre class="programlisting"> |
---|
61 | G4double GetCubicVolume() |
---|
62 | G4double GetSurfaceArea() |
---|
63 | </pre></div><p> |
---|
64 | |
---|
65 | which return an estimate of the solid volume and total area in internal |
---|
66 | units respectively. For elementary solids the functions compute the exact |
---|
67 | geometrical quantities, while for composite or complex solids an estimate |
---|
68 | is made using Monte Carlo techniques. |
---|
69 | </p><p> |
---|
70 | For all solids it is also possible to generate pseudo-random |
---|
71 | points lying on their surfaces, by invoking the method |
---|
72 | |
---|
73 | </p><div class="informalexample"><pre class="programlisting"> |
---|
74 | G4ThreeVector GetPointOnSurface() const |
---|
75 | </pre></div><p> |
---|
76 | |
---|
77 | which returns the generated point in local coordinates relative to |
---|
78 | the solid. |
---|
79 | </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Solids.CSG"></a>4.1.2.1. |
---|
80 | Constructed Solid Geometry (CSG) Solids |
---|
81 | </h4></div></div></div><p> |
---|
82 | CSG solids are defined directly as three-dimensional primitives. |
---|
83 | They are described by a minimal set of parameters necessary to |
---|
84 | define the shape and size of the solid. CSG solids are Boxes, Tubes |
---|
85 | and their sections, Cones and their sections, Spheres, Wedges, and |
---|
86 | Toruses. |
---|
87 | </p><h5><a name="id383938"></a> |
---|
88 | Box: |
---|
89 | </h5><p> |
---|
90 | To create a <span class="bold"><strong>box</strong></span> one can use the constructor: |
---|
91 | |
---|
92 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
93 | <div class="informalexample"><pre class="programlisting"> |
---|
94 | G4Box(const G4String& pName, |
---|
95 | G4double pX, |
---|
96 | G4double pY, |
---|
97 | G4double pZ) |
---|
98 | </pre></div> |
---|
99 | </td><td align="center" valign="top"> |
---|
100 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aBox.jpg"></div> |
---|
101 | |
---|
102 | <a href="javascript:remote_win('pic1.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
103 | </a> |
---|
104 | |
---|
105 | <span class="underline">In the picture</span>: |
---|
106 | <code class="literal"> |
---|
107 | <p> |
---|
108 | pX = 30, pY = 40, pZ = 60 |
---|
109 | </p> |
---|
110 | </code> |
---|
111 | </td></tr></tbody></table></div><p> |
---|
112 | </p><p> |
---|
113 | by giving the box a name and its half-lengths along the X, Y and |
---|
114 | Z axis: |
---|
115 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col></colgroup><tbody><tr><td> |
---|
116 | <code class="literal">pX</code> |
---|
117 | </td><td> |
---|
118 | half length in X |
---|
119 | </td><td> |
---|
120 | <code class="literal">pY</code> |
---|
121 | </td><td> |
---|
122 | half length in Y |
---|
123 | </td><td> |
---|
124 | <code class="literal">pZ</code> |
---|
125 | </td><td> |
---|
126 | half length in Z |
---|
127 | </td></tr></tbody></table></div><p> |
---|
128 | </p><p> |
---|
129 | This will create a box that extends from <code class="literal">-pX</code> to |
---|
130 | <code class="literal">+pX</code> in X, from <code class="literal">-pY</code> to |
---|
131 | <code class="literal">+pY</code> in Y, and from |
---|
132 | <code class="literal">-pZ</code> to <code class="literal">+pZ</code> in Z. |
---|
133 | </p><p> |
---|
134 | For example to create a box that is 2 by 6 by 10 centimeters in |
---|
135 | full length, and called <code class="literal">BoxA</code> one should use the following |
---|
136 | code: |
---|
137 | </p><div class="informalexample"><pre class="programlisting"> |
---|
138 | G4Box* aBox = new G4Box("BoxA", 1.0*cm, 3.0*cm, 5.0*cm); |
---|
139 | </pre></div><p> |
---|
140 | </p><h5><a name="id384169"></a> |
---|
141 | Cylindrical Section or Tube: |
---|
142 | </h5><p> |
---|
143 | Similarly to create a <span class="bold"><strong>cylindrical section</strong></span> |
---|
144 | or <span class="bold"><strong>tube</strong></span>, one would use the constructor: |
---|
145 | |
---|
146 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
147 | <div class="informalexample"><pre class="programlisting"> |
---|
148 | G4Tubs(const G4String& pName, |
---|
149 | G4double pRMin, |
---|
150 | G4double pRMax, |
---|
151 | G4double pDz, |
---|
152 | G4double pSPhi, |
---|
153 | G4double pDPhi) |
---|
154 | </pre></div> |
---|
155 | </td><td align="center" valign="top"> |
---|
156 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTubs.jpg"></div> |
---|
157 | |
---|
158 | <a href="javascript:remote_win('pic2.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
159 | </a> |
---|
160 | |
---|
161 | <span class="underline">In the picture</span>: |
---|
162 | <code class="literal"> |
---|
163 | <p> |
---|
164 | pRMin = 10, pRMax = 15, pDz = 20 |
---|
165 | </p> |
---|
166 | </code> |
---|
167 | </td></tr></tbody></table></div><p> |
---|
168 | </p><p> |
---|
169 | giving its name <code class="literal">pName</code> and its parameters which are: |
---|
170 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col></colgroup><tbody><tr><td> |
---|
171 | <code class="literal">pRMin</code> |
---|
172 | </td><td> |
---|
173 | Inner radius |
---|
174 | </td><td> |
---|
175 | <code class="literal">pRMax</code> |
---|
176 | </td><td> |
---|
177 | Outer radius |
---|
178 | </td></tr><tr><td> |
---|
179 | <code class="literal">pDz</code> |
---|
180 | </td><td> |
---|
181 | half length in z |
---|
182 | </td><td> |
---|
183 | <code class="literal">pSPhi</code> |
---|
184 | </td><td> |
---|
185 | the starting phi angle in radians |
---|
186 | </td></tr><tr><td> |
---|
187 | <code class="literal">pDPhi</code> |
---|
188 | </td><td> |
---|
189 | the angle of the segment in radians |
---|
190 | </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div><p> |
---|
191 | </p><h5><a name="id384385"></a> |
---|
192 | Cone or Conical section: |
---|
193 | </h5><p> |
---|
194 | Similarly to create a <span class="bold"><strong>cone</strong></span>, or |
---|
195 | <span class="bold"><strong>conical section</strong></span>, one would use the constructor |
---|
196 | |
---|
197 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
198 | <div class="informalexample"><pre class="programlisting"> |
---|
199 | G4Cons(const G4String& pName, |
---|
200 | G4double pRmin1, |
---|
201 | G4double pRmax1, |
---|
202 | G4double pRmin2, |
---|
203 | G4double pRmax2, |
---|
204 | G4double pDz, |
---|
205 | G4double pSPhi, |
---|
206 | G4double pDPhi) |
---|
207 | </pre></div> |
---|
208 | </td><td align="center" valign="top"> |
---|
209 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aCons.jpg"></div> |
---|
210 | |
---|
211 | <a href="javascript:remote_win('pic3.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
212 | </a> |
---|
213 | |
---|
214 | <span class="underline">In the picture</span>: |
---|
215 | <code class="literal"> |
---|
216 | <p> |
---|
217 | pRmin1 = 5, pRmax1 = 10, |
---|
218 | pRmin2 = 20, pRmax2 = 25, |
---|
219 | pDz = 40, pSPhi = 0, pDPhi = 4/3*Pi |
---|
220 | </p> |
---|
221 | </code> |
---|
222 | </td></tr></tbody></table></div><p> |
---|
223 | </p><p> |
---|
224 | giving its name <code class="literal">pName</code>, and its parameters which are: |
---|
225 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col></colgroup><tbody><tr><td> |
---|
226 | <code class="literal">pRmin1</code> |
---|
227 | </td><td> |
---|
228 | inside radius at <code class="literal">-pDz</code> |
---|
229 | </td><td> |
---|
230 | <code class="literal">pRmax1</code> |
---|
231 | </td><td> |
---|
232 | outside radius at <code class="literal">-pDz</code> |
---|
233 | </td></tr><tr><td> |
---|
234 | <code class="literal">pRmin2</code> |
---|
235 | </td><td> |
---|
236 | inside radius at <code class="literal">+pDz</code> |
---|
237 | </td><td> |
---|
238 | <code class="literal">pRmax2</code> |
---|
239 | </td><td> |
---|
240 | outside radius at <code class="literal">+pDz</code> |
---|
241 | </td></tr><tr><td> |
---|
242 | <code class="literal">pDz</code> |
---|
243 | </td><td> |
---|
244 | half length in z |
---|
245 | </td><td> |
---|
246 | <code class="literal">pSPhi</code> |
---|
247 | </td><td> |
---|
248 | starting angle of the segment in radians |
---|
249 | </td></tr><tr><td> |
---|
250 | <code class="literal">pDPhi</code> |
---|
251 | </td><td> |
---|
252 | the angle of the segment in radians |
---|
253 | </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div><p> |
---|
254 | </p><h5><a name="id384653"></a> |
---|
255 | Parallelepiped: |
---|
256 | </h5><p> |
---|
257 | A <span class="bold"><strong>parallelepiped</strong></span> is constructed |
---|
258 | using: |
---|
259 | |
---|
260 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
261 | <div class="informalexample"><pre class="programlisting"> |
---|
262 | G4Para(const G4String& pName, |
---|
263 | G4double dx, |
---|
264 | G4double dy, |
---|
265 | G4double dz, |
---|
266 | G4double alpha, |
---|
267 | G4double theta, |
---|
268 | G4double phi) |
---|
269 | </pre></div> |
---|
270 | </td><td align="center" valign="top"> |
---|
271 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aPara.jpg"></div> |
---|
272 | |
---|
273 | <a href="javascript:remote_win('pic4.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
274 | </a> |
---|
275 | |
---|
276 | <span class="underline">In the picture</span>: |
---|
277 | <code class="literal"> |
---|
278 | <p> |
---|
279 | dx = 30, dy = 40, dz = 60 |
---|
280 | </p> |
---|
281 | </code> |
---|
282 | </td></tr></tbody></table></div><p> |
---|
283 | </p><p> |
---|
284 | giving its name <code class="literal">pName</code> and its parameters which are: |
---|
285 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
286 | <code class="literal">dx,dy,dz</code> |
---|
287 | </td><td> |
---|
288 | Half-length in x,y,z |
---|
289 | </td></tr><tr><td> |
---|
290 | <code class="literal">alpha</code> |
---|
291 | </td><td> |
---|
292 | Angle formed by the y axis and by the plane joining the centre |
---|
293 | of the faces <span class="emphasis"><em>parallel</em></span> to the z-x plane at -dy and +dy |
---|
294 | </td></tr><tr><td> |
---|
295 | <code class="literal">theta</code> |
---|
296 | </td><td> |
---|
297 | Polar angle of the line joining the centres of the faces at -dz |
---|
298 | and +dz in z |
---|
299 | </td></tr><tr><td> |
---|
300 | <code class="literal">phi</code> |
---|
301 | </td><td> |
---|
302 | Azimuthal angle of the line joining the centres of the faces at |
---|
303 | -dz and +dz in z |
---|
304 | </td></tr></tbody></table></div><p> |
---|
305 | </p><h5><a name="id384860"></a> |
---|
306 | Trapezoid: |
---|
307 | </h5><p> |
---|
308 | To construct a <span class="bold"><strong>trapezoid</strong></span> use: |
---|
309 | |
---|
310 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
311 | <div class="informalexample"><pre class="programlisting"> |
---|
312 | G4Trd(const G4String& pName, |
---|
313 | G4double dx1, |
---|
314 | G4double dx2, |
---|
315 | G4double dy1, |
---|
316 | G4double dy2, |
---|
317 | G4double dz) |
---|
318 | </pre></div> |
---|
319 | </td><td align="center" valign="top"> |
---|
320 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTrd.jpg"></div> |
---|
321 | |
---|
322 | <a href="javascript:remote_win('pic5.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
323 | </a> |
---|
324 | |
---|
325 | <span class="underline">In the picture</span>: |
---|
326 | <code class="literal"> |
---|
327 | <p> |
---|
328 | dx1 = 30, dx2 = 10, |
---|
329 | dy1 = 40, dy2 = 15, |
---|
330 | dz = 60 |
---|
331 | </p> |
---|
332 | </code> |
---|
333 | </td></tr></tbody></table></div><p> |
---|
334 | </p><p> |
---|
335 | to obtain a solid with name <code class="literal">pName</code> and parameters |
---|
336 | |
---|
337 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
338 | <code class="literal">dx1</code> |
---|
339 | </td><td> |
---|
340 | Half-length along x at the surface positioned at <code class="literal">-dz</code> |
---|
341 | </td></tr><tr><td> |
---|
342 | <code class="literal">dx2</code> |
---|
343 | </td><td> |
---|
344 | >Half-length along x at the surface positioned at <code class="literal">+dz</code> |
---|
345 | </td></tr><tr><td> |
---|
346 | <code class="literal">dy1</code> |
---|
347 | </td><td> |
---|
348 | Half-length along y at the surface positioned at <code class="literal">-dz</code> |
---|
349 | </td></tr><tr><td> |
---|
350 | <code class="literal">dy2</code> |
---|
351 | </td><td> |
---|
352 | >Half-length along y at the surface positioned at <code class="literal">+dz</code> |
---|
353 | </td></tr><tr><td> |
---|
354 | <code class="literal">dz</code> |
---|
355 | </td><td> |
---|
356 | Half-length along z axis |
---|
357 | </td></tr></tbody></table></div><p> |
---|
358 | </p><h5><a name="id385097"></a> |
---|
359 | Generic Trapezoid: |
---|
360 | </h5><p> |
---|
361 | To build a <span class="bold"><strong>generic trapezoid</strong></span>, |
---|
362 | the <code class="literal">G4Trap</code> class is provided. Here are the two costructors |
---|
363 | for a Right Angular Wedge and for the general trapezoid for it: |
---|
364 | |
---|
365 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
366 | <div class="informalexample"><pre class="programlisting"> |
---|
367 | G4Trap(const G4String& pName, |
---|
368 | G4double pZ, |
---|
369 | G4double pY, |
---|
370 | G4double pX, |
---|
371 | G4double pLTX) |
---|
372 | |
---|
373 | G4Trap(const G4String& pName, |
---|
374 | G4double pDz, G4double pTheta, |
---|
375 | G4double pPhi, G4double pDy1, |
---|
376 | G4double pDx1, G4double pDx2, |
---|
377 | G4double pAlp1, G4double pDy2, |
---|
378 | G4double pDx3, G4double pDx4, |
---|
379 | G4double pAlp2) |
---|
380 | </pre></div> |
---|
381 | </td><td align="center" valign="top"> |
---|
382 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTrap.jpg"></div> |
---|
383 | |
---|
384 | <a href="javascript:remote_win('pic6.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
385 | </a> |
---|
386 | |
---|
387 | <span class="underline">In the picture</span>: |
---|
388 | <code class="literal"> |
---|
389 | <p> |
---|
390 | pDx1 = 30, pDx2 = 40, pDy1 = 40, |
---|
391 | pDx3 = 10, pDx4 = 14, pDy2 = 16, |
---|
392 | pDz = 60, pTheta = 20*Degree, |
---|
393 | pPhi = 5*Degree, pAlp1 = pAlp2 = 10*Degree |
---|
394 | </p> |
---|
395 | </code> |
---|
396 | </td></tr></tbody></table></div><p> |
---|
397 | </p><p> |
---|
398 | to obtain a Right Angular Wedge with name <code class="literal">pName</code> and |
---|
399 | parameters: |
---|
400 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
401 | <code class="literal">pZ</code> |
---|
402 | </td><td> |
---|
403 | Length along z |
---|
404 | </td></tr><tr><td> |
---|
405 | <code class="literal">pY</code> |
---|
406 | </td><td> |
---|
407 | Length along y |
---|
408 | </td></tr><tr><td> |
---|
409 | <code class="literal">pX</code> |
---|
410 | </td><td> |
---|
411 | Length along x at the wider side |
---|
412 | </td></tr><tr><td> |
---|
413 | <code class="literal">pLTX</code> |
---|
414 | </td><td> |
---|
415 | Length along x at the narrower side (<code class="literal">plTX<=pX</code>) |
---|
416 | </td></tr></tbody></table></div><p> |
---|
417 | </p><p> |
---|
418 | or to obtain the general trapezoid (see the Software Reference |
---|
419 | Manual): |
---|
420 | </p><p> |
---|
421 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
422 | <code class="literal">pDx1</code> |
---|
423 | </td><td> |
---|
424 | Half x length of the side at y=-pDy1 of the face at -pDz |
---|
425 | </td></tr><tr><td> |
---|
426 | <code class="literal">pDx2</code> |
---|
427 | </td><td> |
---|
428 | Half x length of the side at y=+pDy1 of the face at -pDz |
---|
429 | </td></tr><tr><td> |
---|
430 | <code class="literal">pDz</code> |
---|
431 | </td><td> |
---|
432 | Half z length |
---|
433 | </td></tr><tr><td> |
---|
434 | <code class="literal">pTheta</code> |
---|
435 | </td><td> |
---|
436 | Polar angle of the line joining the centres of the faces at -/+pDz |
---|
437 | </td></tr><tr><td> |
---|
438 | <code class="literal">pPhi</code> |
---|
439 | </td><td> |
---|
440 | Azimuthal angle of the line joining the centre of the face at -pDz to the centre of the face at +pDz |
---|
441 | </td></tr><tr><td> |
---|
442 | <code class="literal">pDy1</code> |
---|
443 | </td><td> |
---|
444 | Half y length at -pDz |
---|
445 | </td></tr><tr><td> |
---|
446 | <code class="literal">pDy2</code> |
---|
447 | </td><td> |
---|
448 | Half y length at +pDz |
---|
449 | </td></tr><tr><td> |
---|
450 | <code class="literal">pDx3</code> |
---|
451 | </td><td> |
---|
452 | Half x length of the side at y=-pDy2 of the face at +pDz |
---|
453 | </td></tr><tr><td> |
---|
454 | <code class="literal">pDx4</code> |
---|
455 | </td><td> |
---|
456 | Half x length of the side at y=+pDy2 of the face at +pDz |
---|
457 | </td></tr><tr><td> |
---|
458 | <code class="literal">pAlp1</code> |
---|
459 | </td><td> |
---|
460 | Angle with respect to the y axis from the centre of the side |
---|
461 | (lower endcap) |
---|
462 | </td></tr><tr><td> |
---|
463 | <code class="literal">pAlp2</code> |
---|
464 | </td><td> |
---|
465 | Angle with respect to the y axis from the centre of the side |
---|
466 | (upper endcap) |
---|
467 | </td></tr></tbody></table></div><p> |
---|
468 | </p><p> |
---|
469 | <span class="bold"><strong>Note on <code class="literal">pAlph1/2</code></strong></span>: the |
---|
470 | two angles have to be the |
---|
471 | same due to the planarity condition. |
---|
472 | </p><h5><a name="id385530"></a> |
---|
473 | Sphere or Spherical Shell Section: |
---|
474 | </h5><p> |
---|
475 | To build a <span class="bold"><strong>sphere</strong></span>, or a |
---|
476 | <span class="bold"><strong>spherical shell section</strong></span>, use: |
---|
477 | |
---|
478 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
479 | <div class="informalexample"><pre class="programlisting"> |
---|
480 | G4Sphere(const G4String& pName, |
---|
481 | G4double pRmin, |
---|
482 | G4double pRmax, |
---|
483 | G4double pSPhi, |
---|
484 | G4double pDPhi, |
---|
485 | G4double pSTheta, |
---|
486 | G4double pDTheta ) |
---|
487 | </pre></div> |
---|
488 | </td><td align="center" valign="top"> |
---|
489 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aSphere.jpg"></div> |
---|
490 | |
---|
491 | <a href="javascript:remote_win('pic7.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
492 | </a> |
---|
493 | |
---|
494 | <span class="underline">In the picture</span>: |
---|
495 | <code class="literal"> |
---|
496 | <p> |
---|
497 | pRmin = 100, pRmax = 120, |
---|
498 | pSPhi = 0*Degree, pDPhi = 180*Degree, |
---|
499 | pSTheta = 0 Degree, pDTheta = 180*Degree |
---|
500 | </p> |
---|
501 | </code> |
---|
502 | </td></tr></tbody></table></div><p> |
---|
503 | </p><p> |
---|
504 | to obtain a solid with name <code class="literal">pName</code> and parameters: |
---|
505 | |
---|
506 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
507 | pRmin |
---|
508 | </td><td> |
---|
509 | Inner radius |
---|
510 | </td></tr><tr><td> |
---|
511 | pRmax |
---|
512 | </td><td> |
---|
513 | Outer radius |
---|
514 | </td></tr><tr><td> |
---|
515 | pSPhi |
---|
516 | </td><td> |
---|
517 | Starting Phi angle of the segment in radians |
---|
518 | </td></tr><tr><td> |
---|
519 | pDPhi |
---|
520 | </td><td> |
---|
521 | Delta Phi angle of the segment in radians |
---|
522 | </td></tr><tr><td> |
---|
523 | pSTheta |
---|
524 | </td><td> |
---|
525 | Starting Theta angle of the segment in radians |
---|
526 | </td></tr><tr><td> |
---|
527 | pDTheta |
---|
528 | </td><td> |
---|
529 | Delta Theta angle of the segment in radians |
---|
530 | </td></tr></tbody></table></div><p> |
---|
531 | </p><h5><a name="id385737"></a> |
---|
532 | Full Solid Sphere: |
---|
533 | </h5><p> |
---|
534 | To build a <span class="bold"><strong>full solid sphere</strong></span> |
---|
535 | use: |
---|
536 | |
---|
537 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
538 | <div class="informalexample"><pre class="programlisting"> |
---|
539 | G4Orb(const G4String& pName, |
---|
540 | G4double pRmax) |
---|
541 | </pre></div> |
---|
542 | </td><td align="center" valign="top"> |
---|
543 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aOrb.jpg"></div> |
---|
544 | |
---|
545 | <a href="javascript:remote_win('pic8.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
546 | </a> |
---|
547 | |
---|
548 | <span class="underline">In the picture</span>: |
---|
549 | <code class="literal"> |
---|
550 | <p> |
---|
551 | pRmax = 100 |
---|
552 | </p> |
---|
553 | </code> |
---|
554 | </td></tr></tbody></table></div><p> |
---|
555 | </p><p> |
---|
556 | The Orb can be obtained from a Sphere with: |
---|
557 | <code class="literal">pRmin</code> = 0, <code class="literal">pSPhi</code> = 0, |
---|
558 | <code class="literal">pDPhi</code> = 2*Pi, |
---|
559 | <code class="literal">pSTheta</code> = 0, <code class="literal">pDTheta</code> = Pi |
---|
560 | |
---|
561 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
562 | pRmax |
---|
563 | </td><td> |
---|
564 | Outer radius |
---|
565 | </td></tr></tbody></table></div><p> |
---|
566 | </p><h5><a name="id385906"></a> |
---|
567 | Torus: |
---|
568 | </h5><p> |
---|
569 | To build a <span class="bold"><strong>torus</strong></span> use: |
---|
570 | |
---|
571 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
572 | <div class="informalexample"><pre class="programlisting"> |
---|
573 | G4Torus(const G4String& pName, |
---|
574 | G4double pRmin, |
---|
575 | G4double pRmax, |
---|
576 | G4double pRtor, |
---|
577 | G4double pSPhi, |
---|
578 | G4double pDPhi) |
---|
579 | </pre></div> |
---|
580 | </td><td align="center" valign="top"> |
---|
581 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTorus.jpg"></div> |
---|
582 | |
---|
583 | <a href="javascript:remote_win('pic9.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
584 | </a> |
---|
585 | |
---|
586 | <span class="underline">In the picture</span>: |
---|
587 | <code class="literal"> |
---|
588 | <p> |
---|
589 | pRmin = 40, pRmax = 60, pRtor = 200, |
---|
590 | pSPhi = 0, pDPhi = 90*Degree |
---|
591 | </p> |
---|
592 | </code> |
---|
593 | </td></tr></tbody></table></div><p> |
---|
594 | </p><p> |
---|
595 | to obtain a solid with name <code class="literal">pName</code> and parameters: |
---|
596 | |
---|
597 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
598 | pRmin |
---|
599 | </td><td> |
---|
600 | Inside radius |
---|
601 | </td></tr><tr><td> |
---|
602 | pRmax |
---|
603 | </td><td> |
---|
604 | Outside radius |
---|
605 | </td></tr><tr><td> |
---|
606 | pRtor |
---|
607 | </td><td> |
---|
608 | Swept radius of torus |
---|
609 | </td></tr><tr><td> |
---|
610 | pSPhi |
---|
611 | </td><td> |
---|
612 | Starting Phi angle in radians (<code class="literal">fSPhi+fDPhi<=2PI</code>, |
---|
613 | <code class="literal">fSPhi>-2PI</code>) |
---|
614 | </td></tr><tr><td> |
---|
615 | pDPhi |
---|
616 | </td><td> |
---|
617 | Delta angle of the segment in radians |
---|
618 | </td></tr></tbody></table></div><p> |
---|
619 | </p><p> |
---|
620 | In addition, the Geant4 Design Documentation shows in the Solids |
---|
621 | Class Diagram the complete list of CSG classes, and the STEP |
---|
622 | documentation contains a detailed EXPRESS description of each CSG |
---|
623 | solid. |
---|
624 | </p><h4><a name="id386112"></a> |
---|
625 | Specific CSG Solids |
---|
626 | </h4><h5><a name="id386121"></a> |
---|
627 | Polycons: |
---|
628 | </h5><p> |
---|
629 | <span class="bold"><strong>Polycons</strong></span> (PCON) are implemented in Geant4 through the |
---|
630 | <code class="literal">G4Polycon</code> class: |
---|
631 | |
---|
632 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
633 | <div class="informalexample"><pre class="programlisting"> |
---|
634 | G4Polycone(const G4String& pName, |
---|
635 | G4double phiStart, |
---|
636 | G4double phiTotal, |
---|
637 | G4int numZPlanes, |
---|
638 | const G4double zPlane[], |
---|
639 | const G4double rInner[], |
---|
640 | const G4double rOuter[]) |
---|
641 | |
---|
642 | G4Polycone(const G4String& pName, |
---|
643 | G4double phiStart, |
---|
644 | G4double phiTotal, |
---|
645 | G4int numRZ, |
---|
646 | const G4double r[], |
---|
647 | const G4double z[]) |
---|
648 | </pre></div> |
---|
649 | </td><td align="center" valign="top"> |
---|
650 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aBREPSolidPCone.jpg"></div> |
---|
651 | |
---|
652 | <a href="javascript:remote_win('pic10.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
653 | </a> |
---|
654 | |
---|
655 | <span class="underline">In the picture</span>: |
---|
656 | <code class="literal"> |
---|
657 | <p> |
---|
658 | phiStart = 1/4*Pi, phiTotal = 3/2*Pi, numZPlanes = 9, |
---|
659 | rInner = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
---|
660 | rOuter = { 0, 10, 10, 5 , 5, 10 , 10 , 2, 2}, |
---|
661 | z = { 5, 7, 9, 11, 25, 27, 29, 31, 35 } |
---|
662 | </p> |
---|
663 | </code> |
---|
664 | </td></tr></tbody></table></div><p> |
---|
665 | </p><p> |
---|
666 | where: |
---|
667 | |
---|
668 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
669 | phiStart |
---|
670 | </td><td> |
---|
671 | Initial Phi starting angle |
---|
672 | </td></tr><tr><td> |
---|
673 | phiTotal |
---|
674 | </td><td> |
---|
675 | Total Phi angle |
---|
676 | </td></tr><tr><td> |
---|
677 | numZPlanes |
---|
678 | </td><td> |
---|
679 | Number of z planes |
---|
680 | </td></tr><tr><td> |
---|
681 | numRZ |
---|
682 | </td><td> |
---|
683 | Number of corners in r,z space |
---|
684 | </td></tr><tr><td> |
---|
685 | zPlane |
---|
686 | </td><td> |
---|
687 | Position of z planes |
---|
688 | </td></tr><tr><td> |
---|
689 | rInner |
---|
690 | </td><td> |
---|
691 | Tangent distance to inner surface |
---|
692 | </td></tr><tr><td> |
---|
693 | rOuter |
---|
694 | </td><td> |
---|
695 | Tangent distance to outer surface |
---|
696 | </td></tr><tr><td> |
---|
697 | r |
---|
698 | </td><td> |
---|
699 | r coordinate of corners |
---|
700 | </td></tr><tr><td> |
---|
701 | z |
---|
702 | </td><td> |
---|
703 | z coordinate of corners |
---|
704 | </td></tr></tbody></table></div><p> |
---|
705 | </p><h5><a name="id386355"></a> |
---|
706 | Polyhedra (PGON): |
---|
707 | </h5><p> |
---|
708 | <span class="bold"><strong>Polyhedra</strong></span> (PGON) are implemented through |
---|
709 | <code class="literal">G4Polyhedra</code>: |
---|
710 | |
---|
711 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
712 | <div class="informalexample"><pre class="programlisting"> |
---|
713 | G4Polyhedra(const G4String& pName, |
---|
714 | G4double phiStart, |
---|
715 | G4double phiTotal, |
---|
716 | G4int numSide, |
---|
717 | G4int numZPlanes, |
---|
718 | const G4double zPlane[], |
---|
719 | const G4double rInner[], |
---|
720 | const G4double rOuter[] ) |
---|
721 | |
---|
722 | G4Polyhedra(const G4String& pName, |
---|
723 | G4double phiStart, |
---|
724 | G4double phiTotal, |
---|
725 | G4int numSide, |
---|
726 | G4int numRZ, |
---|
727 | const G4double r[], |
---|
728 | const G4double z[] ) |
---|
729 | </pre></div> |
---|
730 | </td><td align="center" valign="top"> |
---|
731 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aBREPSolidPolyhedra.jpg"></div> |
---|
732 | |
---|
733 | <a href="javascript:remote_win('pic11.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
734 | </a> |
---|
735 | |
---|
736 | <span class="underline">In the picture</span>: |
---|
737 | <code class="literal"> |
---|
738 | <p> |
---|
739 | phiStart = -1/4*Pi, phiTotal= 5/4*Pi, |
---|
740 | numSide = 3, nunZPlanes = 7, |
---|
741 | rInner = { 0, 0, 0, 0, 0, 0, 0 }, |
---|
742 | rOuter = { 0, 15, 15, 4, 4, 10, 10 }, |
---|
743 | z = { 0, 5, 8, 13 , 30, 32, 35 } |
---|
744 | </p> |
---|
745 | </code> |
---|
746 | </td></tr></tbody></table></div><p> |
---|
747 | </p><p> |
---|
748 | where: |
---|
749 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
750 | <code class="literal">phiStart</code> |
---|
751 | </td><td> |
---|
752 | Initial Phi starting angle |
---|
753 | </td></tr><tr><td> |
---|
754 | <code class="literal">phiTotal</code> |
---|
755 | </td><td> |
---|
756 | Total Phi angle |
---|
757 | </td></tr><tr><td> |
---|
758 | <code class="literal">numSide</code> |
---|
759 | </td><td> |
---|
760 | Number of sides |
---|
761 | </td></tr><tr><td> |
---|
762 | <code class="literal">numZPlanes</code> |
---|
763 | </td><td> |
---|
764 | Number of z planes |
---|
765 | </td></tr><tr><td> |
---|
766 | <code class="literal">numRZ</code> |
---|
767 | </td><td> |
---|
768 | Number of corners in r,z space |
---|
769 | </td></tr><tr><td> |
---|
770 | zPlane |
---|
771 | </td><td> |
---|
772 | Position of z planes |
---|
773 | </td></tr><tr><td> |
---|
774 | <code class="literal">rInner</code> |
---|
775 | </td><td> |
---|
776 | Tangent distance to inner surface |
---|
777 | </td></tr><tr><td> |
---|
778 | rOuter |
---|
779 | </td><td> |
---|
780 | Tangent distance to outer surface |
---|
781 | </td></tr><tr><td> |
---|
782 | <code class="literal">r</code> |
---|
783 | </td><td> |
---|
784 | r coordinate of corners |
---|
785 | </td></tr><tr><td> |
---|
786 | <code class="literal">z</code> |
---|
787 | </td><td> |
---|
788 | z coordinate of corners |
---|
789 | </td></tr></tbody></table></div><p> |
---|
790 | </p><h5><a name="id386642"></a> |
---|
791 | Tube with an elliptical cross section: |
---|
792 | </h5><p> |
---|
793 | A <span class="bold"><strong>tube with an elliptical cross |
---|
794 | section</strong></span> (ELTU) can be defined as follows: |
---|
795 | |
---|
796 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
797 | <div class="informalexample"><pre class="programlisting"> |
---|
798 | G4EllipticalTube(const G4String& pName, |
---|
799 | G4double Dx, |
---|
800 | G4double Dy, |
---|
801 | G4double Dz) |
---|
802 | </pre></div> |
---|
803 | |
---|
804 | The equation of the surface in x/y is <code class="literal">1.0 = (x/dx)**2 +(y/dy)**2</code> |
---|
805 | </td><td align="center" valign="top"> |
---|
806 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aEllipticalTube.jpg"></div> |
---|
807 | |
---|
808 | <a href="javascript:remote_win('pic12.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
809 | </a> |
---|
810 | |
---|
811 | <span class="underline">In the picture</span>: |
---|
812 | <code class="literal"> |
---|
813 | <p> |
---|
814 | Dx = 5, Dy = 10, Dz = 20 |
---|
815 | </p> |
---|
816 | </code> |
---|
817 | </td></tr></tbody></table></div><p> |
---|
818 | </p><p> |
---|
819 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col></colgroup><tbody><tr><td> |
---|
820 | Dx |
---|
821 | </td><td> |
---|
822 | Half length X |
---|
823 | </td><td> |
---|
824 | Dy |
---|
825 | </td><td> |
---|
826 | Half length Y |
---|
827 | </td><td> |
---|
828 | Dz |
---|
829 | </td><td> |
---|
830 | Half length Z |
---|
831 | </td></tr></tbody></table></div><p> |
---|
832 | </p><h5><a name="id386804"></a> |
---|
833 | General Ellipsoid: |
---|
834 | </h5><p> |
---|
835 | The general <span class="bold"><strong>ellipsoid</strong></span> with |
---|
836 | possible cut in <code class="literal">Z</code> can be defined as follows: |
---|
837 | |
---|
838 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
839 | <div class="informalexample"><pre class="programlisting"> |
---|
840 | G4Ellipsoid(const G4String& pName, |
---|
841 | G4double pxSemiAxis, |
---|
842 | G4double pySemiAxis, |
---|
843 | G4double pzSemiAxis, |
---|
844 | G4double pzBottomCut=0, |
---|
845 | G4double pzTopCut=0) |
---|
846 | </pre></div> |
---|
847 | </td><td align="center" valign="top"> |
---|
848 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aEllipsoid.jpg"></div> |
---|
849 | |
---|
850 | <a href="javascript:remote_win('pic13.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
851 | </a> |
---|
852 | |
---|
853 | <span class="underline">In the picture</span>: |
---|
854 | <code class="literal"> |
---|
855 | <p> |
---|
856 | pxSemiAxis = 10, pySemiAxis = 20, pzSemiAxis = 50, |
---|
857 | pzBottomCut = -10, pzTopCut = 40 |
---|
858 | </p> |
---|
859 | </code> |
---|
860 | </td></tr></tbody></table></div><p> |
---|
861 | </p><p> |
---|
862 | A general (or triaxial) ellipsoid is a quadratic surface which is |
---|
863 | given in Cartesian coordinates by: |
---|
864 | |
---|
865 | </p><div class="informalexample"><pre class="programlisting"> |
---|
866 | 1.0 = (x/pxSemiAxis)**2 + (y/pySemiAxis)**2 + (z/pzSemiAxis)**2 |
---|
867 | </pre></div><p> |
---|
868 | |
---|
869 | where: |
---|
870 | |
---|
871 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
872 | <code class="literal">pxSemiAxis</code> |
---|
873 | </td><td> |
---|
874 | Semiaxis in X |
---|
875 | </td></tr><tr><td> |
---|
876 | pySemiAxis |
---|
877 | </td><td> |
---|
878 | Semiaxis in Y |
---|
879 | </td></tr><tr><td> |
---|
880 | pzSemiAxis |
---|
881 | </td><td> |
---|
882 | Semiaxis in Z |
---|
883 | </td></tr><tr><td> |
---|
884 | pzBottomCut |
---|
885 | </td><td> |
---|
886 | lower cut plane level, z |
---|
887 | </td></tr><tr><td> |
---|
888 | pzTopCut |
---|
889 | </td><td> |
---|
890 | upper cut plane level, z |
---|
891 | </td></tr></tbody></table></div><p> |
---|
892 | </p><h5><a name="id387009"></a> |
---|
893 | Cone with Elliptical Cross Section: |
---|
894 | </h5><p> |
---|
895 | A <span class="bold"><strong>cone with an elliptical cross section</strong></span> |
---|
896 | can be defined as follows: |
---|
897 | |
---|
898 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
899 | <div class="informalexample"><pre class="programlisting"> |
---|
900 | G4EllipticalCone(const G4String& pName, |
---|
901 | G4double pxSemiAxis, |
---|
902 | G4double pySemiAxis, |
---|
903 | G4double zMax, |
---|
904 | G4double pzTopCut) |
---|
905 | </pre></div> |
---|
906 | </td><td align="center" valign="top"> |
---|
907 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aEllipticalCone.jpg"></div> |
---|
908 | |
---|
909 | <a href="javascript:remote_win('pic14.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
910 | </a> |
---|
911 | |
---|
912 | <span class="underline">In the picture</span>: |
---|
913 | <code class="literal"> |
---|
914 | <p> |
---|
915 | pxSemiAxis = 30/75, pySemiAxis = 60/75, zMax = 50, pzTopCut = 25 |
---|
916 | </p> |
---|
917 | </code> |
---|
918 | </td></tr></tbody></table></div><p> |
---|
919 | </p><p> |
---|
920 | where: |
---|
921 | |
---|
922 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
923 | pxSemiAxis |
---|
924 | </td><td> |
---|
925 | Semiaxis in X |
---|
926 | </td></tr><tr><td> |
---|
927 | pySemiAxis |
---|
928 | </td><td> |
---|
929 | Semiaxis in Y |
---|
930 | </td></tr><tr><td> |
---|
931 | zMax |
---|
932 | </td><td> |
---|
933 | Height of elliptical cone |
---|
934 | </td></tr><tr><td> |
---|
935 | pzTopCut |
---|
936 | </td><td> |
---|
937 | upper cut plane level |
---|
938 | </td></tr></tbody></table></div><p> |
---|
939 | </p><p> |
---|
940 | An elliptical cone of height <code class="literal">zMax</code>, semiaxis |
---|
941 | <code class="literal">pxSemiAxis</code>, and semiaxis <code class="literal">pySemiAxis</code> |
---|
942 | is given by the parametric equations: |
---|
943 | |
---|
944 | </p><div class="informalexample"><pre class="programlisting"> |
---|
945 | x = pxSemiAxis * ( zMax - u ) / u * Cos(v) |
---|
946 | y = pySemiAxis * ( zMax - u ) / u * Sin(v) |
---|
947 | z = u |
---|
948 | </pre></div><p> |
---|
949 | |
---|
950 | Where <code class="literal">v</code> is between <code class="literal">0</code> and |
---|
951 | <code class="literal">2*Pi</code>, and |
---|
952 | <code class="literal">u</code> between <code class="literal">0</code> and |
---|
953 | <code class="literal">h</code> respectively. |
---|
954 | </p><h5><a name="id387250"></a> |
---|
955 | Paraboloid, a solid with parabolic profile: |
---|
956 | </h5><p> |
---|
957 | A <span class="bold"><strong>solid with parabolic profile</strong></span> and possible cuts along |
---|
958 | the <code class="literal">Z</code> axis can be defined as follows: |
---|
959 | |
---|
960 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
961 | <div class="informalexample"><pre class="programlisting"> |
---|
962 | G4Parabolid(const G4String& pName, |
---|
963 | G4double R1, |
---|
964 | G4double R2, |
---|
965 | G4double Dz) |
---|
966 | </pre></div> |
---|
967 | |
---|
968 | The equation for the solid is: |
---|
969 | <div class="informalexample"><pre class="programlisting"> |
---|
970 | rho**2 <= k1 * z + k2; |
---|
971 | -dz <= z <= dz |
---|
972 | r1**2 = k1 * (-dz) + k2 |
---|
973 | r2**2 = k1 * ( dz) + k2 |
---|
974 | </pre></div> |
---|
975 | |
---|
976 | </td><td align="center" valign="top"> |
---|
977 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aParaboloid.jpg"></div> |
---|
978 | |
---|
979 | <a href="javascript:remote_win('pic21.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
980 | </a> |
---|
981 | |
---|
982 | <span class="underline">In the picture</span>: |
---|
983 | <code class="literal"> |
---|
984 | <p> |
---|
985 | R1 = 20, R2 = 35, Dz = 20 |
---|
986 | </p> |
---|
987 | </code> |
---|
988 | </td></tr></tbody></table></div><p> |
---|
989 | </p><p> |
---|
990 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col></colgroup><tbody><tr><td> |
---|
991 | R1 |
---|
992 | </td><td> |
---|
993 | Radius at -Dz |
---|
994 | </td><td> |
---|
995 | R2 |
---|
996 | </td><td> |
---|
997 | Radius at +Dz greater than R1 |
---|
998 | </td><td> |
---|
999 | Dz |
---|
1000 | </td><td> |
---|
1001 | Half length Z |
---|
1002 | </td></tr></tbody></table></div><p> |
---|
1003 | </p><h5><a name="id387420"></a> |
---|
1004 | Tube with Hyperbolic Profile: |
---|
1005 | </h5><p> |
---|
1006 | A <span class="bold"><strong>tube with a hyperbolic |
---|
1007 | profile</strong></span> (HYPE) can be defined as follows: |
---|
1008 | |
---|
1009 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1010 | <div class="informalexample"><pre class="programlisting"> |
---|
1011 | G4Hype(const G4String& pName, |
---|
1012 | G4double innerRadius, |
---|
1013 | G4double outerRadius, |
---|
1014 | G4double innerStereo, |
---|
1015 | G4double outerStereo, |
---|
1016 | G4double halfLenZ) |
---|
1017 | </pre></div> |
---|
1018 | </td><td align="center" valign="top"> |
---|
1019 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aHyperboloid.jpg"></div> |
---|
1020 | |
---|
1021 | <a href="javascript:remote_win('pic15.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1022 | </a> |
---|
1023 | |
---|
1024 | <span class="underline">In the picture</span>: |
---|
1025 | <code class="literal"> |
---|
1026 | <p> |
---|
1027 | innerStereo = 0.7, outerStereo = 0.7, |
---|
1028 | halfLenZ = 50, |
---|
1029 | innerRadius = 20, outerRadius = 30 |
---|
1030 | </p> |
---|
1031 | </code> |
---|
1032 | </td></tr></tbody></table></div><p> |
---|
1033 | </p><p> |
---|
1034 | <code class="literal">G4Hype</code> is shaped with curved sides parallel to the |
---|
1035 | <code class="literal">z</code>-axis, has a specified half-length along the <code class="literal">z</code> |
---|
1036 | axis about which it is centred, and a given minimum and maximum |
---|
1037 | radius. |
---|
1038 | </p><p> |
---|
1039 | A minimum radius of <code class="literal">0</code> defines a filled Hype (with |
---|
1040 | hyperbolic inner surface), i.e. inner radius = 0 AND inner stereo |
---|
1041 | angle = 0. |
---|
1042 | </p><p> |
---|
1043 | The inner and outer hyperbolic surfaces can have different stereo |
---|
1044 | angles. A stereo angle of <code class="literal">0</code> gives a cylindrical |
---|
1045 | surface: |
---|
1046 | |
---|
1047 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1048 | <code class="literal">innerRadius</code> |
---|
1049 | </td><td> |
---|
1050 | Inner radius |
---|
1051 | </td></tr><tr><td> |
---|
1052 | <code class="literal">outerRadius</code> |
---|
1053 | </td><td> |
---|
1054 | Outer radius |
---|
1055 | </td></tr><tr><td> |
---|
1056 | <code class="literal">innerStereo</code> |
---|
1057 | </td><td> |
---|
1058 | Inner stereo angle in radians |
---|
1059 | </td></tr><tr><td> |
---|
1060 | <code class="literal">outerStereo</code> |
---|
1061 | </td><td> |
---|
1062 | Outer stereo angle in radians |
---|
1063 | </td></tr><tr><td> |
---|
1064 | <code class="literal">halfLenZ</code> |
---|
1065 | </td><td> |
---|
1066 | Half length in Z |
---|
1067 | </td></tr></tbody></table></div><p> |
---|
1068 | </p><h5><a name="id387670"></a> |
---|
1069 | Tetrahedra: |
---|
1070 | </h5><p> |
---|
1071 | A <span class="bold"><strong>tetrahedra</strong></span> solid can be |
---|
1072 | defined as follows: |
---|
1073 | |
---|
1074 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1075 | <div class="informalexample"><pre class="programlisting"> |
---|
1076 | G4Tet(const G4String& pName, |
---|
1077 | G4ThreeVector anchor, |
---|
1078 | G4ThreeVector p2, |
---|
1079 | G4ThreeVector p3, |
---|
1080 | G4ThreeVector p4, |
---|
1081 | G4bool *degeneracyFlag=0) |
---|
1082 | </pre></div> |
---|
1083 | </td><td align="center" valign="top"> |
---|
1084 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTet.jpg"></div> |
---|
1085 | |
---|
1086 | <a href="javascript:remote_win('pic16.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1087 | </a> |
---|
1088 | |
---|
1089 | <span class="underline">In the picture</span>: |
---|
1090 | <code class="literal"> |
---|
1091 | <p> |
---|
1092 | anchor = {0, 0, sqrt(3)}, |
---|
1093 | p2 = { 0, 2*sqrt(2/3), -1/sqrt(3) }, |
---|
1094 | p3 = { -sqrt(2), -sqrt(2/3),-1/sqrt(3) }, |
---|
1095 | p4 = { sqrt(2), -sqrt(2/3) , -1/sqrt(3) } |
---|
1096 | </p> |
---|
1097 | </code> |
---|
1098 | </td></tr></tbody></table></div><p> |
---|
1099 | </p><p> |
---|
1100 | The solid is defined by 4 points in space: |
---|
1101 | |
---|
1102 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1103 | <code class="literal">anchor</code> |
---|
1104 | </td><td> |
---|
1105 | Anchor point |
---|
1106 | </td></tr><tr><td> |
---|
1107 | <code class="literal">p2</code> |
---|
1108 | </td><td> |
---|
1109 | Point 2 |
---|
1110 | </td></tr><tr><td> |
---|
1111 | <code class="literal">p3</code> |
---|
1112 | </td><td> |
---|
1113 | Point 3 |
---|
1114 | </td></tr><tr><td> |
---|
1115 | <code class="literal">p4</code> |
---|
1116 | </td><td> |
---|
1117 | Point 4 |
---|
1118 | </td></tr><tr><td> |
---|
1119 | degeneracyFlag |
---|
1120 | </td><td> |
---|
1121 | Flag indicating degeneracy of points |
---|
1122 | </td></tr><tr><td> |
---|
1123 | |
---|
1124 | </td><td> |
---|
1125 | |
---|
1126 | </td></tr></tbody></table></div><p> |
---|
1127 | </p><h5><a name="id387885"></a> |
---|
1128 | Extruded Polygon: |
---|
1129 | </h5><p> |
---|
1130 | The extrusion of an arbitrary polygon |
---|
1131 | (<span class="bold"><strong>extruded solid</strong></span>) with fixed outline |
---|
1132 | in the defined <code class="literal">Z</code> sections can be defined as follows |
---|
1133 | (in a general way, or as special construct with two <code class="literal">Z</code> |
---|
1134 | sections): |
---|
1135 | |
---|
1136 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1137 | <div class="informalexample"><pre class="programlisting"> |
---|
1138 | G4ExtrudedSolid(const G4String& pName, |
---|
1139 | std::vector<G4TwoVector> polygon, |
---|
1140 | std::vector<ZSection> zsections) |
---|
1141 | |
---|
1142 | G4ExtrudedSolid(const G4String& pName, |
---|
1143 | std::vector<G4TwoVector> polygon, |
---|
1144 | G4double hz, |
---|
1145 | G4TwoVector off1, G4double scale1, |
---|
1146 | G4TwoVector off2, G4double scale2) |
---|
1147 | </pre></div> |
---|
1148 | </td><td align="center" valign="top"> |
---|
1149 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aExtrudedSolid.jpg"></div> |
---|
1150 | |
---|
1151 | <a href="javascript:remote_win('pic22.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1152 | </a> |
---|
1153 | |
---|
1154 | <span class="underline">In the picture</span>: |
---|
1155 | <code class="literal"> |
---|
1156 | <p> |
---|
1157 | poligon = {-30,-30},{-30,30},{30,30},{30,-30}, |
---|
1158 | {15,-30},{15,15},{-15,15},{-15,-30}</p> |
---|
1159 | <p> |
---|
1160 | zsections = [-60,{0,30},0.8], [-15, {0,-30},1.], |
---|
1161 | [10,{0,0},0.6], [60,{0,30},1.2]</p> |
---|
1162 | </code> |
---|
1163 | </td></tr></tbody></table></div><p> |
---|
1164 | </p><p> |
---|
1165 | The z-sides of the solid are the scaled versions of the same polygon. |
---|
1166 | |
---|
1167 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1168 | <code class="literal">polygon</code> |
---|
1169 | </td><td> |
---|
1170 | the vertices of the outlined polygon defined in clock-wise order |
---|
1171 | </td></tr><tr><td> |
---|
1172 | <code class="literal">zsections</code> |
---|
1173 | </td><td> |
---|
1174 | the z-sections defined by z position in increasing order |
---|
1175 | </td></tr><tr><td> |
---|
1176 | <code class="literal">hz</code> |
---|
1177 | </td><td> |
---|
1178 | Half length in Z |
---|
1179 | </td></tr><tr><td> |
---|
1180 | <code class="literal">off1, off2</code> |
---|
1181 | </td><td> |
---|
1182 | Offset of the side in -hz and +hz respectively |
---|
1183 | </td></tr><tr><td> |
---|
1184 | <code class="literal">scale1, scale2</code> |
---|
1185 | </td><td> |
---|
1186 | Scale of the side in -hz and +hz respectively |
---|
1187 | </td></tr></tbody></table></div><p> |
---|
1188 | </p><h5><a name="id388115"></a> |
---|
1189 | Box Twisted: |
---|
1190 | </h5><p> |
---|
1191 | A <span class="bold"><strong>box twisted</strong></span> along one axis |
---|
1192 | can be defined as follows: |
---|
1193 | |
---|
1194 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1195 | <div class="informalexample"><pre class="programlisting"> |
---|
1196 | G4TwistedBox(const G4String& pName, |
---|
1197 | G4double twistedangle, |
---|
1198 | G4double pDx, |
---|
1199 | G4double pDy, |
---|
1200 | G4double pDz) |
---|
1201 | </pre></div> |
---|
1202 | </td><td align="center" valign="top"> |
---|
1203 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTwistedBox.jpg"></div> |
---|
1204 | |
---|
1205 | <a href="javascript:remote_win('pic17.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1206 | </a> |
---|
1207 | |
---|
1208 | <span class="underline">In the picture</span>: |
---|
1209 | <code class="literal"> |
---|
1210 | <p> |
---|
1211 | twistedangle = 30*Degree, pDx = 30, pDy =40, pDz = 60 |
---|
1212 | </p> |
---|
1213 | </code> |
---|
1214 | </td></tr></tbody></table></div><p> |
---|
1215 | </p><p> |
---|
1216 | <code class="literal">G4TwistedBox</code> is a box twisted along the z-axis. The |
---|
1217 | twist angle cannot be greater than 90 degrees: |
---|
1218 | |
---|
1219 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1220 | <code class="literal">twistedangle</code> |
---|
1221 | </td><td> |
---|
1222 | Twist angle |
---|
1223 | </td></tr><tr><td> |
---|
1224 | <code class="literal">pDx</code> |
---|
1225 | </td><td> |
---|
1226 | Half x length |
---|
1227 | </td></tr><tr><td> |
---|
1228 | <code class="literal">pDy</code> |
---|
1229 | </td><td> |
---|
1230 | Half y length |
---|
1231 | </td></tr><tr><td> |
---|
1232 | <code class="literal">pDz</code> |
---|
1233 | </td><td> |
---|
1234 | Half z length |
---|
1235 | </td></tr></tbody></table></div><p> |
---|
1236 | </p><h5><a name="id388315"></a> |
---|
1237 | Trapezoid Twisted along One Axis: |
---|
1238 | </h5><p> |
---|
1239 | <span class="emphasis"><em>trapezoid twisted</em></span> along one axis can be defined as |
---|
1240 | follows: |
---|
1241 | |
---|
1242 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1243 | <div class="informalexample"><pre class="programlisting"> |
---|
1244 | G4TwistedTrap(const G4String& pName, |
---|
1245 | G4double twistedangle, |
---|
1246 | G4double pDxx1, |
---|
1247 | G4double pDxx2, |
---|
1248 | G4double pDy, |
---|
1249 | G4double pDz) |
---|
1250 | |
---|
1251 | G4TwistedTrap(const G4String& pName, |
---|
1252 | G4double twistedangle, |
---|
1253 | G4double pDz, |
---|
1254 | G4double pTheta, |
---|
1255 | G4double pPhi, |
---|
1256 | G4double pDy1, |
---|
1257 | G4double pDx1, |
---|
1258 | G4double pDx2, |
---|
1259 | G4double pDy2, |
---|
1260 | G4double pDx3, |
---|
1261 | G4double pDx4, |
---|
1262 | G4double pAlph) |
---|
1263 | </pre></div> |
---|
1264 | </td><td align="center" valign="top"> |
---|
1265 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTwistedTrap.jpg"></div> |
---|
1266 | |
---|
1267 | <a href="javascript:remote_win('pic18.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1268 | </a> |
---|
1269 | |
---|
1270 | <span class="underline">In the picture</span>: |
---|
1271 | <code class="literal"> |
---|
1272 | <p> |
---|
1273 | pDx1 = 30, pDx2 = 40, pDy1 = 40, |
---|
1274 | pDx3 = 10, pDx4 = 14, pDy2 = 16, |
---|
1275 | pDz = 60, |
---|
1276 | pTheta = 20*Degree, pDphi = 5*Degree, |
---|
1277 | pAlph = 10*Degree, twistedangle = 30*Degree |
---|
1278 | </p> |
---|
1279 | </code> |
---|
1280 | </td></tr></tbody></table></div><p> |
---|
1281 | </p><p> |
---|
1282 | The first constructor of <code class="literal">G4TwistedTrap</code> produces a |
---|
1283 | regular trapezoid twisted along the <code class="literal">z</code>-axis, where the caps |
---|
1284 | of the trapezoid are of the same shape and size. |
---|
1285 | </p><p> |
---|
1286 | The second constructor produces a generic trapezoid with polar, |
---|
1287 | azimuthal and tilt angles. |
---|
1288 | </p><p> |
---|
1289 | The twist angle cannot be greater than 90 degrees: |
---|
1290 | |
---|
1291 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1292 | <code class="literal">twistedangle</code> |
---|
1293 | </td><td> |
---|
1294 | Twisted angle |
---|
1295 | </td></tr><tr><td> |
---|
1296 | <code class="literal">pDx1</code> |
---|
1297 | </td><td> |
---|
1298 | Half x length at y=-pDy |
---|
1299 | </td></tr><tr><td> |
---|
1300 | <code class="literal">pDx2</code> |
---|
1301 | </td><td> |
---|
1302 | Half x length at y=+pDy |
---|
1303 | </td></tr><tr><td> |
---|
1304 | <code class="literal">pDy</code> |
---|
1305 | </td><td> |
---|
1306 | Half y length |
---|
1307 | </td></tr><tr><td> |
---|
1308 | <code class="literal">pDz</code> |
---|
1309 | </td><td> |
---|
1310 | Half z length |
---|
1311 | </td></tr><tr><td> |
---|
1312 | <code class="literal">pTheta</code> |
---|
1313 | </td><td> |
---|
1314 | Polar angle of the line joining the centres of the faces at -/+pDz |
---|
1315 | </td></tr><tr><td> |
---|
1316 | <code class="literal">pDy1</code> |
---|
1317 | </td><td> |
---|
1318 | Half y length at -pDz |
---|
1319 | </td></tr><tr><td> |
---|
1320 | <code class="literal">pDx1</code> |
---|
1321 | </td><td> |
---|
1322 | Half x length at -pDz, y=-pDy1 |
---|
1323 | </td></tr><tr><td> |
---|
1324 | <code class="literal">pDx2</code> |
---|
1325 | </td><td> |
---|
1326 | Half x length at -pDz, y=+pDy1 |
---|
1327 | </td></tr><tr><td> |
---|
1328 | <code class="literal">pDy2</code> |
---|
1329 | </td><td> |
---|
1330 | Half y length at +pDz |
---|
1331 | |
---|
1332 | </td></tr><tr><td> |
---|
1333 | <code class="literal">pDx3</code> |
---|
1334 | </td><td> |
---|
1335 | Half x length at +pDz, y=-pDy2 |
---|
1336 | </td></tr><tr><td> |
---|
1337 | <code class="literal">pDx4</code> |
---|
1338 | </td><td> |
---|
1339 | Half x length at +pDz, y=+pDy2 |
---|
1340 | </td></tr><tr><td> |
---|
1341 | <code class="literal">pAlph</code> |
---|
1342 | </td><td> |
---|
1343 | Angle with respect to the y axis from the centre of the side |
---|
1344 | </td></tr></tbody></table></div><p> |
---|
1345 | </p><h5><a name="id388684"></a> |
---|
1346 | Twisted Trapezoid with <code class="literal">x</code> and <code class="literal">y</code> dimensions |
---|
1347 | varying along <code class="literal">z</code>: |
---|
1348 | </h5><p> |
---|
1349 | A <span class="bold"><strong>twisted trapezoid</strong></span> with the |
---|
1350 | <code class="literal">x</code> and <code class="literal">y</code> dimensions |
---|
1351 | <span class="bold"><strong>varying along <code class="literal">z</code></strong></span> can be |
---|
1352 | defined as follows: |
---|
1353 | |
---|
1354 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1355 | <div class="informalexample"><pre class="programlisting"> |
---|
1356 | G4TwistedTrd(const G4String& pName, |
---|
1357 | G4double pDx1, |
---|
1358 | G4double pDx2, |
---|
1359 | G4double pDy1, |
---|
1360 | G4double pDy2, |
---|
1361 | G4double pDz, |
---|
1362 | G4double twistedangle) |
---|
1363 | </pre></div> |
---|
1364 | </td><td align="center" valign="top"> |
---|
1365 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTwistedTrd.jpg"></div> |
---|
1366 | |
---|
1367 | <a href="javascript:remote_win('pic19.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1368 | </a> |
---|
1369 | |
---|
1370 | <span class="underline">In the picture</span>: |
---|
1371 | <code class="literal"> |
---|
1372 | <p> |
---|
1373 | dx1 = 30, dx2 = 10, |
---|
1374 | dy1 = 40, dy2 = 15, |
---|
1375 | dz = 60, twistedangle = 30*Degree |
---|
1376 | </p> |
---|
1377 | </code> |
---|
1378 | </td></tr></tbody></table></div><p> |
---|
1379 | </p><p> |
---|
1380 | where: |
---|
1381 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1382 | <code class="literal">pDx1</code> |
---|
1383 | </td><td> |
---|
1384 | Half x length at the surface positioned at -dz |
---|
1385 | </td></tr><tr><td> |
---|
1386 | <code class="literal">pDx2</code> |
---|
1387 | </td><td> |
---|
1388 | Half x length at the surface positioned at +dz |
---|
1389 | </td></tr><tr><td> |
---|
1390 | <code class="literal">pDy1</code> |
---|
1391 | </td><td> |
---|
1392 | Half y length at the surface positioned at -dz |
---|
1393 | </td></tr><tr><td> |
---|
1394 | <code class="literal">pDy2</code> |
---|
1395 | </td><td> |
---|
1396 | Half y length at the surface positioned at +dz |
---|
1397 | </td></tr><tr><td> |
---|
1398 | <code class="literal">pDz</code> |
---|
1399 | </td><td> |
---|
1400 | Half z length |
---|
1401 | </td></tr><tr><td> |
---|
1402 | <code class="literal">twistedangle</code> |
---|
1403 | </td><td> |
---|
1404 | Twisted angle |
---|
1405 | </td></tr></tbody></table></div><p> |
---|
1406 | </p><h5><a name="id388951"></a> |
---|
1407 | Tube Section Twisted along Its Axis: |
---|
1408 | </h5><p> |
---|
1409 | A <span class="bold"><strong>tube section twisted</strong></span> along |
---|
1410 | its axis can be defined as follows: |
---|
1411 | |
---|
1412 | </p><div class="informaltable"><table border="0"><colgroup><col><col></colgroup><tbody><tr><td align="left" valign="top"> |
---|
1413 | <div class="informalexample"><pre class="programlisting"> |
---|
1414 | G4TwistedTubs(const G4String& pName, |
---|
1415 | G4double twistedangle, |
---|
1416 | G4double endinnerrad, |
---|
1417 | G4double endouterrad, |
---|
1418 | G4double halfzlen, |
---|
1419 | G4double dphi) |
---|
1420 | </pre></div> |
---|
1421 | </td><td align="center" valign="top"> |
---|
1422 | <div class="mediaobject"><img src="./AllResources/Detector/geometry.src/aTwistedTubs.jpg"></div> |
---|
1423 | |
---|
1424 | <a href="javascript:remote_win('pic20.html ')" onMouseOver="window.status='Get alive picture...'; return true">[Rotate the Picture]<br /> |
---|
1425 | </a> |
---|
1426 | |
---|
1427 | <span class="underline">In the picture</span>: |
---|
1428 | <code class="literal"> |
---|
1429 | <p> |
---|
1430 | endinnerrad = 10, endouterrad = 15, |
---|
1431 | halfzlen = 20, dphi = 90*Degree, |
---|
1432 | twistedangle = 60*Degree |
---|
1433 | </p> |
---|
1434 | </code> |
---|
1435 | </td></tr></tbody></table></div><p> |
---|
1436 | </p><p> |
---|
1437 | <code class="literal">G4TwistedTubs</code> is a sort of twisted cylinder which, |
---|
1438 | placed along the <code class="literal">z</code>-axis and divided into |
---|
1439 | <code class="literal">phi</code>-segments is shaped like an hyperboloid, where each of |
---|
1440 | its segmented pieces can be tilted with a stereo angle. |
---|
1441 | </p><p> |
---|
1442 | It can have inner and outer surfaces with the same stereo angle: |
---|
1443 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1444 | <code class="literal">twistedangle</code> |
---|
1445 | </td><td> |
---|
1446 | Twisted angle |
---|
1447 | </td></tr><tr><td> |
---|
1448 | <code class="literal">endinnerrad</code> |
---|
1449 | </td><td> |
---|
1450 | Inner radius at endcap |
---|
1451 | </td></tr><tr><td> |
---|
1452 | <code class="literal">endouterrad</code> |
---|
1453 | </td><td> |
---|
1454 | Outer radius at endcap |
---|
1455 | </td></tr><tr><td> |
---|
1456 | <code class="literal">halfzlen</code> |
---|
1457 | </td><td> |
---|
1458 | Half z length |
---|
1459 | </td></tr><tr><td> |
---|
1460 | <code class="literal">dphi</code> |
---|
1461 | </td><td> |
---|
1462 | Phi angle of a segment |
---|
1463 | </td></tr></tbody></table></div><p> |
---|
1464 | </p><p> |
---|
1465 | Additional constructors are provided, allowing the shape to be |
---|
1466 | specified either as: |
---|
1467 | |
---|
1468 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
1469 | the number of segments in <code class="literal">phi</code> and the total angle for |
---|
1470 | all segments, or |
---|
1471 | </p></li><li><p> |
---|
1472 | a combination of the above constructors providing instead the |
---|
1473 | inner and outer radii at <code class="literal">z=0</code> with different |
---|
1474 | <code class="literal">z</code>-lengths along negative and positive |
---|
1475 | <code class="literal">z</code>-axis. |
---|
1476 | </p></li></ul></div><p> |
---|
1477 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Solids.BoolOp"></a>4.1.2.2. |
---|
1478 | Solids made by Boolean operations |
---|
1479 | </h4></div></div></div><p> |
---|
1480 | Simple solids can be combined using Boolean operations. For |
---|
1481 | example, a cylinder and a half-sphere can be combined with the |
---|
1482 | union Boolean operation. |
---|
1483 | </p><p> |
---|
1484 | Creating such a new <span class="emphasis"><em>Boolean</em></span> solid, requires: |
---|
1485 | |
---|
1486 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
1487 | Two solids |
---|
1488 | </p></li><li><p> |
---|
1489 | A Boolean operation: union, intersection or subtraction. |
---|
1490 | </p></li><li><p> |
---|
1491 | Optionally a transformation for the second solid. |
---|
1492 | </p></li></ul></div><p> |
---|
1493 | </p><p> |
---|
1494 | The solids used should be either CSG solids (for examples a box, |
---|
1495 | a spherical shell, or a tube) or another Boolean solid: the product |
---|
1496 | of a previous Boolean operation. An important purpose of Boolean |
---|
1497 | solids is to allow the description of solids with peculiar shapes |
---|
1498 | in a simple and intuitive way, still allowing an efficient |
---|
1499 | geometrical navigation inside them. |
---|
1500 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"></h3><p> |
---|
1501 | The solids used can actually be of any type. However, in |
---|
1502 | order to fully support the export of a Geant4 solid model via STEP |
---|
1503 | to CAD systems, we restrict the use of Boolean operations to this |
---|
1504 | subset of solids. But this subset contains all the most interesting |
---|
1505 | use cases. |
---|
1506 | </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"></h3><p> |
---|
1507 | The tracking cost for navigating in a Boolean solid in the |
---|
1508 | current implementation, is proportional to the number of |
---|
1509 | constituent solids. So care must be taken to avoid extensive, |
---|
1510 | unecessary use of Boolean solids in performance-critical areas of a |
---|
1511 | geometry description, where each solid is created from Boolean |
---|
1512 | combinations of many other solids. |
---|
1513 | </p></div><p> |
---|
1514 | Examples of the creation of the simplest Boolean solids are |
---|
1515 | given below: |
---|
1516 | |
---|
1517 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1518 | G4Box* box = |
---|
1519 | new G4Box("Box",20*mm,30*mm,40*mm); |
---|
1520 | G4Tubs* cyl = |
---|
1521 | new G4Tubs("Cylinder",0,50*mm,50*mm,0,twopi); // r: 0 mm -> 50 mm |
---|
1522 | // z: -50 mm -> 50 mm |
---|
1523 | // phi: 0 -> 2 pi |
---|
1524 | G4UnionSolid* union = |
---|
1525 | new G4UnionSolid("Box+Cylinder", box, cyl); |
---|
1526 | G4IntersectionSolid* intersection = |
---|
1527 | new G4IntersectionSolid("Box*Cylinder", box, cyl); |
---|
1528 | G4SubtractionSolid* subtraction = |
---|
1529 | new G4SubtractionSolid("Box-Cylinder", box, cyl); |
---|
1530 | </pre></div><p> |
---|
1531 | |
---|
1532 | where the union, intersection and subtraction of a box and cylinder |
---|
1533 | are constructed. |
---|
1534 | </p><p> |
---|
1535 | The more useful case where one of the solids is displaced from |
---|
1536 | the origin of coordinates also exists. In this case the second |
---|
1537 | solid is positioned relative to the coordinate system (and thus |
---|
1538 | relative to the first). This can be done in two ways: |
---|
1539 | |
---|
1540 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
1541 | Either by giving a rotation matrix and translation vector that |
---|
1542 | are used to transform the coordinate system of the second solid to |
---|
1543 | the coordinate system of the first solid. This is called the |
---|
1544 | <span class="emphasis"><em>passive</em></span> method. |
---|
1545 | </p></li><li><p> |
---|
1546 | Or by creating a transformation that moves the second solid |
---|
1547 | from its desired position to its standard position, e.g., a box's |
---|
1548 | standard position is with its centre at the origin and sides |
---|
1549 | parallel to the three axes. This is called the |
---|
1550 | <span class="emphasis"><em>active</em></span> method. |
---|
1551 | </p></li></ul></div><p> |
---|
1552 | </p><p> |
---|
1553 | In the first case, the translation is applied first to move the |
---|
1554 | origin of coordinates. Then the rotation is used to rotate the |
---|
1555 | coordinate system of the second solid to the coordinate system of |
---|
1556 | the first. |
---|
1557 | |
---|
1558 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1559 | G4RotationMatrix* yRot = new G4RotationMatrix; // Rotates X and Z axes only |
---|
1560 | yRot->rotateY(M_PI/4.*rad); // Rotates 45 degrees |
---|
1561 | G4ThreeVector zTrans(0, 0, 50); |
---|
1562 | |
---|
1563 | G4UnionSolid* unionMoved = |
---|
1564 | new G4UnionSolid("Box+CylinderMoved", box, cyl, yRot, zTrans); |
---|
1565 | // |
---|
1566 | // The new coordinate system of the cylinder is translated so that |
---|
1567 | // its centre is at +50 on the original Z axis, and it is rotated |
---|
1568 | // with its X axis halfway between the original X and Z axes. |
---|
1569 | |
---|
1570 | // Now we build the same solid using the alternative method |
---|
1571 | // |
---|
1572 | G4RotationMatrix invRot = *(yRot->invert()); |
---|
1573 | G4Transform3D transform(invRot, zTrans); |
---|
1574 | G4UnionSolid* unionMoved = |
---|
1575 | new G4UnionSolid("Box+CylinderMoved", box, cyl, transform); |
---|
1576 | </pre></div><p> |
---|
1577 | </p><p> |
---|
1578 | Note that the first constructor that takes a pointer to the |
---|
1579 | rotation-matrix (<code class="literal">G4RotationMatrix*</code>), does NOT copy it. |
---|
1580 | Therefore once used a rotation-matrix to construct a Boolean solid, |
---|
1581 | it must NOT be modified. |
---|
1582 | </p><p> |
---|
1583 | In contrast, with the alternative method shown, a |
---|
1584 | <code class="literal">G4Transform3D</code> is provided to the constructor by value, and |
---|
1585 | its transformation is stored by the Boolean solid. The user may |
---|
1586 | modify the <code class="literal">G4Transform3D</code> and eventually use it again. |
---|
1587 | </p><p> |
---|
1588 | When positioning a volume associated to a Boolean solid, the |
---|
1589 | relative center of coordinates considered for the positioning is |
---|
1590 | the one related to the <span class="emphasis"><em>first</em></span> of the two constituent |
---|
1591 | solids. |
---|
1592 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Solids.BREPS"></a>4.1.2.3. |
---|
1593 | Boundary Represented (BREPS) Solids |
---|
1594 | </h4></div></div></div><p> |
---|
1595 | BREP solids are defined via the description of their boundaries. |
---|
1596 | The boundaries can be made of planar and second order surfaces. |
---|
1597 | Eventually these can be trimmed and have holes. The resulting |
---|
1598 | solids, such as polygonal, polyconical solids are known as |
---|
1599 | Elementary BREPS. |
---|
1600 | </p><p> |
---|
1601 | In addition, the boundary surfaces can be made of Bezier |
---|
1602 | surfaces and B-Splines, or of NURBS |
---|
1603 | (Non-Uniform-Rational-B-Splines) surfaces. The resulting solids are |
---|
1604 | Advanced BREPS. |
---|
1605 | </p><p> |
---|
1606 | |
---|
1607 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"></h3><p> |
---|
1608 | Currently, the implementation for surfaces |
---|
1609 | generated by Beziers, B-Splines or NURBS is only at the level of |
---|
1610 | prototype and not fully functional. |
---|
1611 | </p><p> |
---|
1612 | Extensions in this area are foreseen in future. |
---|
1613 | </p></div><p> |
---|
1614 | |
---|
1615 | </p><p> |
---|
1616 | We have defined a few simple Elementary BREPS, that can be |
---|
1617 | instantiated simply by a user in a manner similar to the |
---|
1618 | construction of Constructed Solids (CSGs). We summarize their |
---|
1619 | capabilities in the following section. |
---|
1620 | </p><p> |
---|
1621 | |
---|
1622 | </p><p> |
---|
1623 | Most BREPS Solids are however defined by creating each surface |
---|
1624 | separately and tying them together. |
---|
1625 | </p><p> |
---|
1626 | |
---|
1627 | |
---|
1628 | </p><h5><a name="id389460"></a> |
---|
1629 | Specific BREP Solids: |
---|
1630 | </h5><p> |
---|
1631 | |
---|
1632 | </p><p> |
---|
1633 | We have defined one polygonal and one polyconical shape using |
---|
1634 | BREPS. The polycone provides a shape defined by a series of conical |
---|
1635 | sections with the same axis, contiguous along it. |
---|
1636 | </p><p> |
---|
1637 | |
---|
1638 | </p><p> |
---|
1639 | The polyconical solid <code class="literal">G4BREPSolidPCone</code> is a shape |
---|
1640 | defined by a set of inner and outer conical or cylindrical surface |
---|
1641 | sections and two planes perpendicular to the Z axis. Each conical |
---|
1642 | surface is defined by its radius at two different planes |
---|
1643 | perpendicular to the Z-axis. Inner and outer conical surfaces are |
---|
1644 | defined using common Z planes. |
---|
1645 | </p><p> |
---|
1646 | |
---|
1647 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1648 | G4BREPSolidPCone( const G4String& pName, |
---|
1649 | G4double start_angle, |
---|
1650 | G4double opening_angle, |
---|
1651 | G4int num_z_planes, // sections, |
---|
1652 | G4double z_start, |
---|
1653 | const G4double z_values[], |
---|
1654 | const G4double RMIN[], |
---|
1655 | const G4double RMAX[] ) |
---|
1656 | </pre></div><p> |
---|
1657 | |
---|
1658 | </p><p> |
---|
1659 | The conical sections do not need to fill 360 degrees, but can have |
---|
1660 | a common start and opening angle. |
---|
1661 | </p><p> |
---|
1662 | |
---|
1663 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1664 | <code class="literal">start_angle</code> |
---|
1665 | </td><td> |
---|
1666 | starting angle |
---|
1667 | </td></tr><tr><td> |
---|
1668 | <code class="literal">opening_angle</code> |
---|
1669 | </td><td> |
---|
1670 | opening angle |
---|
1671 | </td></tr><tr><td> |
---|
1672 | <code class="literal">num_z_planes</code> |
---|
1673 | </td><td> |
---|
1674 | number of planes perpendicular to the z-axis used. |
---|
1675 | </td></tr><tr><td> |
---|
1676 | <code class="literal">z_start</code> |
---|
1677 | </td><td> |
---|
1678 | starting value of z |
---|
1679 | </td></tr><tr><td> |
---|
1680 | <code class="literal">z_values</code> |
---|
1681 | </td><td> |
---|
1682 | z coordinates of each plane |
---|
1683 | </td></tr><tr><td> |
---|
1684 | <code class="literal">RMIN</code> |
---|
1685 | </td><td> |
---|
1686 | radius of inner cone at each plane |
---|
1687 | </td></tr><tr><td> |
---|
1688 | <code class="literal">RMAX</code> |
---|
1689 | </td><td> |
---|
1690 | radius of outer cone at each plane |
---|
1691 | </td></tr></tbody></table></div><p> |
---|
1692 | </p><p> |
---|
1693 | The polygonal solid <code class="literal">G4BREPSolidPolyhedra</code> is a shape |
---|
1694 | defined by an inner and outer polygonal surface and two planes |
---|
1695 | perpendicular to the Z axis. Each polygonal surface is created by |
---|
1696 | linking a series of polygons created at different planes |
---|
1697 | perpendicular to the Z-axis. All these polygons all have the same |
---|
1698 | number of sides (<code class="literal">sides</code>) and are defined at the same Z |
---|
1699 | planes for both inner and outer polygonal surfaces. |
---|
1700 | </p><p> |
---|
1701 | The polygons do not need to fill 360 degrees, but have a start |
---|
1702 | and opening angle. |
---|
1703 | </p><p> |
---|
1704 | The constructor takes the following parameters: |
---|
1705 | |
---|
1706 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1707 | G4BREPSolidPolyhedra( const G4String& pName, |
---|
1708 | G4double start_angle, |
---|
1709 | G4double opening_angle, |
---|
1710 | G4int sides, |
---|
1711 | G4int num_z_planes, |
---|
1712 | G4double z_start, |
---|
1713 | const G4double z_values[], |
---|
1714 | const G4double RMIN[], |
---|
1715 | const G4double RMAX[] ) |
---|
1716 | </pre></div><p> |
---|
1717 | |
---|
1718 | which in addition to its name have the following meaning: |
---|
1719 | |
---|
1720 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1721 | <code class="literal">start_angle</code> |
---|
1722 | </td><td> |
---|
1723 | starting angle |
---|
1724 | </td></tr><tr><td> |
---|
1725 | <code class="literal">opening_angle</code> |
---|
1726 | </td><td> |
---|
1727 | opening angle |
---|
1728 | </td></tr><tr><td> |
---|
1729 | <code class="literal">sides</code> |
---|
1730 | </td><td> |
---|
1731 | number of sides of each polygon in the x-y plane |
---|
1732 | </td></tr><tr><td> |
---|
1733 | <code class="literal">num_z_planes</code> |
---|
1734 | </td><td> |
---|
1735 | number of planes perpendicular to the z-axis used. |
---|
1736 | </td></tr><tr><td> |
---|
1737 | <code class="literal">z_start</code> |
---|
1738 | </td><td> |
---|
1739 | starting value of z |
---|
1740 | </td></tr><tr><td> |
---|
1741 | <code class="literal">z_values</code> |
---|
1742 | </td><td> |
---|
1743 | z coordinates of each plane |
---|
1744 | </td></tr><tr><td> |
---|
1745 | <code class="literal">RMIN</code> |
---|
1746 | </td><td> |
---|
1747 | radius of inner polygon at each corner |
---|
1748 | </td></tr><tr><td> |
---|
1749 | <code class="literal">RMAX</code> |
---|
1750 | </td><td> |
---|
1751 | radius of outer polygon at each corner |
---|
1752 | </td></tr></tbody></table></div><p> |
---|
1753 | |
---|
1754 | the shape is defined by the number of sides <code class="literal">sides</code> of |
---|
1755 | the polygon in the plane perpendicular to the z-axis. |
---|
1756 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Solids.Tessel"></a>4.1.2.4. |
---|
1757 | Tessellated Solids |
---|
1758 | </h4></div></div></div><p> |
---|
1759 | In Geant4 it is also implemented a class |
---|
1760 | <code class="literal">G4TessellatedSolid</code> which can be used to generate a generic |
---|
1761 | solid defined by a number of facets (<code class="literal">G4VFacet</code>). Such |
---|
1762 | constructs are especially important for conversion of complex |
---|
1763 | geometrical shapes imported from CAD systems bounded with generic |
---|
1764 | surfaces into an approximate description with facets of defined |
---|
1765 | dimension (see <a href="ch04.html#fig.Geom.Solid_1" title="Figure 4.1. |
---|
1766 | Example of geometries imported from CAD system and converted to |
---|
1767 | tessellated solids. |
---|
1768 | ">Figure 4.1</a>). |
---|
1769 | |
---|
1770 | </p><div class="figure"><a name="fig.Geom.Solid_1"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="./AllResources/Detector/geometry.src/cad-tess-combined.jpg" align="middle" alt="Example of geometries imported from CAD system and converted to tessellated solids."></div></div><p class="title"><b>Figure 4.1. |
---|
1771 | Example of geometries imported from CAD system and converted to |
---|
1772 | tessellated solids. |
---|
1773 | </b></p></div><p><br class="figure-break"> |
---|
1774 | </p><p> |
---|
1775 | They can also be used to generate a solid bounded with a generic |
---|
1776 | surface made of planar facets. It is important that the supplied |
---|
1777 | facets shall form a fully enclose space to represent the solid. |
---|
1778 | </p><p> |
---|
1779 | Two types of facet can be used for the construction of a |
---|
1780 | <code class="literal">G4TessellatedSolid</code>: a triangular facet |
---|
1781 | (<code class="literal">G4TriangularFacet</code>) and a quadrangular facet |
---|
1782 | (<code class="literal">G4QuadrangularFacet</code>). |
---|
1783 | </p><p> |
---|
1784 | An example on how to generate a simple tessellated shape is |
---|
1785 | given below. |
---|
1786 | |
---|
1787 | </p><div class="example"><a name="programlist_Geom_1"></a><p class="title"><b>Example 4.1. |
---|
1788 | An example of a simple tessellated solid with |
---|
1789 | <code class="literal">G4TessellatedSolid</code>. |
---|
1790 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
1791 | // First declare a tessellated solid |
---|
1792 | // |
---|
1793 | G4TessellatedSolid solidTarget = new G4TessellatedSolid("Solid_name"); |
---|
1794 | |
---|
1795 | // Define the facets which form the solid |
---|
1796 | // |
---|
1797 | G4double targetSize = 10*cm ; |
---|
1798 | G4TriangularFacet *facet1 = new |
---|
1799 | G4TriangularFacet (G4ThreeVector(-targetSize,-targetSize, 0.0), |
---|
1800 | G4ThreeVector(+targetSize,-targetSize, 0.0), |
---|
1801 | G4ThreeVector( 0.0, 0.0,+targetSize), |
---|
1802 | ABSOLUTE); |
---|
1803 | G4TriangularFacet *facet2 = new |
---|
1804 | G4TriangularFacet (G4ThreeVector(+targetSize,-targetSize, 0.0), |
---|
1805 | G4ThreeVector(+targetSize,+targetSize, 0.0), |
---|
1806 | G4ThreeVector( 0.0, 0.0,+targetSize), |
---|
1807 | ABSOLUTE); |
---|
1808 | G4TriangularFacet *facet3 = new |
---|
1809 | G4TriangularFacet (G4ThreeVector(+targetSize,+targetSize, 0.0), |
---|
1810 | G4ThreeVector(-targetSize,+targetSize, 0.0), |
---|
1811 | G4ThreeVector( 0.0, 0.0,+targetSize), |
---|
1812 | ABSOLUTE); |
---|
1813 | G4TriangularFacet *facet4 = new |
---|
1814 | G4TriangularFacet (G4ThreeVector(-targetSize,+targetSize, 0.0), |
---|
1815 | G4ThreeVector(-targetSize,-targetSize, 0.0), |
---|
1816 | G4ThreeVector( 0.0, 0.0,+targetSize), |
---|
1817 | ABSOLUTE); |
---|
1818 | G4QuadrangularFacet *facet5 = new |
---|
1819 | G4QuadrangularFacet (G4ThreeVector(-targetSize,-targetSize, 0.0), |
---|
1820 | G4ThreeVector(-targetSize,+targetSize, 0.0), |
---|
1821 | G4ThreeVector(+targetSize,+targetSize, 0.0), |
---|
1822 | G4ThreeVector(+targetSize,-targetSize, 0.0), |
---|
1823 | ABSOLUTE); |
---|
1824 | |
---|
1825 | // Now add the facets to the solid |
---|
1826 | // |
---|
1827 | solidTarget->AddFacet((G4VFacet*) facet1); |
---|
1828 | solidTarget->AddFacet((G4VFacet*) facet2); |
---|
1829 | solidTarget->AddFacet((G4VFacet*) facet3); |
---|
1830 | solidTarget->AddFacet((G4VFacet*) facet4); |
---|
1831 | solidTarget->AddFacet((G4VFacet*) facet5); |
---|
1832 | |
---|
1833 | Finally declare the solid is complete |
---|
1834 | // |
---|
1835 | solidTarget->SetSolidClosed(true); |
---|
1836 | </pre></div></div><p><br class="example-break"> |
---|
1837 | </p><p> |
---|
1838 | The <code class="literal">G4TriangularFacet</code> class is used for the contruction |
---|
1839 | of <code class="literal">G4TessellatedSolid</code>. It is defined by three vertices, |
---|
1840 | which shall be supplied in <span class="emphasis"><em>anti-clockwise order</em></span> looking from |
---|
1841 | the outside of the solid where it belongs. Its constructor looks |
---|
1842 | like: |
---|
1843 | |
---|
1844 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1845 | G4TriangularFacet ( const G4ThreeVector Pt0, |
---|
1846 | const G4ThreeVector vt1, |
---|
1847 | const G4ThreeVector vt2, |
---|
1848 | G4FacetVertexType fType ) |
---|
1849 | </pre></div><p> |
---|
1850 | |
---|
1851 | i.e., it takes 4 parameters to define the three vertices: |
---|
1852 | |
---|
1853 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1854 | <code class="literal">G4FacetVertexType</code> |
---|
1855 | </td><td> |
---|
1856 | <code class="literal">ABSOLUTE</code> in which case <code class="literal">Pt0</code>, |
---|
1857 | <code class="literal">vt1</code> and <code class="literal">vt2</code> |
---|
1858 | are the three vertices in anti-clockwise order looking from the outside. |
---|
1859 | </td></tr><tr><td> |
---|
1860 | <code class="literal">G4FacetVertexType</code> |
---|
1861 | </td><td> |
---|
1862 | <code class="literal">RELATIVE</code> in which case the first vertex is |
---|
1863 | <code class="literal">Pt0</code>, the second vertex is <code class="literal">Pt0+vt1</code> and |
---|
1864 | the third vertex is <code class="literal">Pt0+vt2</code>, all in anti-clockwise order |
---|
1865 | when looking from the outside. |
---|
1866 | </td></tr></tbody></table></div><p> |
---|
1867 | </p><p> |
---|
1868 | The <code class="literal">G4QuadrangularFacet</code> class can be used for the |
---|
1869 | contruction of <code class="literal">G4TessellatedSolid</code> as well. It is defined |
---|
1870 | by four vertices, which shall be in the same plane and be supplied |
---|
1871 | in <span class="emphasis"><em>anti-clockwise order</em></span> looking from the outside of the |
---|
1872 | solid where it belongs. Its constructor looks like: |
---|
1873 | |
---|
1874 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1875 | G4QuadrangularFacet ( const G4ThreeVector Pt0, |
---|
1876 | const G4ThreeVector vt1, |
---|
1877 | const G4ThreeVector vt2, |
---|
1878 | const G4ThreeVector vt3, |
---|
1879 | G4FacetVertexType fType ) |
---|
1880 | </pre></div><p> |
---|
1881 | |
---|
1882 | i.e., it takes 5 parameters to define the four vertices: |
---|
1883 | |
---|
1884 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
1885 | <code class="literal">G4FacetVertexType</code> |
---|
1886 | </td><td> |
---|
1887 | <code class="literal">ABSOLUTE</code> in which case <code class="literal">Pt0</code>, |
---|
1888 | <code class="literal">vt1</code>, <code class="literal">vt2</code> and <code class="literal">vt3</code> |
---|
1889 | are the four vertices required in anti-clockwise order when looking |
---|
1890 | from the outside. |
---|
1891 | </td></tr><tr><td> |
---|
1892 | <code class="literal">G4FacetVertexType</code> |
---|
1893 | </td><td> |
---|
1894 | <code class="literal">RELATIVE</code> in which case the first vertex is |
---|
1895 | <code class="literal">Pt0</code>, the second vertex is <code class="literal">Pt0+vt</code>, |
---|
1896 | the third vertex is <code class="literal">Pt0+vt2</code> and the fourth vertex is |
---|
1897 | <code class="literal">Pt0+vt3</code>, in anti-clockwise order when looking from the |
---|
1898 | outside. |
---|
1899 | </td></tr></tbody></table></div><p> |
---|
1900 | </p><h5><a name="id390254"></a> |
---|
1901 | Importing CAD models as tessellated shapes |
---|
1902 | </h5><p> |
---|
1903 | Tessellated solids can also be used to import geometrical models from CAD |
---|
1904 | systems (see <a href="ch04.html#fig.Geom.Solid_1" title="Figure 4.1. |
---|
1905 | Example of geometries imported from CAD system and converted to |
---|
1906 | tessellated solids. |
---|
1907 | ">Figure 4.1</a>). In order to do this, it |
---|
1908 | is required to convert first the CAD shapes into tessellated surfaces. A |
---|
1909 | way to do this is to save the shapes in the geometrical model as STEP files |
---|
1910 | and convert them using a tool like |
---|
1911 | <a href="http://www.steptools.com/products/stviewer/" target="_top">STViewer</a> or |
---|
1912 | <a href="http://www.trad.fr/en/" target="_top">FASTRAD</a> to |
---|
1913 | tessellated (faceted surfaces) solids. This strategy allows to import any shape |
---|
1914 | with some degree of approximation; the converted CAD models can then be |
---|
1915 | imported through <a href="http://cern.ch/gdml/" target="_top">GDML (Geometry Description |
---|
1916 | Markup Language)</a> into Geant4 and be represented as |
---|
1917 | <code class="literal">G4TessellatedSolid</code> shapes. |
---|
1918 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.LogVol"></a>4.1.3. |
---|
1919 | Logical Volumes |
---|
1920 | </h3></div></div></div><p> |
---|
1921 | The Logical Volume manages the information associated with |
---|
1922 | detector elements represented by a given Solid and Material, |
---|
1923 | independently from its physical position in the detector. |
---|
1924 | </p><p> |
---|
1925 | A Logical Volume knows which physical volumes are contained |
---|
1926 | within it. It is uniquely defined to be their mother volume. A |
---|
1927 | Logical Volume thus represents a hierarchy of unpositioned volumes |
---|
1928 | whose positions relative to one another are well defined. By |
---|
1929 | creating Physical Volumes, which are placed instances of a Logical |
---|
1930 | Volume, this hierarchy or tree can be repeated. |
---|
1931 | </p><p> |
---|
1932 | A Logical Volume also manages the information relative to the |
---|
1933 | Visualization attributes (<a href="ch08s06.html" title="8.6. |
---|
1934 | Visualization Attributes |
---|
1935 | ">Section 8.6</a>) and |
---|
1936 | user-defined parameters related to tracking, electro-magnetic field |
---|
1937 | or cuts (through the <code class="literal">G4UserLimits</code> interface). |
---|
1938 | </p><p> |
---|
1939 | By default, tracking optimization of the geometry (voxelization) |
---|
1940 | is applied to the volume hierarchy identified by a logical volume. |
---|
1941 | It is possible to change the default behavior by choosing not to |
---|
1942 | apply geometry optimization for a given logical volume. This |
---|
1943 | feature does not apply to the case where the associated physical |
---|
1944 | volume is a parameterised volume; in this case, optimization is |
---|
1945 | always applied. |
---|
1946 | |
---|
1947 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1948 | G4LogicalVolume( G4VSolid* pSolid, |
---|
1949 | G4Material* pMaterial, |
---|
1950 | const G4String& Name, |
---|
1951 | G4FieldManager* pFieldMgr=0, |
---|
1952 | G4VSensitiveDetector* pSDetector=0, |
---|
1953 | G4UserLimits* pULimits=0, |
---|
1954 | G4bool Optimise=true ) |
---|
1955 | </pre></div><p> |
---|
1956 | </p><p> |
---|
1957 | The logical volume provides a way to estimate the <span class="emphasis"><em>mass</em></span> of |
---|
1958 | a tree of volumes defining a detector or sub-detector. This can be |
---|
1959 | achieved by calling the method: |
---|
1960 | |
---|
1961 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1962 | G4double GetMass(G4bool forced=false) |
---|
1963 | </pre></div><p> |
---|
1964 | </p><p> |
---|
1965 | The mass of the logical volume tree is computed from the estimated |
---|
1966 | geometrical volume of each solid and material associated with the |
---|
1967 | logical volume and its daughters. Note that this computation may |
---|
1968 | require a considerable amount of time, depending on the complexity |
---|
1969 | of the geometry tree. The returned value is cached by default and |
---|
1970 | can be used for successive calls, unless recomputation is forced by |
---|
1971 | providing <code class="literal">true</code> for the boolean argument |
---|
1972 | <code class="literal">forced</code> in input. |
---|
1973 | Computation should be forced if the geometry setup has |
---|
1974 | changed after the previous call. |
---|
1975 | </p><p> |
---|
1976 | Finally, the Logical Volume manages the information relative to |
---|
1977 | the Envelopes hierarchy required for fast Monte Carlo |
---|
1978 | parameterisations (<a href="ch05s02.html#sect.PhysProc.Param" title="5.2.6. |
---|
1979 | Parameterization |
---|
1980 | ">Section 5.2.6</a>). |
---|
1981 | </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.LogVol.SubReg"></a>4.1.3.1. |
---|
1982 | Sub-detector Regions |
---|
1983 | </h4></div></div></div><p> |
---|
1984 | In complex geometry setups, such as those found in large detectors |
---|
1985 | in particle physics experiments, it is useful to think of specific |
---|
1986 | Logical Volumes as representing parts (sub-detectors) of the entire |
---|
1987 | detector setup which perform specific functions. In such setups, |
---|
1988 | the processing speed of a real simulation can be increased by |
---|
1989 | assigning specific production <span class="emphasis"><em>cuts</em></span> to each of these detector |
---|
1990 | parts. This allows a more detailed simulation to occur only in |
---|
1991 | those regions where it is required. |
---|
1992 | </p><p> |
---|
1993 | The concept of detector <span class="emphasis"><em>Region</em></span> was introduced to address |
---|
1994 | this need. Once the final geometry setup of the detector has been |
---|
1995 | defined, a region can be specified by constructing it with: |
---|
1996 | |
---|
1997 | </p><div class="informalexample"><pre class="programlisting"> |
---|
1998 | G4Region( const G4String& rName ) |
---|
1999 | </pre></div><p> |
---|
2000 | |
---|
2001 | where: |
---|
2002 | |
---|
2003 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
2004 | <code class="literal">rName</code> |
---|
2005 | </td><td> |
---|
2006 | String identifier for the detector region |
---|
2007 | </td></tr></tbody></table></div><p> |
---|
2008 | </p><p> |
---|
2009 | A <code class="literal">G4Region</code> must then be assigned to a logical volume, |
---|
2010 | in order to make it a <span class="emphasis"><em>Root Logical Volume</em></span>: |
---|
2011 | |
---|
2012 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2013 | G4Region* emCalorimeter = new G4Region("EM-Calorimeter"); |
---|
2014 | emCalorimeter->AddRootLogicalVolume(emCalorimeter); |
---|
2015 | </pre></div><p> |
---|
2016 | </p><p> |
---|
2017 | A root logical volume is the first volume at the top of the |
---|
2018 | hierarchy to which a given region is assigned. Once the region is |
---|
2019 | assigned to the root logical volume, the information is |
---|
2020 | automatically propagated to the volume tree, so that each daughter |
---|
2021 | volume shares the same region. Propagation on a tree branch will be |
---|
2022 | interrupted if an already existing root logical volume is |
---|
2023 | encountered. |
---|
2024 | </p><p> |
---|
2025 | A specific <span class="emphasis"><em>Production Cut</em></span> can be assigned to the region, |
---|
2026 | by defining and assigning to it a <code class="literal">G4ProductionCut</code> |
---|
2027 | object |
---|
2028 | |
---|
2029 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2030 | emCalorimeter->SetProductionCuts(emCalCuts); |
---|
2031 | </pre></div><p> |
---|
2032 | </p><p> |
---|
2033 | <a href="ch05s04.html#sect.ProThres.Set" title="5.4.2. |
---|
2034 | Set production threshold (SetCut methods) |
---|
2035 | ">Section 5.4.2</a> describes how to define a |
---|
2036 | production cut. The same region can be assigned to more than one |
---|
2037 | root logical volume, and root logical volumes can be removed from |
---|
2038 | an existing region. A logical volume can have only |
---|
2039 | <span class="emphasis"><em>one</em></span> region assigned to it. Regions will |
---|
2040 | be automatically registered in a store which will take care of |
---|
2041 | destroying them at the end of the job. A default region with a |
---|
2042 | default production cut is automatically created and assigned to the |
---|
2043 | world volume. |
---|
2044 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.PhysVol"></a>4.1.4. |
---|
2045 | Physical Volumes |
---|
2046 | </h3></div></div></div><p> |
---|
2047 | Physical volumes represent the spatial positioning of the |
---|
2048 | volumes describing the detector elements. Several techniques can be |
---|
2049 | used. They range from the simple placement of a single copy to the |
---|
2050 | repeated positioning using either a simple linear formula or a user |
---|
2051 | specified function. |
---|
2052 | </p><p> |
---|
2053 | The simple placement involves the definition of a transformation |
---|
2054 | matrix for the volume to be positioned. Repeated positioning is |
---|
2055 | defined using the number of times a volume should be replicated at |
---|
2056 | a given distance along a given direction. Finally it is possible to |
---|
2057 | define a parameterised formula to specify the position of multiple |
---|
2058 | copies of a volume. Details about these methods are given |
---|
2059 | below. |
---|
2060 | </p><p> |
---|
2061 | <span class="bold"><strong>Note</strong></span> - For geometries which vary between runs and for |
---|
2062 | which components of the old geometry setup are explicitely |
---|
2063 | -deleted-, it is required to consider the proper order of deletion |
---|
2064 | (which is the exact inverse of the actual construction, i.e., first |
---|
2065 | delete physical volumes and then logical volumes). Deleting a |
---|
2066 | logical volume does NOT delete its daughter volumes. |
---|
2067 | </p><p> |
---|
2068 | It is not necessary to delete the geometry setup at the end of a |
---|
2069 | job, the system will take care to free the volume and solid stores |
---|
2070 | at the end of the job. The user has to take care of the deletion of |
---|
2071 | any additional transformation or rotation matrices allocated |
---|
2072 | dinamically in his/her own application. |
---|
2073 | </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.PhysVol.PlaceSingle"></a>4.1.4.1. |
---|
2074 | Placements: single positioned copy |
---|
2075 | </h4></div></div></div><p> |
---|
2076 | In this case, the Physical Volume is created by associating a |
---|
2077 | Logical Volume with a Rotation Matrix and a Translation vector. The |
---|
2078 | Rotation Matrix represents the rotation of the reference frame of |
---|
2079 | the considered volume relatively to its mother volume's reference |
---|
2080 | frame. The Translation Vector represents the translation of the |
---|
2081 | current volume in the reference frame of its mother volume. |
---|
2082 | </p><p> |
---|
2083 | Transformations including reflections are not allowed. |
---|
2084 | </p><p> |
---|
2085 | To create a Placement one must construct it using: |
---|
2086 | |
---|
2087 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2088 | G4PVPlacement( G4RotationMatrix* pRot, |
---|
2089 | const G4ThreeVector& tlate, |
---|
2090 | G4LogicalVolume* pCurrentLogical, |
---|
2091 | const G4String& pName, |
---|
2092 | G4LogicalVolume* pMotherLogical, |
---|
2093 | G4bool pMany, |
---|
2094 | G4int pCopyNo, |
---|
2095 | G4bool pSurfChk=false ) |
---|
2096 | </pre></div><p> |
---|
2097 | |
---|
2098 | where: |
---|
2099 | |
---|
2100 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
2101 | <code class="literal">pRot</code> |
---|
2102 | </td><td> |
---|
2103 | Rotation with respect to its mother volume |
---|
2104 | </td></tr><tr><td> |
---|
2105 | <code class="literal">tlate</code> |
---|
2106 | </td><td> |
---|
2107 | Translation with respect to its mother volume |
---|
2108 | </td></tr><tr><td> |
---|
2109 | <code class="literal">pCurrentLogical</code> |
---|
2110 | </td><td> |
---|
2111 | The associated Logical Volume |
---|
2112 | </td></tr><tr><td> |
---|
2113 | <code class="literal">pName</code> |
---|
2114 | </td><td> |
---|
2115 | String identifier for this placement |
---|
2116 | </td></tr><tr><td> |
---|
2117 | <code class="literal">pMotherLogical</code> |
---|
2118 | </td><td> |
---|
2119 | The associated mother volume |
---|
2120 | </td></tr><tr><td> |
---|
2121 | <code class="literal">pMany</code> |
---|
2122 | </td><td> |
---|
2123 | For future use. Can be set to false |
---|
2124 | </td></tr><tr><td> |
---|
2125 | <code class="literal">pCopyNo</code> |
---|
2126 | </td><td> |
---|
2127 | Integer which identifies this placement |
---|
2128 | </td></tr><tr><td> |
---|
2129 | <code class="literal">pSurfChk</code> |
---|
2130 | </td><td> |
---|
2131 | if true activates check for overlaps with existing volumes |
---|
2132 | </td></tr></tbody></table></div><p> |
---|
2133 | </p><p> |
---|
2134 | Care must be taken because the rotation matrix is not copied by |
---|
2135 | a <code class="literal">G4PVPlacement</code>. So the user must not modify it after |
---|
2136 | creating a Placement that uses it. However the same rotation matrix |
---|
2137 | can be re-used for many volumes. |
---|
2138 | </p><p> |
---|
2139 | Currently boolean operations are not implemented at the level of |
---|
2140 | physical volume. So <code class="literal">pMany</code> must be false. However, an |
---|
2141 | alternative implementation of boolean operations exists. In this |
---|
2142 | approach a solid can be created from the union, intersection or |
---|
2143 | subtraction of two solids. See <a href="ch04.html#sect.Geom.Solids.BoolOp" title="4.1.2.2. |
---|
2144 | Solids made by Boolean operations |
---|
2145 | ">Section 4.1.2.2</a> |
---|
2146 | above for an explanation of this. |
---|
2147 | </p><p> |
---|
2148 | The mother volume must be specified for all volumes |
---|
2149 | <span class="emphasis"><em>except</em></span> the world volume. |
---|
2150 | </p><p> |
---|
2151 | An alternative way to specify a Placement utilizes a different |
---|
2152 | method to place the volume. The solid itself is moved by rotating |
---|
2153 | and translating it to bring it into the system of coordinates of |
---|
2154 | the mother volume. This <span class="emphasis"><em>active</em></span> method can be utilized using |
---|
2155 | the following constructor: |
---|
2156 | |
---|
2157 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2158 | G4PVPlacement( G4Transform3D solidTransform, |
---|
2159 | G4LogicalVolume* pCurrentLogical, |
---|
2160 | const G4String& pName, |
---|
2161 | G4LogicalVolume* pMotherLogical, |
---|
2162 | G4bool pMany, |
---|
2163 | G4int pCopyNo, |
---|
2164 | G4bool pSurfChk=false ) |
---|
2165 | </pre></div><p> |
---|
2166 | </p><p> |
---|
2167 | An alternative method to specify the mother volume is to specify |
---|
2168 | its placed physical volume. It can be used in either of the above |
---|
2169 | methods of specifying the placement's position and rotation. The |
---|
2170 | effect will be exactly the same as for using the mother logical |
---|
2171 | volume. |
---|
2172 | </p><p> |
---|
2173 | Note that a Placement Volume can still represent multiple |
---|
2174 | detector elements. This can happen if several copies exist of the |
---|
2175 | mother logical volume. Then different detector elements will belong |
---|
2176 | to different branches of the tree of the hierarchy of geometrical |
---|
2177 | volumes. |
---|
2178 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.PhysVol.RepeatVol"></a>4.1.4.2. |
---|
2179 | Repeated volumes |
---|
2180 | </h4></div></div></div><p> |
---|
2181 | In this case, a single Physical Volume represents multiple copies |
---|
2182 | of a volume within its mother volume, allowing to save memory. This |
---|
2183 | is normally done when the volumes to be positioned follow a well |
---|
2184 | defined rotational or translational symmetry along a Cartesian or |
---|
2185 | cylindrical coordinate. The Repeated Volumes technique is available |
---|
2186 | for volumes described by CSG solids. |
---|
2187 | </p><h5><a name="id398081"></a> |
---|
2188 | Replicas: |
---|
2189 | </h5><p> |
---|
2190 | Replicas are <span class="emphasis"><em>repeated volumes</em></span> in the case when the |
---|
2191 | multiple copies of the volume are all identical. The coordinate |
---|
2192 | axis and the number of replicas need to be specified for the |
---|
2193 | program to compute at run time the transformation matrix |
---|
2194 | corresponding to each copy. |
---|
2195 | |
---|
2196 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2197 | G4PVReplica( const G4String& pName, |
---|
2198 | G4LogicalVolume* pCurrentLogical, |
---|
2199 | G4LogicalVolume* pMotherLogical, // OR G4VPhysicalVolume* |
---|
2200 | const EAxis pAxis, |
---|
2201 | const G4int nReplicas, |
---|
2202 | const G4double width, |
---|
2203 | const G4double offset=0 ) |
---|
2204 | </pre></div><p> |
---|
2205 | |
---|
2206 | where: |
---|
2207 | |
---|
2208 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
2209 | <code class="literal">pName</code> |
---|
2210 | </td><td> |
---|
2211 | String identifier for the replicated volume |
---|
2212 | </td></tr><tr><td> |
---|
2213 | <code class="literal">pCurrentLogical</code> |
---|
2214 | </td><td> |
---|
2215 | The associated Logical Volume |
---|
2216 | </td></tr><tr><td> |
---|
2217 | <code class="literal">pMotherLogical</code> |
---|
2218 | </td><td> |
---|
2219 | The associated mother volume |
---|
2220 | </td></tr><tr><td> |
---|
2221 | <code class="literal">pAxis</code> |
---|
2222 | </td><td> |
---|
2223 | The axis along with the replication is applied |
---|
2224 | </td></tr><tr><td> |
---|
2225 | <code class="literal">nReplicas</code> |
---|
2226 | </td><td> |
---|
2227 | The number of replicated volumes |
---|
2228 | </td></tr><tr><td> |
---|
2229 | <code class="literal">width</code> |
---|
2230 | </td><td> |
---|
2231 | The width of a single replica along the axis of replication |
---|
2232 | </td></tr><tr><td> |
---|
2233 | <code class="literal">offset</code> |
---|
2234 | </td><td> |
---|
2235 | Possible offset associated to mother offset along the axis of |
---|
2236 | replication |
---|
2237 | </td></tr></tbody></table></div><p> |
---|
2238 | </p><p> |
---|
2239 | <code class="literal">G4PVReplica</code> represents <code class="literal">nReplicas</code> volumes |
---|
2240 | differing only in their positioning, and completely <span class="bold"><strong>filling</strong></span> |
---|
2241 | the containing mother volume. Consequently if a |
---|
2242 | <code class="literal">G4PVReplica</code> is 'positioned' inside a given mother it |
---|
2243 | <span class="bold"><strong>MUST</strong></span> be the mother's only daughter volume. Replica's |
---|
2244 | correspond to divisions or slices that completely fill the mother |
---|
2245 | volume and have no offsets. For Cartesian axes, slices are |
---|
2246 | considered perpendicular to the axis of replication. |
---|
2247 | </p><p> |
---|
2248 | The replica's positions are calculated by means of a linear |
---|
2249 | formula. Replication may occur along: |
---|
2250 | |
---|
2251 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2252 | <span class="emphasis"><em>Cartesian axes <code class="literal">(kXAxis,kYAxis,kZAxis)</code></em></span> |
---|
2253 | </p><p> |
---|
2254 | The replications, of specified width have coordinates of form |
---|
2255 | <code class="literal">(-width*(nReplicas-1)*0.5+n*width,0,0)</code> |
---|
2256 | </p><p> |
---|
2257 | </p><p> |
---|
2258 | where <code class="literal">n=0.. nReplicas-1</code> for the case of <code class="literal">kXAxis</code>, |
---|
2259 | and are unrotated. |
---|
2260 | </p><p> |
---|
2261 | </p></li><li><p> |
---|
2262 | <span class="emphasis"><em>Radial axis (cylindrical polar) <code class="literal">(kRho)</code></em></span> |
---|
2263 | </p><p> |
---|
2264 | The replications are cons/tubs sections, centred on the origin and |
---|
2265 | are unrotated. |
---|
2266 | </p><p> |
---|
2267 | </p><p> |
---|
2268 | They have radii of <code class="literal">width*n+offset</code> to |
---|
2269 | <code class="literal">width*(n+1)+offset</code> where |
---|
2270 | <code class="literal">n=0..nReplicas-1</code> |
---|
2271 | </p><p> |
---|
2272 | </p></li><li><p> |
---|
2273 | <span class="emphasis"><em>Phi axis (cylindrical polar) <code class="literal">(kPhi)</code></em></span> |
---|
2274 | </p><p> |
---|
2275 | The replications are <span class="emphasis"><em>phi sections</em></span> or |
---|
2276 | <span class="emphasis"><em>wedges</em></span>, and of cons/tubs form. |
---|
2277 | </p><p> |
---|
2278 | </p><p> |
---|
2279 | They have <code class="literal">phi</code> of <code class="literal">offset+n*width</code> to |
---|
2280 | <code class="literal">offset+(n+1)*width</code> where |
---|
2281 | <code class="literal">n=0..nReplicas-1</code> |
---|
2282 | </p><p> |
---|
2283 | </p></li></ul></div><p> |
---|
2284 | </p><p> |
---|
2285 | The coordinate system of the replicas is at the centre of each |
---|
2286 | replica for the cartesian axis. For the radial case, the coordinate |
---|
2287 | system is unchanged from the mother. For the <code class="literal">phi</code> axis, the |
---|
2288 | new coordinate system is rotated such that the X axis bisects the |
---|
2289 | angle made by each wedge, and Z remains parallel to the mother's Z |
---|
2290 | axis. |
---|
2291 | </p><p> |
---|
2292 | The solid associated via the replicas' logical volume should |
---|
2293 | have the dimensions of the first volume created and must be of the |
---|
2294 | correct symmetry/type, in order to assist in good |
---|
2295 | visualisation. |
---|
2296 | </p><p> |
---|
2297 | ex. For X axis replicas in a box, the solid should be another box |
---|
2298 | with the dimensions of the replications. (same Y & Z dimensions |
---|
2299 | as mother box, X dimension = mother's X dimension/nReplicas). |
---|
2300 | </p><p> |
---|
2301 | Replicas may be placed inside other replicas, provided the above |
---|
2302 | rule is observed. Normal placement volumes may be placed inside |
---|
2303 | replicas, provided that they do not intersect the mother's or any |
---|
2304 | previous replica's boundaries. Parameterised volumes may not be |
---|
2305 | placed inside. |
---|
2306 | </p><p> |
---|
2307 | Because of these rules, it is not possible to place any other |
---|
2308 | volume inside a replication in <code class="literal">radius</code>. |
---|
2309 | </p><p> |
---|
2310 | The world volume <span class="emphasis"><em>cannot</em></span> act as a replica, therefore it |
---|
2311 | cannot be sliced. |
---|
2312 | </p><p> |
---|
2313 | During tracking, the translation + rotation associated with each |
---|
2314 | <code class="literal">G4PVReplica</code> object is modified according to the currently |
---|
2315 | 'active' replication. The solid is not modified and consequently |
---|
2316 | has the wrong parameters for the cases of <code class="literal">phi</code> and |
---|
2317 | <code class="literal">r</code> replication and for when the cross-section of the mother |
---|
2318 | is not constant along the replication. |
---|
2319 | </p><p> |
---|
2320 | Example: |
---|
2321 | |
---|
2322 | </p><div class="example"><a name="programlist_Geom.PhysVol_1"></a><p class="title"><b>Example 4.2. |
---|
2323 | An example of simple replicated volumes with <code class="literal">G4PVReplica</code>. |
---|
2324 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
2325 | G4PVReplica repX("Linear Array", |
---|
2326 | pRepLogical, |
---|
2327 | pContainingMother, |
---|
2328 | kXAxis, 5, 10*mm); |
---|
2329 | |
---|
2330 | G4PVReplica repR("RSlices", |
---|
2331 | pRepRLogical, |
---|
2332 | pContainingMother, |
---|
2333 | kRho, 5, 10*mm, 0); |
---|
2334 | |
---|
2335 | G4PVReplica repRZ("RZSlices", |
---|
2336 | pRepRZLogical, |
---|
2337 | &repR, |
---|
2338 | kZAxis, 5, 10*mm); |
---|
2339 | |
---|
2340 | G4PVReplica repRZPhi("RZPhiSlices", |
---|
2341 | pRepRZPhiLogical, |
---|
2342 | &repRZ, |
---|
2343 | kPhi, 4, M_PI*0.5*rad, 0); |
---|
2344 | </pre></div></div><p><br class="example-break"> |
---|
2345 | </p><p> |
---|
2346 | <code class="literal">RepX</code> is an array of 5 replicas of width 10*mm, |
---|
2347 | positioned inside and completely filling the volume pointed by |
---|
2348 | <code class="literal">pContainingMother</code>. The mother's X length must be |
---|
2349 | 5*10*mm=50*mm (for example, if the mother's solid were a Box of |
---|
2350 | half lengths [25,25,25] then the replica's solid must be a box of |
---|
2351 | half lengths [25,25,5]). |
---|
2352 | </p><p> |
---|
2353 | If the containing mother's solid is a tube of radius 50*mm and |
---|
2354 | half Z length of 25*mm, <code class="literal">RepR</code> divides the mother tube into |
---|
2355 | 5 cylinders (hence the solid associated with <code class="literal">pRepRLogical</code> |
---|
2356 | must be a tube of radius 10*mm, and half Z length 25*mm); |
---|
2357 | <code class="literal">repRZ</code> divides it into 5 shorter cylinders (the solid |
---|
2358 | associated with <code class="literal">pRepRZLogical</code> must be a tube of radius |
---|
2359 | 10*mm, and half Z length 5*mm); finally, <code class="literal">repRZPhi</code> divides |
---|
2360 | it into 4 tube segments with full angle of 90 degrees (the solid |
---|
2361 | associated with <code class="literal">pRepRZPhiLogical</code> must be a tube segment of |
---|
2362 | radius 10*mm, half Z length 5*mm and delta phi of |
---|
2363 | M_PI*0.5*rad). |
---|
2364 | </p><p> |
---|
2365 | No further volumes may be placed inside these replicas. To do so |
---|
2366 | would result in intersecting boundaries due to the <code class="literal">r</code> |
---|
2367 | replications. |
---|
2368 | </p><h5><a name="id398650"></a> |
---|
2369 | Parameterised Volumes: |
---|
2370 | </h5><p> |
---|
2371 | Parameterised Volumes are <span class="emphasis"><em>repeated volumes</em></span> in the case in |
---|
2372 | which the multiple copies of a volume can be different in size, |
---|
2373 | solid type, or material. The solid's type, its dimensions, the |
---|
2374 | material and the transformation matrix can all be parameterised in |
---|
2375 | function of the copy number, both when a strong symmetry exist and |
---|
2376 | when it does not. The user implements the desired parameterisation |
---|
2377 | function and the program computes and updates automatically at run |
---|
2378 | time the information associated to the Physical Volume. |
---|
2379 | </p><p> |
---|
2380 | An example of creating a parameterised volume (by dimension and |
---|
2381 | position) exists in novice example N02. The implementation is |
---|
2382 | provided in the two classes <code class="literal">ExN02DetectorConstruction</code> and |
---|
2383 | <code class="literal">ExN02ChamberParameterisation</code>. |
---|
2384 | </p><p> |
---|
2385 | To create a parameterised volume, one must first create its |
---|
2386 | logical volume like <code class="literal">trackerChamberLV</code> below. Then one must |
---|
2387 | create his own parameterisation class |
---|
2388 | (<span class="emphasis"><em>ExN02ChamberParameterisation</em></span>) and instantiate an object of |
---|
2389 | this class (<code class="literal">chamberParam</code>). We will see how to create the |
---|
2390 | parameterisation below. |
---|
2391 | |
---|
2392 | </p><div class="example"><a name="programlist_Geom.PhysVol_2"></a><p class="title"><b>Example 4.3. |
---|
2393 | An example of Parameterised volumes. |
---|
2394 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
2395 | //------------------------------ |
---|
2396 | // Tracker segments |
---|
2397 | //------------------------------ |
---|
2398 | // An example of Parameterised volumes |
---|
2399 | // dummy values for G4Box -- modified by parameterised volume |
---|
2400 | G4VSolid * solidChamber = |
---|
2401 | new G4Box("chamberBox", 10.*cm, 10.*cm, 10.*cm); |
---|
2402 | |
---|
2403 | G4LogicalVolume * trackerChamberLV |
---|
2404 | = new G4LogicalVolume(solidChamber, Aluminum, "trackerChamberLV"); |
---|
2405 | G4VPVParameterisation * chamberParam |
---|
2406 | = new ExN02ChamberParameterisation( |
---|
2407 | 6, // NoChambers, |
---|
2408 | -240.*cm, // Z of centre of first |
---|
2409 | 80*cm, // Z spacing of centres |
---|
2410 | 20*cm, // Width Chamber, |
---|
2411 | 50*cm, // lengthInitial, |
---|
2412 | trackerSize*2.); // lengthFinal |
---|
2413 | |
---|
2414 | G4VPhysicalVolume *trackerChamber_phys |
---|
2415 | = new G4PVParameterised("TrackerChamber_parameterisedPV", |
---|
2416 | trackerChamberLV, // Its logical volume |
---|
2417 | logicTracker, // Mother logical volume |
---|
2418 | kUndefined, // Allow default voxelising -- no axis |
---|
2419 | 6, // Number of chambers |
---|
2420 | chamberParam); // The parameterisation |
---|
2421 | // "kUndefined" is the suggested choice, giving 3D voxelisation (i.e. along the three |
---|
2422 | // cartesian axes, as is applied for placements. |
---|
2423 | // |
---|
2424 | // Note: In some cases where volume have clear separation along a single axis, |
---|
2425 | // this axis (eg kZAxis) can be used to choose (force) optimisation only along |
---|
2426 | // this axis in geometrical calculations. |
---|
2427 | // When an axis is given it forces the use of one-dimensional voxelisation. |
---|
2428 | </pre></div></div><p><br class="example-break"> |
---|
2429 | </p><p> |
---|
2430 | The general constructor is: |
---|
2431 | |
---|
2432 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2433 | G4PVParameterised( const G4String& pName, |
---|
2434 | G4LogicalVolume* pCurrentLogical, |
---|
2435 | G4LogicalVolume* pMotherLogical, // OR G4VPhysicalVolume* |
---|
2436 | const EAxis pAxis, |
---|
2437 | const G4int nReplicas, |
---|
2438 | G4VPVParameterisation* pParam, |
---|
2439 | G4bool pSurfChk=false ) |
---|
2440 | |
---|
2441 | </pre></div><p> |
---|
2442 | </p><p> |
---|
2443 | Note that for a parameterised volume the user must always |
---|
2444 | specify a mother volume. So the world volume can <span class="emphasis"><em>never</em></span> be a |
---|
2445 | parameterised volume, nor it can be sliced. The mother volume can |
---|
2446 | be specified either as a physical or a logical volume. |
---|
2447 | </p><p> |
---|
2448 | <code class="literal">pAxis</code> specifies the tracking optimisation algorithm to |
---|
2449 | apply: if a valid axis (the axis along which the parameterisation |
---|
2450 | is performed) is specified, a simple one-dimensional voxelisation |
---|
2451 | algorithm is applied; if "kUndefined" is specified instead, the |
---|
2452 | default three-dimensional voxelisation algorithm applied for normal |
---|
2453 | placements will be activated. In the latter case, more voxels will |
---|
2454 | be generated, therefore a greater amount of memory will be consumed |
---|
2455 | by the optimisation algorithm. |
---|
2456 | </p><p> |
---|
2457 | <code class="literal">pSurfChk</code> if <code class="literal">true</code> activates a check for |
---|
2458 | overlaps with existing volumes or paramaterised instances. |
---|
2459 | </p><p> |
---|
2460 | The parameterisation mechanism associated to a parameterised |
---|
2461 | volume is defined in the parameterisation class and its methods. |
---|
2462 | Every parameterisation must create two methods: |
---|
2463 | |
---|
2464 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2465 | <code class="literal">ComputeTransformation</code> defines where one of the copies |
---|
2466 | is placed, |
---|
2467 | </p></li><li><p> |
---|
2468 | <code class="literal">ComputeDimensions</code> defines the size of one copy, and |
---|
2469 | </p></li><li><p> |
---|
2470 | a constructor that initializes any member variables that are |
---|
2471 | required. |
---|
2472 | </p></li></ul></div><p> |
---|
2473 | |
---|
2474 | </p><p> |
---|
2475 | An example is <code class="literal">ExN02ChamberParameterisation</code> that |
---|
2476 | parameterises a series of boxes of different sizes |
---|
2477 | |
---|
2478 | </p><div class="example"><a name="programlist_Geom.PhysVol_3"></a><p class="title"><b>Example 4.4. |
---|
2479 | An example of Parameterised boxes of different sizes. |
---|
2480 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
2481 | class ExN02ChamberParameterisation : public G4VPVParameterisation |
---|
2482 | { |
---|
2483 | ... |
---|
2484 | void ComputeTransformation(const G4int copyNo, |
---|
2485 | G4VPhysicalVolume *physVol) const; |
---|
2486 | |
---|
2487 | void ComputeDimensions(G4Box& trackerLayer, |
---|
2488 | const G4int copyNo, |
---|
2489 | const G4VPhysicalVolume *physVol) const; |
---|
2490 | ... |
---|
2491 | } |
---|
2492 | </pre></div></div><p><br class="example-break"> |
---|
2493 | </p><p> |
---|
2494 | |
---|
2495 | </p><p> |
---|
2496 | These methods works as follows: |
---|
2497 | </p><p> |
---|
2498 | |
---|
2499 | </p><p> |
---|
2500 | The <code class="literal">ComputeTransformation</code> method is called with a copy |
---|
2501 | number for the instance of the parameterisation under |
---|
2502 | consideration. It must compute the transformation for this copy, |
---|
2503 | and set the physical volume to utilize this transformation: |
---|
2504 | |
---|
2505 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2506 | void ExN02ChamberParameterisation::ComputeTransformation |
---|
2507 | (const G4int copyNo,G4VPhysicalVolume *physVol) const |
---|
2508 | { |
---|
2509 | G4double Zposition= fStartZ + copyNo * fSpacing; |
---|
2510 | G4ThreeVector origin(0,0,Zposition); |
---|
2511 | physVol->SetTranslation(origin); |
---|
2512 | physVol->SetRotation(0); |
---|
2513 | } |
---|
2514 | </pre></div><p> |
---|
2515 | </p><p> |
---|
2516 | |
---|
2517 | </p><p> |
---|
2518 | Note that the translation and rotation given in this scheme are |
---|
2519 | those for the frame of coordinates (the <span class="emphasis"><em>passive</em></span> method). |
---|
2520 | They are <span class="bold"><strong>not</strong></span> for the |
---|
2521 | <span class="emphasis"><em>active</em></span> method, in which the |
---|
2522 | solid is rotated into the mother frame of coordinates. |
---|
2523 | </p><p> |
---|
2524 | |
---|
2525 | </p><p> |
---|
2526 | Similarly the <code class="literal">ComputeDimensions</code> method is used to set |
---|
2527 | the size of that copy. |
---|
2528 | |
---|
2529 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2530 | void ExN02ChamberParameterisation::ComputeDimensions |
---|
2531 | (G4Box & trackerChamber, const G4int copyNo, |
---|
2532 | const G4VPhysicalVolume * physVol) const |
---|
2533 | { |
---|
2534 | G4double halfLength= fHalfLengthFirst + (copyNo-1) * fHalfLengthIncr; |
---|
2535 | trackerChamber.SetXHalfLength(halfLength); |
---|
2536 | trackerChamber.SetYHalfLength(halfLength); |
---|
2537 | trackerChamber.SetZHalfLength(fHalfWidth); |
---|
2538 | } |
---|
2539 | </pre></div><p> |
---|
2540 | </p><p> |
---|
2541 | |
---|
2542 | </p><p> |
---|
2543 | The user must ensure that the type of the first argument of this |
---|
2544 | method (in this example <code class="literal">G4Box &</code>) corresponds to the |
---|
2545 | type of object the user give to the logical volume of parameterised |
---|
2546 | physical volume. |
---|
2547 | </p><p> |
---|
2548 | |
---|
2549 | </p><p> |
---|
2550 | More advanced usage allows the user: |
---|
2551 | |
---|
2552 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2553 | to change the type of solid by creating a <code class="literal">ComputeSolid</code> |
---|
2554 | method, or |
---|
2555 | </p></li><li><p> |
---|
2556 | to change the material of the volume by creating a |
---|
2557 | <code class="literal">ComputeMaterial</code> method. This method can also utilise |
---|
2558 | information from a parent or other ancestor volume (see the Nested |
---|
2559 | Parameterisation below.) |
---|
2560 | </p></li></ul></div><p> |
---|
2561 | |
---|
2562 | for the parameterisation. |
---|
2563 | </p><p> |
---|
2564 | |
---|
2565 | </p><p> |
---|
2566 | Example N07 shows a simple parameterisation by material. A more |
---|
2567 | complex example is provided in |
---|
2568 | <code class="literal">examples/extended/medical/DICOM</code>, where a phantom grid of |
---|
2569 | cells is built using a parameterisation by material defined through |
---|
2570 | a map. |
---|
2571 | </p><p> |
---|
2572 | |
---|
2573 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> |
---|
2574 | Currently for many cases it is not possible to add |
---|
2575 | daughter volumes to a parameterised volume. Only parameterised |
---|
2576 | volumes all of whose solids have the same size are allowed to |
---|
2577 | contain daughter volumes. When the size or type of solid varies, |
---|
2578 | adding daughters is not supported. |
---|
2579 | </p><p> |
---|
2580 | So the full power of parameterised volumes can be used only for |
---|
2581 | "leaf" volumes, which contain no other volumes. |
---|
2582 | </p></div><p> |
---|
2583 | |
---|
2584 | |
---|
2585 | |
---|
2586 | </p><h5><a name="id399003"></a> |
---|
2587 | Advanced parameterisations for 'nested' parameterised volumes |
---|
2588 | </h5><p> |
---|
2589 | |
---|
2590 | </p><p> |
---|
2591 | A new type of parameterisation enables a user to have the |
---|
2592 | daughter's material also depend on the copy number of the parent |
---|
2593 | when a parameterised volume (daughter) is located inside another |
---|
2594 | (parent) repeated volume. The parent volume can be a replica, a |
---|
2595 | parameterised volume, or a division if the key feature of modifying |
---|
2596 | its contents is utilised. (Note: a 'nested' parameterisation inside |
---|
2597 | a placement volume is not supported, because all copies of a |
---|
2598 | placement volume must be identical at all levels.) |
---|
2599 | </p><p> |
---|
2600 | |
---|
2601 | </p><p> |
---|
2602 | In such a " nested" parameterisation , the user must provide a |
---|
2603 | <code class="literal">ComputeMaterial</code> method that utilises the new argument that |
---|
2604 | represents the touchable history of the parent volume: |
---|
2605 | |
---|
2606 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2607 | // Sample Parameterisation |
---|
2608 | class SampleNestedParameterisation : public G4VNestedParameterisation |
---|
2609 | { |
---|
2610 | public: |
---|
2611 | // .. other methods ... |
---|
2612 | // Mandatory method, required and reason for this class |
---|
2613 | virtual G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol, |
---|
2614 | const G4int no_lev, |
---|
2615 | const G4VTouchable *parentTouch); |
---|
2616 | private: |
---|
2617 | G4Material *material1, *material2; |
---|
2618 | }; |
---|
2619 | </pre></div><p> |
---|
2620 | </p><p> |
---|
2621 | |
---|
2622 | </p><p> |
---|
2623 | The implementation of the method can utilise any information |
---|
2624 | from a parent or other ancestor volume of its parameterised |
---|
2625 | physical volume, but typically it will use only the copy |
---|
2626 | number: |
---|
2627 | |
---|
2628 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2629 | G4Material* |
---|
2630 | SampleNestedParameterisation::ComputeMaterial(G4VPhysicalVolume *currentVol, |
---|
2631 | const G4int no_lev, |
---|
2632 | const G4VTouchable *parentTouchable) |
---|
2633 | { |
---|
2634 | G4Material *material=0; |
---|
2635 | |
---|
2636 | // Get the information about the parent volume |
---|
2637 | G4int no_parent= parentTouchable->GetReplicaNumber(); |
---|
2638 | G4int no_total= no_parent + no_lev; |
---|
2639 | // A simple 'checkerboard' pattern of two materials |
---|
2640 | if( no_total / 2 == 1 ) material= material1; |
---|
2641 | else material= material2; |
---|
2642 | // Set the material to the current logical volume |
---|
2643 | G4LogicalVolume* currentLogVol= currentVol->GetLogicalVolume(); |
---|
2644 | currentLogVol->SetMaterial( material ); |
---|
2645 | return material; |
---|
2646 | } |
---|
2647 | </pre></div><p> |
---|
2648 | </p><p> |
---|
2649 | |
---|
2650 | </p><p> |
---|
2651 | Nested parameterisations are suitable for the case of regular, |
---|
2652 | 'voxel' geometries in which a large number of 'equal' volumes are |
---|
2653 | required, and their only difference is in their material. By |
---|
2654 | creating two (or more) levels of parameterised physical volumes it |
---|
2655 | is possible to divide space, while requiring only limited |
---|
2656 | additional memory for very fine-level optimisation. This provides |
---|
2657 | fast navigation. Alternative implementations, taking into account |
---|
2658 | the regular structure of such geometries in navigation are under |
---|
2659 | study. |
---|
2660 | </p><p> |
---|
2661 | |
---|
2662 | |
---|
2663 | </p><h5><a name="id399078"></a> |
---|
2664 | Divisions of Volumes |
---|
2665 | </h5><p> |
---|
2666 | |
---|
2667 | </p><p> |
---|
2668 | Divisions in Geant4 are implemented as a specialized type of |
---|
2669 | parameterised volumes. |
---|
2670 | </p><p> |
---|
2671 | |
---|
2672 | </p><p> |
---|
2673 | They serve to divide a volume into identical copies along one of |
---|
2674 | its axes, providing the possibility to define an <span class="emphasis"><em>offset</em></span>, and |
---|
2675 | without the limitation that the daugthers have to fill the mother |
---|
2676 | volume as it is the case for the replicas. In the case, for |
---|
2677 | example, of a tube divided along its radial axis, the copies are |
---|
2678 | not strictly identical, but have increasing radii, although their |
---|
2679 | widths are constant. |
---|
2680 | </p><p> |
---|
2681 | |
---|
2682 | </p><p> |
---|
2683 | To divide a volume it will be necessary to provide: |
---|
2684 | |
---|
2685 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
2686 | the axis of division, and |
---|
2687 | </p></li><li><p> |
---|
2688 | either |
---|
2689 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2690 | the number of divisions (so that the width of each division |
---|
2691 | will be automatically calculated), or |
---|
2692 | </p></li><li><p> |
---|
2693 | the division width (so that the number of divisions will be |
---|
2694 | automatically calculated to fill as much of the mother as |
---|
2695 | possible), or |
---|
2696 | </p></li><li><p> |
---|
2697 | both the number of divisions and the division width (this is |
---|
2698 | especially designed for the case where the copies do not fully fill |
---|
2699 | the mother). |
---|
2700 | </p></li></ul></div><p> |
---|
2701 | </p></li></ol></div><p> |
---|
2702 | </p><p> |
---|
2703 | |
---|
2704 | </p><p> |
---|
2705 | An <span class="emphasis"><em>offset</em></span> can be defined so that the first copy will |
---|
2706 | start at some distance from the mother wall. The dividing copies |
---|
2707 | will be then distributed to occupy the rest of the volume. |
---|
2708 | </p><p> |
---|
2709 | |
---|
2710 | </p><p> |
---|
2711 | There are three constructors, corresponding to the three input |
---|
2712 | possibilities described above: |
---|
2713 | |
---|
2714 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2715 | Giving only the number of divisions: |
---|
2716 | |
---|
2717 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2718 | G4PVDivision( const G4String& pName, |
---|
2719 | G4LogicalVolume* pCurrentLogical, |
---|
2720 | G4LogicalVolume* pMotherLogical, |
---|
2721 | const EAxis pAxis, |
---|
2722 | const G4int nDivisions, |
---|
2723 | const G4double offset ) |
---|
2724 | </pre></div><p> |
---|
2725 | </p></li><li><p> |
---|
2726 | Giving only the division width: |
---|
2727 | |
---|
2728 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2729 | G4PVDivision( const G4String& pName, |
---|
2730 | G4LogicalVolume* pCurrentLogical, |
---|
2731 | G4LogicalVolume* pMotherLogical, |
---|
2732 | const EAxis pAxis, |
---|
2733 | const G4double width, |
---|
2734 | const G4double offset ) |
---|
2735 | </pre></div><p> |
---|
2736 | </p></li><li><p> |
---|
2737 | Giving the number of divisions and the division width: |
---|
2738 | |
---|
2739 | </p><div class="informalexample"><pre class="programlisting"> |
---|
2740 | G4PVDivision( const G4String& pName, |
---|
2741 | G4LogicalVolume* pCurrentLogical, |
---|
2742 | G4LogicalVolume* pMotherLogical, |
---|
2743 | const EAxis pAxis, |
---|
2744 | const G4int nDivisions, |
---|
2745 | const G4double width, |
---|
2746 | const G4double offset ) |
---|
2747 | </pre></div><p> |
---|
2748 | </p></li></ul></div><p> |
---|
2749 | |
---|
2750 | where: |
---|
2751 | |
---|
2752 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
2753 | <code class="literal">pName</code> |
---|
2754 | </td><td> |
---|
2755 | String identifier for the replicated volume |
---|
2756 | </td></tr><tr><td> |
---|
2757 | <code class="literal">pCurrentLogical</code> |
---|
2758 | </td><td> |
---|
2759 | The associated Logical Volume |
---|
2760 | </td></tr><tr><td> |
---|
2761 | <code class="literal">pMotherLogical</code> |
---|
2762 | </td><td> |
---|
2763 | The associated mother Logical Volume |
---|
2764 | </td></tr><tr><td> |
---|
2765 | <code class="literal">pAxis</code> |
---|
2766 | </td><td> |
---|
2767 | The axis along which the division is applied |
---|
2768 | </td></tr><tr><td> |
---|
2769 | <code class="literal">nDivisions</code> |
---|
2770 | </td><td> |
---|
2771 | The number of divisions |
---|
2772 | </td></tr><tr><td> |
---|
2773 | <code class="literal">width</code> |
---|
2774 | </td><td> |
---|
2775 | The width of a single division along the axis |
---|
2776 | </td></tr><tr><td> |
---|
2777 | <code class="literal">offset</code> |
---|
2778 | </td><td> |
---|
2779 | Possible offset associated to the mother along the axis of division |
---|
2780 | </td></tr></tbody></table></div><p> |
---|
2781 | </p><p> |
---|
2782 | |
---|
2783 | </p><p> |
---|
2784 | The parameterisation is calculated automatically using the |
---|
2785 | values provided in input. Therefore the dimensions of the solid |
---|
2786 | associated with <code class="literal">pCurrentLogical</code> will not be used, but |
---|
2787 | recomputed through the |
---|
2788 | <code class="literal">G4VParameterisation::ComputeDimension()</code> method. |
---|
2789 | </p><p> |
---|
2790 | |
---|
2791 | </p><p> |
---|
2792 | Since <code class="literal">G4VPVParameterisation</code> may have different |
---|
2793 | <code class="literal">ComputeDimension()</code> methods for each solid type, the user |
---|
2794 | must provide a solid that is of the same type as of the one |
---|
2795 | associated to the mother volume. |
---|
2796 | </p><p> |
---|
2797 | |
---|
2798 | </p><p> |
---|
2799 | As for any replica, the coordinate system of the divisions is |
---|
2800 | related to the centre of each division for the cartesian axis. For |
---|
2801 | the radial axis, the coordinate system is the same of the mother |
---|
2802 | volume. For the phi axis, the new coordinate system is rotated such |
---|
2803 | that the X axis bisects the angle made by each wedge, and Z remains |
---|
2804 | parallel to the mother's Z axis. |
---|
2805 | </p><p> |
---|
2806 | |
---|
2807 | </p><p> |
---|
2808 | As divisions are parameterised volumes with constant dimensions, |
---|
2809 | they may be placed inside other divisions, except in the case of |
---|
2810 | divisions along the radial axis. |
---|
2811 | </p><p> |
---|
2812 | |
---|
2813 | </p><p> |
---|
2814 | It is also possible to place other volumes inside a volume where a |
---|
2815 | division is placed. |
---|
2816 | </p><p> |
---|
2817 | |
---|
2818 | </p><p> |
---|
2819 | The list of volumes that currently support divisioning and the |
---|
2820 | possible division axis are summarised below: |
---|
2821 | |
---|
2822 | </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td> |
---|
2823 | <code class="literal">G4Box</code> |
---|
2824 | </td><td> |
---|
2825 | <code class="literal">kXAxis</code>, <code class="literal">kYAxis</code>, <code class="literal">kZAxis</code> |
---|
2826 | </td></tr><tr><td> |
---|
2827 | <code class="literal">G4Tubs</code> |
---|
2828 | </td><td> |
---|
2829 | <code class="literal">kRho</code>, <code class="literal">kPhi</code>, <code class="literal">kZAxis</code> |
---|
2830 | </td></tr><tr><td> |
---|
2831 | <code class="literal">G4Cons</code> |
---|
2832 | </td><td> |
---|
2833 | <code class="literal">kRho</code>, <code class="literal">kPhi</code>, <code class="literal">kZAxis</code> |
---|
2834 | </td></tr><tr><td> |
---|
2835 | <code class="literal">G4Trd</code> |
---|
2836 | </td><td> |
---|
2837 | <code class="literal">kXAxis</code>, <code class="literal">kYAxis</code>, <code class="literal">kZAxis</code> |
---|
2838 | </td></tr><tr><td> |
---|
2839 | <code class="literal">G4Para</code> |
---|
2840 | </td><td> |
---|
2841 | <code class="literal">kXAxis</code>, <code class="literal">kYAxis</code>, <code class="literal">kZAxis</code> |
---|
2842 | </td></tr><tr><td> |
---|
2843 | <code class="literal">G4Polycone</code> |
---|
2844 | </td><td> |
---|
2845 | <code class="literal">kRho</code>, <code class="literal">kPhi</code>, <code class="literal">kZAxis</code> (*) |
---|
2846 | </td></tr><tr><td> |
---|
2847 | <code class="literal">G4Polyhedra</code> |
---|
2848 | </td><td> |
---|
2849 | <code class="literal">kRho</code>, <code class="literal">kPhi</code>, <code class="literal">kZAxis</code> (**) |
---|
2850 | </td></tr></tbody></table></div><p> |
---|
2851 | </p><p> |
---|
2852 | |
---|
2853 | |
---|
2854 | </p><p> |
---|
2855 | (*) - <code class="literal">G4Polycone</code>: |
---|
2856 | |
---|
2857 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2858 | <code class="literal">kZAxis</code> - the number of divisions has to be the same as |
---|
2859 | solid sections, (i.e. <code class="literal">numZPlanes-1</code>), the width will |
---|
2860 | <span class="emphasis"><em>not</em></span> be taken into account.</p></li></ul></div><p> |
---|
2861 | </p><p> |
---|
2862 | |
---|
2863 | </p><p> |
---|
2864 | (**) - <code class="literal">G4Polyhedra</code>: |
---|
2865 | |
---|
2866 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2867 | <code class="literal">kPhi</code> - the number of divisions has to be the same as |
---|
2868 | solid sides, (i.e. <code class="literal">numSides</code>), the width will |
---|
2869 | <span class="emphasis"><em>not</em></span> be taken into account. |
---|
2870 | </p></li><li><p> |
---|
2871 | <code class="literal">kZAxis</code> - the number of divisions has to be the same as |
---|
2872 | solid sections, (i.e. <code class="literal">numZPlanes-1</code>), the width will |
---|
2873 | <span class="emphasis"><em>not</em></span> be taken into account. |
---|
2874 | </p></li></ul></div><p> |
---|
2875 | </p><p> |
---|
2876 | |
---|
2877 | </p><p> |
---|
2878 | In the case of division along <code class="literal">kRho</code> of <code class="literal">G4Cons</code>, |
---|
2879 | <code class="literal">G4Polycone</code>, <code class="literal">G4Polyhedra</code>, if width is provided, it |
---|
2880 | is taken as the width at the <code class="literal">-Z</code> radius; the width at other |
---|
2881 | radii will be scaled to this one. |
---|
2882 | </p><p> |
---|
2883 | |
---|
2884 | </p><p> |
---|
2885 | Examples are given below in listings |
---|
2886 | <a href="ch04.html#programlist_Geom.PhysVol_3" title="Example 4.4. |
---|
2887 | An example of Parameterised boxes of different sizes. |
---|
2888 | ">Example 4.4</a> and |
---|
2889 | <a href="ch04.html#programlist_Geom.PhysVol_4" title="Example 4.5. |
---|
2890 | An example of a box division along different axes, with or without offset. |
---|
2891 | ">Example 4.5</a>. |
---|
2892 | |
---|
2893 | </p><div class="example"><a name="programlist_Geom.PhysVol_4"></a><p class="title"><b>Example 4.5. |
---|
2894 | An example of a box division along different axes, with or without offset. |
---|
2895 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
2896 | G4Box* motherSolid = new G4Box("motherSolid", 0.5*m, 0.5*m, 0.5*m); |
---|
2897 | G4LogicalVolume* motherLog = new G4LogicalVolume(motherSolid, material, "mother",0,0,0); |
---|
2898 | G4Para* divSolid = new G4Para("divSolid", 0.512*m, 1.21*m, 1.43*m); |
---|
2899 | G4LogicalVolume* childLog = new G4LogicalVolume(divSolid, material, "child",0,0,0); |
---|
2900 | |
---|
2901 | G4PVDivision divBox1("division along X giving nDiv", |
---|
2902 | childLog, motherLog, kXAxis, 5, 0.); |
---|
2903 | |
---|
2904 | G4PVDivision divBox2("division along X giving width and offset", |
---|
2905 | childLog, motherLog, kXAxis, 0.1*m, 0.45*m); |
---|
2906 | |
---|
2907 | G4PVDivision divBox3("division along X giving nDiv, width and offset", |
---|
2908 | childLog, motherLog, kXAxis, 3, 0.1*m, 0.5*m); |
---|
2909 | </pre></div></div><p><br class="example-break"> |
---|
2910 | |
---|
2911 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2912 | <code class="literal">divBox1</code> is a division of a box along its <code class="literal">X</code> |
---|
2913 | axis in 5 equal copies. Each copy will have a dimension in meters |
---|
2914 | of <code class="literal">[0.2, 1., 1.]</code>. |
---|
2915 | </p></li><li><p> |
---|
2916 | <code class="literal">divBox2</code> is a division of the same box along its |
---|
2917 | <code class="literal">X</code> axis with a width of <code class="literal">0.1</code> meters and |
---|
2918 | an offset of <code class="literal">0.5</code> meters. As the mother dimension along |
---|
2919 | <code class="literal">X</code> of |
---|
2920 | <code class="literal">1</code> meter (<code class="literal">0.5*m</code> of halflength), |
---|
2921 | the division will |
---|
2922 | be sized in total <code class="literal">1 - 0.45 = 0.55</code> meters. Therefore, |
---|
2923 | there's space for 5 copies, the first extending from <code class="literal">-0.05</code> |
---|
2924 | to <code class="literal">0.05</code> meters in the mother's frame and the last from |
---|
2925 | <code class="literal">0.35</code> to <code class="literal">0.45</code> meters. |
---|
2926 | </p></li><li><p> |
---|
2927 | <code class="literal">divBox3</code> is a division of the same box along its |
---|
2928 | <code class="literal">X</code> axis in 3 equal copies of width <code class="literal">0.1</code> |
---|
2929 | meters and an offset of <code class="literal">0.5</code> meters. |
---|
2930 | The first copy will extend from |
---|
2931 | <code class="literal">0.</code> to <code class="literal">0.1</code> meters in the mother's frame |
---|
2932 | and the last from <code class="literal">0.2</code> to <code class="literal">0.3</code> |
---|
2933 | meters. |
---|
2934 | </p></li></ul></div><p> |
---|
2935 | </p><p> |
---|
2936 | |
---|
2937 | </p><div class="example"><a name="programlist_Geom.PhysVol_5"></a><p class="title"><b>Example 4.6. |
---|
2938 | An example of division of a polycone. |
---|
2939 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
2940 | G4double* zPlanem = new G4double[3]; |
---|
2941 | zPlanem[0]= -1.*m; |
---|
2942 | zPlanem[1]= -0.25*m; |
---|
2943 | zPlanem[2]= 1.*m; |
---|
2944 | G4double* rInnerm = new G4double[3]; |
---|
2945 | rInnerm[0]=0.; |
---|
2946 | rInnerm[1]=0.1*m; |
---|
2947 | rInnerm[2]=0.5*m; |
---|
2948 | G4double* rOuterm = new G4double[3]; |
---|
2949 | rOuterm[0]=0.2*m; |
---|
2950 | rOuterm[1]=0.4*m; |
---|
2951 | rOuterm[2]=1.*m; |
---|
2952 | G4Polycone* motherSolid = new G4Polycone("motherSolid", 20.*deg, 180.*deg, |
---|
2953 | 3, zPlanem, rInnerm, rOuterm); |
---|
2954 | G4LogicalVolume* motherLog = new G4LogicalVolume(motherSolid, material, "mother",0,0,0); |
---|
2955 | |
---|
2956 | G4double* zPlaned = new G4double[3]; |
---|
2957 | zPlaned[0]= -3.*m; |
---|
2958 | zPlaned[1]= -0.*m; |
---|
2959 | zPlaned[2]= 1.*m; |
---|
2960 | G4double* rInnerd = new G4double[3]; |
---|
2961 | rInnerd[0]=0.2; |
---|
2962 | rInnerd[1]=0.4*m; |
---|
2963 | rInnerd[2]=0.5*m; |
---|
2964 | G4double* rOuterd = new G4double[3]; |
---|
2965 | rOuterd[0]=0.5*m; |
---|
2966 | rOuterd[1]=0.8*m; |
---|
2967 | rOuterd[2]=2.*m; |
---|
2968 | G4Polycone* divSolid = new G4Polycone("divSolid", 0.*deg, 10.*deg, |
---|
2969 | 3, zPlaned, rInnerd, rOuterd); |
---|
2970 | G4LogicalVolume* childLog = new G4LogicalVolume(divSolid, material, "child",0,0,0); |
---|
2971 | |
---|
2972 | G4PVDivision divPconePhiW("division along phi giving width and offset", |
---|
2973 | childLog, motherLog, kPhi, 30.*deg, 60.*deg); |
---|
2974 | |
---|
2975 | G4PVDivision divPconeZN("division along Z giving nDiv and offset", |
---|
2976 | childLog, motherLog, kZAxis, 2, 0.1*m); |
---|
2977 | </pre></div></div><p><br class="example-break"> |
---|
2978 | |
---|
2979 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
2980 | <code class="literal">divPconePhiW</code> is a division of a polycone along its |
---|
2981 | <code class="literal">phi</code> axis in equal copies of width 30 degrees with an |
---|
2982 | offset of 60 degrees. As the mother extends from 0 to 180 degrees, |
---|
2983 | there's space for 4 copies. All the copies have a starting angle of |
---|
2984 | 20 degrees (as for the mother) and a <code class="literal">phi</code> extension of 30 |
---|
2985 | degrees. They are rotated around the <code class="literal">Z</code> axis by 60 and 30 |
---|
2986 | degrees, so that the first copy will extend from 80 to 110 and the |
---|
2987 | last from 170 to 200 degrees. |
---|
2988 | </p></li><li><p> |
---|
2989 | <code class="literal">divPconeZN</code> is a division of the same polycone along |
---|
2990 | its <code class="literal">Z</code> axis. As the mother polycone has two sections, it |
---|
2991 | will be divided in two one-section polycones, the first one |
---|
2992 | extending from -1 to -0.25 meters, the second from -0.25 to 1 |
---|
2993 | meters. Although specified, the offset will not be used. |
---|
2994 | </p></li></ul></div><p> |
---|
2995 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Touch"></a>4.1.5. |
---|
2996 | Touchables: Uniquely Identifying a Volume |
---|
2997 | </h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Touch.Intro"></a>4.1.5.1. |
---|
2998 | Introduction to Touchables |
---|
2999 | </h4></div></div></div><p> |
---|
3000 | A <span class="emphasis"><em>touchable</em></span> for a volume serves the purpose of providing |
---|
3001 | a unique identification for a detector element. This can be useful |
---|
3002 | for description of the geometry alternative to the one used by the |
---|
3003 | Geant4 tracking system, such as a Sensitive Detectors based |
---|
3004 | read-out geometry, or a parameterised geometry for fast Monte |
---|
3005 | Carlo. In order to create a <span class="emphasis"><em>touchable volume</em></span>, several |
---|
3006 | techniques can be implemented: for example, in Geant4 touchables |
---|
3007 | are implemented as solids associated to a transformation-matrix in |
---|
3008 | the global reference system, or as a hierarchy of physical volumes |
---|
3009 | up to the root of the geometrical tree. |
---|
3010 | </p><p> |
---|
3011 | A touchable is a geometrical entity (volume or solid) which has |
---|
3012 | a unique placement in a detector description. It is represented by |
---|
3013 | an abstract base class which can be implemented in a variety of |
---|
3014 | ways. Each way must provide the capabilities of obtaining the |
---|
3015 | transformation and solid that is described by the touchable. |
---|
3016 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Touch.WhatCan"></a>4.1.5.2. |
---|
3017 | What can a Touchable do? |
---|
3018 | </h4></div></div></div><p> |
---|
3019 | All <code class="literal">G4VTouchable</code> implementations must respond to the |
---|
3020 | two following "requests", where in all cases, by <code class="literal">depth</code> it |
---|
3021 | is meant the number of levels <span class="emphasis"><em>up</em></span> in the tree to be |
---|
3022 | considered (the default and current one is <code class="literal">0</code>): |
---|
3023 | |
---|
3024 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
3025 | <code class="literal">GetTranslation(depth)</code> |
---|
3026 | </p></li><li><p> |
---|
3027 | <code class="literal">GetRotation(depth)</code> |
---|
3028 | </p></li></ol></div><p> |
---|
3029 | |
---|
3030 | that return the components of the volume's transformation. |
---|
3031 | </p><p> |
---|
3032 | Additional capabilities are available from implementations with |
---|
3033 | more information. These have a default implementation that causes |
---|
3034 | an exception. |
---|
3035 | </p><p> |
---|
3036 | Several capabilities are available from touchables with physical |
---|
3037 | volumes: |
---|
3038 | |
---|
3039 | </p><div class="orderedlist"><ol start="3" type="1"><li><p> |
---|
3040 | <code class="literal">GetSolid(depth)</code> gives the solid associated to the |
---|
3041 | touchable. |
---|
3042 | </p></li><li><p> |
---|
3043 | <code class="literal">GetVolume(depth)</code> gives the physical volume. |
---|
3044 | </p></li><li><p> |
---|
3045 | <code class="literal">GetReplicaNumber(depth)</code> or |
---|
3046 | <code class="literal">GetCopyNumber(depth)</code> which return the copy number of the |
---|
3047 | physical volume (replicated or not). |
---|
3048 | </p></li></ol></div><p> |
---|
3049 | </p><p> |
---|
3050 | Touchables that store volume hierarchy (history) have the whole |
---|
3051 | stack of parent volumes available. Thus it is possible to add a |
---|
3052 | little more state in order to extend its functionality. We add a |
---|
3053 | "pointer" to a level and a member function to move the level in |
---|
3054 | this stack. Then calling the above member functions for another |
---|
3055 | level the information for that level can be retrieved. |
---|
3056 | </p><p> |
---|
3057 | The top of the history tree is, by convention, the world |
---|
3058 | volume. |
---|
3059 | |
---|
3060 | </p><div class="orderedlist"><ol start="6" type="1"><li><p> |
---|
3061 | <code class="literal">GetHistoryDepth()</code> gives the depth of the history |
---|
3062 | tree. |
---|
3063 | </p></li><li><p> |
---|
3064 | </p><p> |
---|
3065 | <code class="literal">MoveUpHistory(num)</code> moves the current pointer inside |
---|
3066 | the touchable to point <code class="literal">num</code> levels up the history tree. |
---|
3067 | Thus, e.g., calling it with <code class="literal">num=1</code> will cause the internal |
---|
3068 | pointer to move to the mother of the current volume. |
---|
3069 | </p><p> |
---|
3070 | </p><p> |
---|
3071 | WARNING: this function changes the state of the touchable and can |
---|
3072 | cause errors in tracking if applied to Pre/Post step |
---|
3073 | touchables. |
---|
3074 | </p><p> |
---|
3075 | </p></li></ol></div><p> |
---|
3076 | </p><p> |
---|
3077 | These methods are valid only for the <span class="emphasis"><em>touchable-history</em></span> type, |
---|
3078 | as specified also below. |
---|
3079 | </p><p> |
---|
3080 | An update method, with different arguments is available, so that |
---|
3081 | the information in a touchable can be updated: |
---|
3082 | |
---|
3083 | </p><div class="orderedlist"><ol start="8" type="1"><li><p> |
---|
3084 | <code class="literal">UpdateYourself(vol, history)</code> takes a physical volume |
---|
3085 | pointer and can additionally take a <code class="literal">NavigationHistory</code> |
---|
3086 | pointer. |
---|
3087 | </p></li></ol></div><p> |
---|
3088 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Touch.History"></a>4.1.5.3. |
---|
3089 | Touchable history holds stack of geometry data |
---|
3090 | </h4></div></div></div><p> |
---|
3091 | As shown in Sections |
---|
3092 | <a href="ch04.html#sect.Geom.LogVol" title="4.1.3. |
---|
3093 | Logical Volumes |
---|
3094 | ">Section 4.1.3</a> and <a href="ch04.html#sect.Geom.PhysVol" title="4.1.4. |
---|
3095 | Physical Volumes |
---|
3096 | ">Section 4.1.4</a>, |
---|
3097 | a logical volume represents unpositioned detector elements, and a physical |
---|
3098 | volume can represent multiple detector elements. On the other hand, |
---|
3099 | touchables provide a unique identification for a detector element. |
---|
3100 | In particular, the Geant4 transportation process and the tracking |
---|
3101 | system exploit touchables as implemented in |
---|
3102 | <code class="literal">G4TouchableHistory</code>. The touchable history is the minimal |
---|
3103 | set of information required to specify the full genealogy of a |
---|
3104 | given physical volume (up to the root of the geometrical tree). |
---|
3105 | These touchable volumes are made available to the user at every |
---|
3106 | step of the Geant4 tracking in <code class="literal">G4VUserSteppingAction</code>. |
---|
3107 | </p><p> |
---|
3108 | To create/access a <code class="literal">G4TouchableHistory</code> the user must |
---|
3109 | message <code class="literal">G4Navigator</code> which provides the method |
---|
3110 | <code class="literal">CreateTouchableHistoryHandle()</code>: |
---|
3111 | |
---|
3112 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3113 | G4TouchableHistoryHandle CreateTouchableHistoryHandle() const; |
---|
3114 | </pre></div><p> |
---|
3115 | |
---|
3116 | this will return a handle to the touchable. |
---|
3117 | </p><p> |
---|
3118 | The methods that differentiate the touchable-history from other |
---|
3119 | touchables (since they have meaning only for this type...), |
---|
3120 | are: |
---|
3121 | |
---|
3122 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3123 | G4int GetHistoryDepth() const; |
---|
3124 | G4int MoveUpHistory( G4int num_levels = 1 ); |
---|
3125 | </pre></div><p> |
---|
3126 | </p><p> |
---|
3127 | The first method is used to find out how many levels deep in the |
---|
3128 | geometry tree the current volume is. The second method asks the |
---|
3129 | touchable to eliminate its deepest level. |
---|
3130 | </p><p> |
---|
3131 | As mentioned above, <code class="literal">MoveUpHistory(num)</code> significantly |
---|
3132 | modifies the state of a touchable. |
---|
3133 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Assemb"></a>4.1.6. |
---|
3134 | Creating an Assembly of Volumes |
---|
3135 | </h3></div></div></div><p> |
---|
3136 | <code class="literal">G4AssemblyVolume</code> is a helper class which allows several |
---|
3137 | logical volumes to be combined together in an arbitrary way in 3D |
---|
3138 | space. The result is a placement of a normal logical volume, but |
---|
3139 | where final physical volumes are many. |
---|
3140 | </p><p> |
---|
3141 | However, an <span class="emphasis"><em>assembly</em></span> volume does not act as a real mother |
---|
3142 | volume, being an envelope for its daughter volumes. Its role is |
---|
3143 | over at the time the placement of the logical assembly volume is |
---|
3144 | done. The physical volume objects become independent copies of each |
---|
3145 | of the assembled logical volumes. |
---|
3146 | </p><p> |
---|
3147 | This class is particularly useful when there is a need to create |
---|
3148 | a regular pattern in space of a complex component which consists of |
---|
3149 | different shapes and can't be obtained by using replicated volumes |
---|
3150 | or parametrised volumes (see also <a href="ch04.html#fig.Geom.Assem_1" title="Figure 4.2. |
---|
3151 | Examples of assembly of volumes. |
---|
3152 | ">Figure 4.2</a> |
---|
3153 | reful usage of <code class="literal">G4AssemblyVolume</code> must be considered |
---|
3154 | though, in order to avoid cases of "proliferation" of physical volumes |
---|
3155 | all placed in the same mother. |
---|
3156 | </p><div class="figure"><a name="fig.Geom.Assem_1"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="./AllResources/Detector/geometry.src/avex1and2.jpg" align="middle" alt="Assembly volumes"></div></div><p class="title"><b>Figure 4.2. |
---|
3157 | Examples of <span class="emphasis"><em>assembly</em></span> of volumes. |
---|
3158 | </b></p></div><br class="figure-break"><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Assemb.Fill"></a>4.1.6.1. |
---|
3159 | Filling an assembly volume with its "daughters" |
---|
3160 | </h4></div></div></div><p> |
---|
3161 | Participating logical volumes are represented as a triplet of |
---|
3162 | <logical volume, translation, rotation> |
---|
3163 | (<code class="literal">G4AssemblyTriplet</code> class). |
---|
3164 | </p><p> |
---|
3165 | The adopted approach is to place each participating logical volume |
---|
3166 | with respect to the assembly's coordinate system, according to the |
---|
3167 | specified translation and rotation. |
---|
3168 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Assemb.Place"></a>4.1.6.2. |
---|
3169 | Assembly volume placement |
---|
3170 | </h4></div></div></div><p> |
---|
3171 | An assembly volume object is composed of a set of logical |
---|
3172 | volumes; imprints of it can be made inside a mother logical |
---|
3173 | volume. |
---|
3174 | </p><p> |
---|
3175 | Since the assembly volume class generates physical volumes |
---|
3176 | during each imprint, the user has no way to specify identifiers for |
---|
3177 | these. An internal counting mechanism is used to compose uniquely |
---|
3178 | the names of the physical volumes created by the invoked |
---|
3179 | <code class="literal">MakeImprint(...)</code> method(s). |
---|
3180 | </p><p> |
---|
3181 | The name for each of the physical volume is generated with |
---|
3182 | the following format: |
---|
3183 | |
---|
3184 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3185 | av_<span class="bold"><strong>WWW</strong></span>_impr_<span class="bold"><strong>XXX</strong></span>_<span class="bold"><strong>YYY</strong></span>_<span class="bold"><strong>ZZZ</strong></span> |
---|
3186 | </pre></div><p> |
---|
3187 | |
---|
3188 | where: |
---|
3189 | |
---|
3190 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3191 | <span class="bold"><strong>WWW</strong></span> - assembly volume instance number |
---|
3192 | </p></li><li><p> |
---|
3193 | <span class="bold"><strong>XXX</strong></span> - assembly volume imprint number |
---|
3194 | </p></li><li><p> |
---|
3195 | <span class="bold"><strong>YYY</strong></span> - the name of the placed logical |
---|
3196 | volume |
---|
3197 | </p></li><li><p> |
---|
3198 | <span class="bold"><strong>ZZZ</strong></span> - the logical volume index inside the assembly |
---|
3199 | volume |
---|
3200 | </p></li></ul></div><p> |
---|
3201 | </p><p> |
---|
3202 | It is however possible to access the constituent physical volumes |
---|
3203 | of an assembly and eventually customise ID and copy-number. |
---|
3204 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Assemb.Destruct"></a>4.1.6.3. |
---|
3205 | Destruction of an assembly volume |
---|
3206 | </h4></div></div></div><p> |
---|
3207 | At destruction all the generated physical volumes and associated |
---|
3208 | rotation matrices of the imprints will be destroyed. A list of |
---|
3209 | physical volumes created by <code class="literal">MakeImprint()</code> method is kept, |
---|
3210 | in order to be able to cleanup the objects when not needed anymore. |
---|
3211 | This requires the user to keep the assembly objects in memory |
---|
3212 | during the whole job or during the life-time of the |
---|
3213 | <code class="literal">G4Navigator</code>, logical volume store and physical volume |
---|
3214 | store may keep pointers to physical volumes generated by the |
---|
3215 | assembly volume. |
---|
3216 | </p><p> |
---|
3217 | The <code class="literal">MakeImprint()</code> method will operate correctly also on |
---|
3218 | transformations including reflections and can be applied also to |
---|
3219 | recursive assemblies (i.e., it is possible to generate imprints of |
---|
3220 | assemblies including other assemblies). |
---|
3221 | Giving <code class="literal">true</code> as the last argument of the |
---|
3222 | <code class="literal">MakeImprint()</code> method, |
---|
3223 | it is possible to activate the volumes overlap check for the assembly's |
---|
3224 | constituents (the default is <code class="literal">false</code>). |
---|
3225 | </p><p> |
---|
3226 | At destruction of a <code class="literal">G4AssemblyVolume</code>, all its generated |
---|
3227 | physical volumes and rotation matrices will be freed. |
---|
3228 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Assemb.Example"></a>4.1.6.4. |
---|
3229 | Example |
---|
3230 | </h4></div></div></div><p> |
---|
3231 | This example shows how to use the <code class="literal">G4AssemblyVolume</code> |
---|
3232 | class. It implements a layered detector where each layer consists |
---|
3233 | of 4 plates. |
---|
3234 | </p><p> |
---|
3235 | In the code below, at first the world volume is defined, then |
---|
3236 | solid and logical volume for the plate are created, followed by the |
---|
3237 | definition of the assembly volume for the layer. |
---|
3238 | </p><p> |
---|
3239 | The assembly volume for the layer is then filled by the plates in |
---|
3240 | the same way as normal physical volumes are placed inside a mother |
---|
3241 | volume. |
---|
3242 | </p><p> |
---|
3243 | Finally the layers are placed inside the world volume as the |
---|
3244 | imprints of the assembly volume (see <a href="ch04.html#programlist_Geom.Assem_1" title="Example 4.7. |
---|
3245 | An example of usage of the G4AssemblyVolume class. |
---|
3246 | ">Example 4.7</a>). |
---|
3247 | |
---|
3248 | </p><div class="example"><a name="programlist_Geom.Assem_1"></a><p class="title"><b>Example 4.7. |
---|
3249 | An example of usage of the <code class="literal">G4AssemblyVolume</code> class. |
---|
3250 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
3251 | static unsigned int layers = 5; |
---|
3252 | |
---|
3253 | void TstVADetectorConstruction::ConstructAssembly() |
---|
3254 | { |
---|
3255 | // Define world volume |
---|
3256 | G4Box* WorldBox = new G4Box( "WBox", worldX/2., worldY/2., worldZ/2. ); |
---|
3257 | G4LogicalVolume* worldLV = new G4LogicalVolume( WorldBox, selectedMaterial, "WLog", 0, 0, 0); |
---|
3258 | G4VPhysicalVolume* worldVol = new G4PVPlacement(0, G4ThreeVector(), "WPhys",worldLV, |
---|
3259 | 0, false, 0); |
---|
3260 | |
---|
3261 | // Define a plate |
---|
3262 | G4Box* PlateBox = new G4Box( "PlateBox", plateX/2., plateY/2., plateZ/2. ); |
---|
3263 | G4LogicalVolume* plateLV = new G4LogicalVolume( PlateBox, Pb, "PlateLV", 0, 0, 0 ); |
---|
3264 | |
---|
3265 | // Define one layer as one assembly volume |
---|
3266 | G4AssemblyVolume* assemblyDetector = new G4AssemblyVolume(); |
---|
3267 | |
---|
3268 | // Rotation and translation of a plate inside the assembly |
---|
3269 | G4RotationMatrix Ra; |
---|
3270 | G4ThreeVector Ta; |
---|
3271 | |
---|
3272 | // Rotation of the assembly inside the world |
---|
3273 | G4RotationMatrix Rm; |
---|
3274 | |
---|
3275 | // Fill the assembly by the plates |
---|
3276 | Ta.setX( caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. ); |
---|
3277 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) ); |
---|
3278 | |
---|
3279 | Ta.setX( -1*caloX/4. ); Ta.setY( caloY/4. ); Ta.setZ( 0. ); |
---|
3280 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) ); |
---|
3281 | |
---|
3282 | Ta.setX( -1*caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. ); |
---|
3283 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) ); |
---|
3284 | |
---|
3285 | Ta.setX( caloX/4. ); Ta.setY( -1*caloY/4. ); Ta.setZ( 0. ); |
---|
3286 | assemblyDetector->AddPlacedVolume( plateLV, G4Transform3D(Ta,Ra) ); |
---|
3287 | |
---|
3288 | // Now instantiate the layers |
---|
3289 | for( unsigned int i = 0; i < layers; i++ ) |
---|
3290 | { |
---|
3291 | // Translation of the assembly inside the world |
---|
3292 | G4ThreeVector Tm( 0,0,i*(caloZ + caloCaloOffset) - firstCaloPos ); |
---|
3293 | assemblyDetector->MakeImprint( worldLV, G4Transform3D(Tm,Rm) ); |
---|
3294 | } |
---|
3295 | } |
---|
3296 | </pre></div></div><p><br class="example-break"> |
---|
3297 | </p><p> |
---|
3298 | The resulting detector will look as in <a href="ch04.html#fig.Geom.Assem_2" title="Figure 4.3. |
---|
3299 | The geometry corresponding to the previous example code (An example of usage of the G4AssemblyVolume class). |
---|
3300 | ">Figure 4.3</a>, |
---|
3301 | below: |
---|
3302 | |
---|
3303 | </p><div class="figure"><a name="fig.Geom.Assem_2"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="AllResources/Detector/geometry.src/avpic.jpg" align="middle" alt="Assembly volume detector"></div></div><p class="title"><b>Figure 4.3. |
---|
3304 | The geometry corresponding to the previous example code (An example of usage of the <code class="literal">G4AssemblyVolume</code> class). |
---|
3305 | </b></p></div><p><br class="figure-break"> |
---|
3306 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Reflec"></a>4.1.7. |
---|
3307 | Reflecting Hierarchies of Volumes |
---|
3308 | </h3></div></div></div><p> |
---|
3309 | Hierarchies of volumes based on <span class="emphasis"><em>CSG</em></span> or |
---|
3310 | <span class="emphasis"><em>specific</em></span> solids can be reflected by means of the |
---|
3311 | <code class="literal">G4ReflectionFactory</code> class and <code class="literal">G4ReflectedSolid</code>, |
---|
3312 | which implements a solid that has been shifted from its original |
---|
3313 | reference frame to a new 'reflected' one. The reflection |
---|
3314 | transformation is applied as a decomposition into rotation and |
---|
3315 | translation transformations. |
---|
3316 | </p><p> |
---|
3317 | The factory is a singleton object which provides the following |
---|
3318 | methods: |
---|
3319 | |
---|
3320 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3321 | G4PhysicalVolumesPair Place(const G4Transform3D& transform3D, |
---|
3322 | const G4String& name, |
---|
3323 | G4LogicalVolume* LV, |
---|
3324 | G4LogicalVolume* motherLV, |
---|
3325 | G4bool isMany, |
---|
3326 | G4int copyNo, |
---|
3327 | G4bool surfCheck=false) |
---|
3328 | |
---|
3329 | G4PhysicalVolumesPair Replicate(const G4String& name, |
---|
3330 | G4LogicalVolume* LV, |
---|
3331 | G4LogicalVolume* motherLV, |
---|
3332 | EAxis axis, |
---|
3333 | G4int nofReplicas, |
---|
3334 | G4double width, |
---|
3335 | G4double offset=0) |
---|
3336 | |
---|
3337 | G4PhysicalVolumesPair Divide(const G4String& name, |
---|
3338 | G4LogicalVolume* LV, |
---|
3339 | G4LogicalVolume* motherLV, |
---|
3340 | EAxis axis, |
---|
3341 | G4int nofDivisions, |
---|
3342 | G4double width, |
---|
3343 | G4double offset); |
---|
3344 | </pre></div><p> |
---|
3345 | </p><p> |
---|
3346 | The method <code class="literal">Place()</code> used for placements, evaluates the |
---|
3347 | passed transformation. In case the transformation contains a |
---|
3348 | reflection, the factory will act as follows: |
---|
3349 | |
---|
3350 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
3351 | Performs the transformation decomposition. |
---|
3352 | </p></li><li><p> |
---|
3353 | Creates a new reflected solid and logical volume, or retrieves |
---|
3354 | them from a map if the reflected object was already created. |
---|
3355 | </p></li><li><p> |
---|
3356 | Transforms the daughters (if any) and place them in the given mother. |
---|
3357 | </p></li></ol></div><p> |
---|
3358 | </p><p> |
---|
3359 | If successful, the result is a pair of physical volumes, where the |
---|
3360 | second physical volume is a placement in a reflected mother. |
---|
3361 | Optionally, it is also possible to force the overlaps check at the |
---|
3362 | time of placement, by activating the <code class="literal">surfCheck</code> flag. |
---|
3363 | </p><p> |
---|
3364 | The method <code class="literal">Replicate()</code> creates replicas in the given |
---|
3365 | mother. If successful, the result is a pair of physical volumes, |
---|
3366 | where the second physical volume is a replica in a reflected |
---|
3367 | mother. |
---|
3368 | </p><p> |
---|
3369 | The method <code class="literal">Divide()</code> creates divisions in the given mother. |
---|
3370 | If successful, the result is a pair of physical volumes, where the |
---|
3371 | second physical volume is a division in a reflected mother. There |
---|
3372 | exists also two more variants of this method which may specify or |
---|
3373 | not width or number of divisions. |
---|
3374 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"> |
---|
3375 | Notes |
---|
3376 | </h3><p> |
---|
3377 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3378 | In order to reflect hierarchies containing divided volumes, it |
---|
3379 | is necessary to explicitely instantiate a concrete <span class="emphasis"><em>division</em></span> |
---|
3380 | factory -before- applying the actual reflection: (i.e. - |
---|
3381 | <code class="literal">G4PVDivisionFactory::GetInstance();</code>). |
---|
3382 | </p></li><li><p> |
---|
3383 | Reflection of generic parameterised volumes is not possible yet. |
---|
3384 | </p></li></ul></div><p> |
---|
3385 | </p></div><div class="example"><a name="programlist_Geom.Reflec_1"></a><p class="title"><b>Example 4.8. |
---|
3386 | An example of usage of the |
---|
3387 | <code class="literal">G4ReflectionFactory</code> class.</b></p><div class="example-contents"><pre class="programlisting"> |
---|
3388 | #include "G4ReflectionFactory.hh" |
---|
3389 | |
---|
3390 | // Calor placement with rotation |
---|
3391 | |
---|
3392 | G4double calThickness = 100*cm; |
---|
3393 | G4double Xpos = calThickness*1.5; |
---|
3394 | G4RotationMatrix* rotD3 = new G4RotationMatrix(); |
---|
3395 | rotD3->rotateY(10.*deg); |
---|
3396 | |
---|
3397 | G4VPhysicalVolume* physiCalor = |
---|
3398 | new G4PVPlacement(rotD3, // rotation |
---|
3399 | G4ThreeVector(Xpos,0.,0.), // at (Xpos,0,0) |
---|
3400 | logicCalor, // its logical volume (defined elsewhere) |
---|
3401 | "Calorimeter", // its name |
---|
3402 | logicHall, // its mother volume (defined elsewhere) |
---|
3403 | false, // no boolean operation |
---|
3404 | 0); // copy number |
---|
3405 | |
---|
3406 | // Calor reflection with rotation |
---|
3407 | // |
---|
3408 | G4Translate3D translation(-Xpos, 0., 0.); |
---|
3409 | G4Transform3D rotation = G4Rotate3D(*rotD3); |
---|
3410 | G4ReflectX3D reflection; |
---|
3411 | G4Transform3D transform = translation*rotation*reflection; |
---|
3412 | |
---|
3413 | G4ReflectionFactory::Instance() |
---|
3414 | ->Place(transform, // the transformation with reflection |
---|
3415 | "Calorimeter", // the actual name |
---|
3416 | logicCalor, // the logical volume |
---|
3417 | logicHall, // the mother volume |
---|
3418 | false, // no boolean operation |
---|
3419 | 1, // copy number |
---|
3420 | false); // no overlap check triggered |
---|
3421 | |
---|
3422 | // Replicate layers |
---|
3423 | // |
---|
3424 | G4ReflectionFactory::Instance() |
---|
3425 | ->Replicate("Layer", // layer name |
---|
3426 | logicLayer, // layer logical volume (defined elsewhere) |
---|
3427 | logicCalor, // its mother |
---|
3428 | kXAxis, // axis of replication |
---|
3429 | 5, // number of replica |
---|
3430 | 20*cm); // width of replica |
---|
3431 | </pre></div></div><br class="example-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Navig"></a>4.1.8. |
---|
3432 | The Geometry Navigator |
---|
3433 | </h3></div></div></div><p> |
---|
3434 | Navigation through the geometry at tracking time is implemented |
---|
3435 | by the class <code class="literal">G4Navigator</code>. The navigator is used to locate |
---|
3436 | points in the geometry and compute distances to geometry |
---|
3437 | boundaries. At tracking time, the navigator is intended to be the |
---|
3438 | only point of interaction with tracking. |
---|
3439 | </p><p> |
---|
3440 | Internally, the G4Navigator has several private helper/utility |
---|
3441 | classes: |
---|
3442 | |
---|
3443 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3444 | <span class="bold"><strong>G4NavigationHistory</strong></span> - stores the compounded |
---|
3445 | transformations, replication/parameterisation information, and |
---|
3446 | volume pointers at each level of the hierarchy to the current |
---|
3447 | location. The volume types at each level are also stored - whether |
---|
3448 | normal (placement), replicated or parameterised. |
---|
3449 | </p></li><li><p> |
---|
3450 | <span class="bold"><strong>G4NormalNavigation</strong></span> - provides location & |
---|
3451 | distance computation functions for geometries containing 'placement' |
---|
3452 | volumes, with no voxels. |
---|
3453 | </p></li><li><p> |
---|
3454 | <span class="bold"><strong>G4VoxelNavigation</strong></span> - provides location and distance |
---|
3455 | computation functions for geometries containing 'placement' |
---|
3456 | physical volumes with voxels. Internally a stack of voxel |
---|
3457 | information is maintained. Private functions allow for isotropic |
---|
3458 | distance computation to voxel boundaries and for computation of the |
---|
3459 | 'next voxel' in a specified direction. |
---|
3460 | </p></li><li><p> |
---|
3461 | <span class="bold"><strong>G4ParameterisedNavigation</strong></span> - provides location and |
---|
3462 | distance computation functions for geometries containing |
---|
3463 | parameterised volumes with voxels. Voxel information is maintained |
---|
3464 | similarly to <code class="literal">G4VoxelNavigation</code>, but computation can also |
---|
3465 | be simpler by adopting voxels to be one level deep only |
---|
3466 | (<span class="emphasis"><em>unrefined</em></span>, or 1D optimisation) |
---|
3467 | </p></li><li><p> |
---|
3468 | <span class="bold"><strong>G4ReplicaNavigation</strong></span> - provides location and distance |
---|
3469 | computation functions for replicated volumes. |
---|
3470 | </p></li></ul></div><p> |
---|
3471 | </p><p> |
---|
3472 | In addition, the navigator maintains a set of flags for |
---|
3473 | exiting/entry optimisation. A navigator is not a singleton class; |
---|
3474 | this is mainly to allow a design extension in future (e.g |
---|
3475 | geometrical event biasing). |
---|
3476 | </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Navig.NavigTrack"></a>4.1.8.1. |
---|
3477 | Navigation and Tracking |
---|
3478 | </h4></div></div></div><p> |
---|
3479 | The main functions required for tracking in the geometry are |
---|
3480 | described below. Additional functions are provided to return the |
---|
3481 | net transformation of volumes and for the creation of touchables. |
---|
3482 | None of the functions implicitly requires that the geometry be |
---|
3483 | described hierarchically. |
---|
3484 | |
---|
3485 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3486 | <span class="bold"><strong>SetWorldVolume()</strong></span> |
---|
3487 | </p><p> |
---|
3488 | Sets the first volume in the hierarchy. It must be unrotated and |
---|
3489 | untranslated from the origin. |
---|
3490 | </p><p> |
---|
3491 | </p></li><li><p> |
---|
3492 | <span class="bold"><strong>LocateGlobalPointAndSetup()</strong></span> |
---|
3493 | </p><p> |
---|
3494 | Locates the volume containing the specified global point. This |
---|
3495 | involves a traverse of the hierarchy, requiring the computation of |
---|
3496 | compound transformations, testing replicated and parameterised |
---|
3497 | volumes (etc). To improve efficiency this search may be performed |
---|
3498 | relative to the last, and this is the recommended way of calling |
---|
3499 | the function. A 'relative' search may be used for the first call of |
---|
3500 | the function which will result in the search defaulting to a search |
---|
3501 | from the root node of the hierarchy. Searches may also be performed |
---|
3502 | using a <code class="literal">G4TouchableHistory</code>. |
---|
3503 | </p><p> |
---|
3504 | </p></li><li><p> |
---|
3505 | <span class="bold"><strong>LocateGlobalPointAndUpdateTouchableHandle()</strong></span> |
---|
3506 | </p><p> |
---|
3507 | First, search the geometrical hierarchy like the above method |
---|
3508 | <code class="literal">LocateGlobalPointAndSetup()</code>. Then use the volume found and |
---|
3509 | its navigation history to update the touchable. |
---|
3510 | </p><p> |
---|
3511 | </p></li><li><p> |
---|
3512 | <span class="bold"><strong>ComputeStep()</strong></span> |
---|
3513 | </p><p> |
---|
3514 | Computes the distance to the next boundary intersected along the |
---|
3515 | specified unit direction from a specified point. The point must be |
---|
3516 | have been located prior to calling <code class="literal">ComputeStep()</code>. |
---|
3517 | </p><p> |
---|
3518 | </p><p> |
---|
3519 | When calling <code class="literal">ComputeStep()</code>, a proposed physics step is |
---|
3520 | passed. If it can be determined that the first intersection lies at |
---|
3521 | or beyond that distance then <code class="literal">kInfinity</code> is returned. In any |
---|
3522 | case, if the returned step is greater than the physics step, the |
---|
3523 | physics step must be taken. |
---|
3524 | </p><p> |
---|
3525 | </p></li><li><p> |
---|
3526 | <span class="bold"><strong>SetGeometricallyLimitedStep()</strong></span> |
---|
3527 | </p><p> |
---|
3528 | Informs the navigator that the last computed step was taken in its |
---|
3529 | entirety. This enables entering/exiting optimisation, and should be |
---|
3530 | called prior to calling <code class="literal">LocateGlobalPointAndSetup()</code>. |
---|
3531 | </p><p> |
---|
3532 | </p></li><li><p> |
---|
3533 | <span class="bold"><strong>CreateTouchableHistory()</strong></span> |
---|
3534 | </p><p> |
---|
3535 | Creates a <code class="literal">G4TouchableHistory</code> object, for which the caller |
---|
3536 | has deletion responsibility. The 'touchable' volume is the volume |
---|
3537 | returned by the last Locate operation. The object includes a copy |
---|
3538 | of the current NavigationHistory, enabling the efficient relocation |
---|
3539 | of points in/close to the current volume in the hierarchy. |
---|
3540 | </p><p> |
---|
3541 | </p></li></ul></div><p> |
---|
3542 | </p><p> |
---|
3543 | As stated previously, the navigator makes use of utility classes to |
---|
3544 | perform location and step computation functions. The different |
---|
3545 | navigation utilities manipulate the <code class="literal">G4NavigationHistory</code> |
---|
3546 | object. |
---|
3547 | </p><p> |
---|
3548 | In <code class="literal">LocateGlobalPointAndSetup()</code> the process of locating a |
---|
3549 | point breaks down into three main stages - optimisation, |
---|
3550 | determination that the point is contained with a subtree (mother |
---|
3551 | and daughters), and determination of the actual containing |
---|
3552 | daughter. The latter two can be thought of as scanning first 'up' |
---|
3553 | the hierarchy until a volume that is guaranteed to contain the |
---|
3554 | point is found, and then scanning 'down' until the actual volume |
---|
3555 | that contains the point is found. |
---|
3556 | </p><p> |
---|
3557 | In <code class="literal">ComputeStep()</code> three types of computation are treated |
---|
3558 | depending on the current containing volume: |
---|
3559 | |
---|
3560 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3561 | The volume contains normal (placement) daughters (or none) |
---|
3562 | </p></li><li><p> |
---|
3563 | The volume contains a single parameterised volume object, |
---|
3564 | representing many volumes |
---|
3565 | </p></li><li><p> |
---|
3566 | The volume is a replica and contains normal (placement) daughters |
---|
3567 | </p></li></ul></div><p> |
---|
3568 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Navig.LocPnt"></a>4.1.8.2. |
---|
3569 | Using the navigator to locate points |
---|
3570 | </h4></div></div></div><p> |
---|
3571 | More than one navigator objects can be created inside an application; these |
---|
3572 | navigators can act independently for different purposes. The main navigator |
---|
3573 | which is "<span class="emphasis"><em>activated</em></span> automatically at the startup of a |
---|
3574 | simulation program is the navigator used for the |
---|
3575 | <span class="emphasis"><em>tracking</em></span> and attached the world volume |
---|
3576 | of the main tracking (or <span class="emphasis"><em>mass</em></span>) geometry. |
---|
3577 | </p><p> |
---|
3578 | The navigator for tracking can be retrieved at any state of the application |
---|
3579 | by messagging the <code class="literal">G4TransportationManager</code>: |
---|
3580 | |
---|
3581 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3582 | G4Navigator* tracking_navigator = |
---|
3583 | G4TransportationManager::GetInstance()->GetNavigatorForTracking(); |
---|
3584 | </pre></div><p> |
---|
3585 | |
---|
3586 | The navigator for tracking also retains all the information of the current |
---|
3587 | history of volumes transversed at a precise moment of the tracking during a |
---|
3588 | run. Therefore, if the navigator for tracking is used during tracking for |
---|
3589 | locating a generic point in the tree of volumes, the actual particle gets |
---|
3590 | also -relocated- in the specified position and tracking will be of course |
---|
3591 | affected ! |
---|
3592 | </p><p> |
---|
3593 | In order to avoid the problem above and provide information about location |
---|
3594 | of a point without affecting the tracking, it is suggested to either use an |
---|
3595 | alternative <code class="literal">G4Navigator</code> object (which can then be assigned |
---|
3596 | to the world-volume), or access the information through the step. |
---|
3597 | </p><h5><a name="id405028"></a> |
---|
3598 | Using the 'step' to retrieve geometrical information |
---|
3599 | </h5><p> |
---|
3600 | During the tracking run, geometrical information can be retrieved through |
---|
3601 | the touchable handle associated to the current step. For example, to identify |
---|
3602 | the exact copy-number of a specific physical volume in the mass geometry, |
---|
3603 | one should do the following: |
---|
3604 | |
---|
3605 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3606 | // Given the pointer to the step object ... |
---|
3607 | // |
---|
3608 | G4Step* aStep = ..; |
---|
3609 | |
---|
3610 | // ... retrieve the 'pre-step' point |
---|
3611 | // |
---|
3612 | G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); |
---|
3613 | |
---|
3614 | // ... retrieve a touchable handle and access to the information |
---|
3615 | // |
---|
3616 | G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle(); |
---|
3617 | G4int copyNo = theTouchable->GetCopyNumber(); |
---|
3618 | G4int motherCopyNo = theTouchable->GetCopyNumber(1); |
---|
3619 | </pre></div><p> |
---|
3620 | </p><p> |
---|
3621 | To determine the exact position in global coordinates in the mass geometry |
---|
3622 | and convert to local coordinates (local to the current volume): |
---|
3623 | |
---|
3624 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3625 | G4ThreeVector worldPosition = preStepPoint->GetPosition(); |
---|
3626 | G4ThreeVector localPosition = theTouchable->GetHistory()-> |
---|
3627 | GetTopTransform().TransformPoint(worldPosition); |
---|
3628 | </pre></div><p> |
---|
3629 | </p><h5><a name="id405073"></a> |
---|
3630 | Using an alternative navigator to locate points |
---|
3631 | </h5><p> |
---|
3632 | In order to know (when in the <code class="literal">idle</code> state of the |
---|
3633 | application) in which physical volume a given point is located |
---|
3634 | in the detector geometry, it is necessary to create an alternative |
---|
3635 | navigator object first and assign it to the world volume: |
---|
3636 | |
---|
3637 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3638 | G4Navigator* aNavigator = new G4Navigator(); |
---|
3639 | aNavigator->SetWorldVolume(worldVolumePointer); |
---|
3640 | </pre></div><p> |
---|
3641 | </p><p> |
---|
3642 | Then, locate the point <code class="literal">myPoint</code> (defined in global coordinates), |
---|
3643 | retrieve a <span class="emphasis"><em>touchable handle</em></span> and do whatever you need with it: |
---|
3644 | |
---|
3645 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3646 | aNavigator->LocateGlobalPointAndSetup(myPoint); |
---|
3647 | G4TouchableHistoryHandle aTouchable = |
---|
3648 | aNavigator->CreateTouchableHistoryHandle(); |
---|
3649 | |
---|
3650 | // Do whatever you need with it ... |
---|
3651 | // ... convert point in local coordinates (local to the current volume) |
---|
3652 | // |
---|
3653 | G4ThreeVector localPosition = aTouchable->GetHistory()-> |
---|
3654 | GetTopTransform().TransformPoint(myPoint); |
---|
3655 | |
---|
3656 | // ... convert back to global coordinates system |
---|
3657 | G4ThreeVector globalPosition = aTouchable->GetHistory()-> |
---|
3658 | GetTopTransform().Inverse().TransformPoint(localPosition); |
---|
3659 | </pre></div><p> |
---|
3660 | </p><p> |
---|
3661 | If outside of the tracking run and given a generic local position (local to a |
---|
3662 | given volume in the geometry tree), it is -not- possible to determine a priori |
---|
3663 | its global position and convert it to the global coordinates system. |
---|
3664 | The reason for this is rather simple, nobody can guarantee that the given |
---|
3665 | (local) point is located in the right -copy- of the physical volume ! |
---|
3666 | In order to retrieve this information, some extra knowledge related to the |
---|
3667 | absolute position of the physical volume is required first, i.e. one should |
---|
3668 | first determine a global point belonging to that volume, eventually making |
---|
3669 | a dedicated scan of the geometry tree through a dedicated |
---|
3670 | <code class="literal">G4Navigator</code> object and then apply the method above after |
---|
3671 | having created the touchable for it. |
---|
3672 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Navig.ParaGeom"></a>4.1.8.3. |
---|
3673 | Navigation in parallel geometries |
---|
3674 | </h4></div></div></div><p> |
---|
3675 | Since release 8.2 of Geant4, it is possible to define geometry trees which |
---|
3676 | are <code class="literal">parallel</code> to the tracking geometry and having them |
---|
3677 | assigned to navigator objects that transparently communicate in sync with |
---|
3678 | the normal tracking geometry. |
---|
3679 | </p><p> |
---|
3680 | Parallel geometries can be defined for several uses (fast shower |
---|
3681 | parameterisation, geometrical biasing, particle scoring, readout |
---|
3682 | geometries, etc ...) and can <span class="emphasis"><em>overlap</em></span> with the mass |
---|
3683 | geometry defined for the tracking. The <code class="literal">parallel</code> |
---|
3684 | transportation will be activated only after the registration of the |
---|
3685 | parallel geometry in the detector description |
---|
3686 | setup; see Section <a href="ch04s07.html" title="4.7. |
---|
3687 | Parallel Geometries |
---|
3688 | ">Section 4.7</a> for how to define a parallel |
---|
3689 | geometry and register it to the run-manager. |
---|
3690 | </p><p> |
---|
3691 | The <code class="literal">G4TransportationManager</code> provides all the utilities to verify, |
---|
3692 | retrieve and activate the navigators associated to the various parallel |
---|
3693 | geometries defined. |
---|
3694 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Navig.PhantomGeom"></a>4.1.8.4. |
---|
3695 | Fast navigation in regular patterned geometries and phantoms |
---|
3696 | </h4></div></div></div><p> |
---|
3697 | Since release 9.1 of Geant4, a specialised navigation algorithm has |
---|
3698 | been introduced to allow for optimal memory use and extremely efficient |
---|
3699 | navigation in geometries represented by a regular pattern of volumes |
---|
3700 | and particularly three-dimensional grids of boxes. A typical application |
---|
3701 | of this kind is the case of a DICOM phantoms for medical physics studies. |
---|
3702 | </p><p> |
---|
3703 | The class <code class="literal">G4RegularNavigation</code> is used and automatically |
---|
3704 | activated when such geometries are defined. It is required to the user to |
---|
3705 | implement a parameterisation of the kind <code class="literal">G4PhantomParameterisation</code> |
---|
3706 | and place the parameterised volume containing it in a container volume, so that |
---|
3707 | all cells in the three-dimensional grid (<span class="emphasis"><em>voxels</em></span>) completely |
---|
3708 | fill the container volume. |
---|
3709 | This way the location of a point inside a voxel can be done in a fast way, |
---|
3710 | transforming the position to the coordinate system of the container volume |
---|
3711 | and doing a simple calculation of the kind: |
---|
3712 | |
---|
3713 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3714 | copyNo_x = (localPoint.x()+fVoxelHalfX*fNoVoxelX)/(fVoxelHalfX*2.) |
---|
3715 | </pre></div><p> |
---|
3716 | |
---|
3717 | where <code class="literal">fVoxelHalfX</code> is the half dimension of the voxel along |
---|
3718 | <code class="literal">X</code> and <code class="literal">fNoVoxelX</code> is the number of voxels |
---|
3719 | in the <code class="literal">X</code> dimension. |
---|
3720 | Voxel <code class="literal">0</code> will be the one closest to the corner |
---|
3721 | <code class="literal">(fVoxelHalfX*fNoVoxelX, fVoxelHalfY*fNoVoxelY, fVoxelHalfZ*fNoVoxelZ)</code>. |
---|
3722 | </p><p> |
---|
3723 | Having the voxels filling completely the container volume allows to avoid |
---|
3724 | the lengthy computation of <code class="literal">ComputeStep()</code> and |
---|
3725 | <code class="literal">ComputeSafety</code> methods required in the traditional |
---|
3726 | navigation algorithm. |
---|
3727 | In this case, when a track is inside the parent volume, it has always to |
---|
3728 | be inside one of the voxels and it will be only necessary to calculate |
---|
3729 | the distance to the walls of the current voxel. |
---|
3730 | </p><h5><a name="id405313"></a> |
---|
3731 | Skipping borders of voxels with same material |
---|
3732 | </h5><p> |
---|
3733 | Another speed optimisation can be provided by skipping the frontiers |
---|
3734 | of two voxels which the same material assigned, so that bigger steps |
---|
3735 | can be done. This optimisation may be not very useful when the number of |
---|
3736 | materials is very big (in which case the probability of having contiguous |
---|
3737 | voxels with same material is reduced), or when the physical step is small |
---|
3738 | compared to the voxel dimensions (very often the case of electrons). |
---|
3739 | The optimisation can be switched off in such cases, by invoking the |
---|
3740 | following method with argument <code class="literal">skip = 0</code>: |
---|
3741 | |
---|
3742 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3743 | G4RegularParameterisation::SetSkipEqualMaterials( G4bool skip ); |
---|
3744 | </pre></div><p> |
---|
3745 | </p><h5><a name="id405344"></a> |
---|
3746 | Example |
---|
3747 | </h5><p> |
---|
3748 | To use the specialised navigation, it is required to first create an object |
---|
3749 | of type <code class="literal">G4PhantomParameterisation</code>: |
---|
3750 | |
---|
3751 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3752 | G4PhantomParameterisation* param = new G4PhantomParameterisation(); |
---|
3753 | </pre></div><p> |
---|
3754 | |
---|
3755 | Then, fill it with the all the necessary data: |
---|
3756 | |
---|
3757 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3758 | // Voxel dimensions in the three dimensions |
---|
3759 | // |
---|
3760 | G4double halfX = ...; |
---|
3761 | G4double halfY = ...; |
---|
3762 | G4double halfZ = ...; |
---|
3763 | param->SetVoxelDimensions( halfX, halfY, halfZ ); |
---|
3764 | |
---|
3765 | // Number of voxels in the three dimensions |
---|
3766 | // |
---|
3767 | G4int nVoxelX = ...; |
---|
3768 | G4int nVoxelY = ...; |
---|
3769 | G4int nVoxelZ = ...; |
---|
3770 | param->SetNoVoxel( nVoxelX, nVoxelY, nVoxelZ ); |
---|
3771 | |
---|
3772 | // Vector of materials of the voxels |
---|
3773 | // |
---|
3774 | std::vector < G4Material* > theMaterials; |
---|
3775 | theMaterials.push_back( new G4Material( ... |
---|
3776 | theMaterials.push_back( new G4Material( ... |
---|
3777 | param->SetMaterials( theMaterials ); |
---|
3778 | |
---|
3779 | // List of material indices |
---|
3780 | // For each voxel it is a number that correspond to the index of its |
---|
3781 | // material in the vector of materials defined above; |
---|
3782 | // |
---|
3783 | size_t* mateIDs = new size_t[nVoxelX*nVoxelY*nVoxelZ]; |
---|
3784 | mateIDs[0] = n0; |
---|
3785 | mateIDs[1] = n1; |
---|
3786 | ... |
---|
3787 | param->SetMaterialIndices( mateIDs ); |
---|
3788 | </pre></div><p> |
---|
3789 | |
---|
3790 | Then, define the volume that contains all the voxels: |
---|
3791 | |
---|
3792 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3793 | G4Box* cont_solid = new G4Box("PhantomContainer",nVoxelX*halfX.,nVoxelY*halfY.,nVoxelZ*halfZ); |
---|
3794 | G4LogicalVolume* cont_logic = |
---|
3795 | new G4LogicalVolume( cont_solid, |
---|
3796 | matePatient, // material is not relevant here... |
---|
3797 | "PhantomContainer", |
---|
3798 | 0, 0, 0 ); |
---|
3799 | G4VPhysicalVolume * cont_phys = |
---|
3800 | new G4PVPlacement(rotm, // rotation |
---|
3801 | pos, // translation |
---|
3802 | cont_logic, // logical volume |
---|
3803 | "PhantomContainer", // name |
---|
3804 | world_logic, // mother volume |
---|
3805 | false, // No op. bool. |
---|
3806 | 1); // Copy number |
---|
3807 | |
---|
3808 | </pre></div><p> |
---|
3809 | |
---|
3810 | The physical volume should be assigned as the container volume of the |
---|
3811 | parameterisation: |
---|
3812 | |
---|
3813 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3814 | param->BuildContainerSolid(cont_phys); |
---|
3815 | |
---|
3816 | // Assure that the voxels are completely filling the container volume |
---|
3817 | // |
---|
3818 | param->CheckVoxelsFillContainer( cont_solid->GetXHalfLength(), |
---|
3819 | cont_solid->GetyHalfLength(), |
---|
3820 | cont_solid->GetzHalfLength() ); |
---|
3821 | |
---|
3822 | // The parameterised volume which uses this parameterisation is placed |
---|
3823 | // in the container logical volume |
---|
3824 | // |
---|
3825 | G4PVParameterised * patient_phys = |
---|
3826 | new G4PVParameterised("Patient", // name |
---|
3827 | patient_logic, // logical volume |
---|
3828 | cont_logic, // mother volume |
---|
3829 | kXAxis, // optimisation hint |
---|
3830 | nVoxelX*nVoxelY*nVoxelZ, // number of voxels |
---|
3831 | param); // parameterisation |
---|
3832 | |
---|
3833 | // Indicate that this physical volume is having a regular structure |
---|
3834 | // |
---|
3835 | patient_phys->SetRegularStructureId(1); |
---|
3836 | </pre></div><p> |
---|
3837 | </p> |
---|
3838 | |
---|
3839 | An example showing the application of the optimised navigation algorithm |
---|
3840 | for phantoms geometries is available in |
---|
3841 | <code class="literal">examples/extended/medical/DICOM</code>. It implements a real |
---|
3842 | application for reading <code class="literal">DICOM</code> images and convert them to |
---|
3843 | Geant4 geometries with defined materials and densities, allowing for |
---|
3844 | different implementation solutions to be chosen (non optimised, classical |
---|
3845 | 3D optimisation, nested parameterisations and use of |
---|
3846 | <code class="literal">G4PhantomParameterisation</code>). |
---|
3847 | |
---|
3848 | </div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Navig.RunTime"></a>4.1.8.5. |
---|
3849 | Run-time commands |
---|
3850 | </h4></div></div></div><p> |
---|
3851 | When running in <span class="emphasis"><em>verbose</em></span> mode (i.e. the default, |
---|
3852 | <code class="literal">G4VERBOSE</code> set while installing the Geant4 kernel |
---|
3853 | libraries), the navigator provides a few commands to control its |
---|
3854 | behavior. It is possible to select different verbosity levels (up |
---|
3855 | to 5), with the command: |
---|
3856 | |
---|
3857 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3858 | geometry/navigator/verbose [verbose_level] |
---|
3859 | </pre></div><p> |
---|
3860 | |
---|
3861 | or to force the navigator to run in <span class="emphasis"><em>check</em></span> mode: |
---|
3862 | |
---|
3863 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3864 | geometry/navigator/check_mode [true/false] |
---|
3865 | </pre></div><p> |
---|
3866 | </p><p> |
---|
3867 | The latter will force more strict and less tolerant checks in |
---|
3868 | step/safety computation to verify the correctness of the solids' |
---|
3869 | response in the geometry. |
---|
3870 | </p><p> |
---|
3871 | By combining <span class="emphasis"><em>check_mode</em></span> with verbosity level-1, additional |
---|
3872 | verbosity checks on the response from the solids can be activated. |
---|
3873 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Tolerance"></a>4.1.8.6. |
---|
3874 | Setting Geometry Tolerance to be relative |
---|
3875 | </h4></div></div></div><p> |
---|
3876 | The tolerance value defining the accuracy of tracking on the surfaces |
---|
3877 | is by default set to a reasonably small value of <span class="emphasis"><em>10E-9 mm</em></span>. |
---|
3878 | Such accuracy may be however redundant for use on simulation of detectors |
---|
3879 | of big size or macroscopic dimensions. Since release 9.0, it is possible to |
---|
3880 | specify the surface tolerance to be relative to the extent of the world volume |
---|
3881 | defined for containing the geometry setup. |
---|
3882 | </p><p> |
---|
3883 | The class <code class="literal">G4GeometryManager</code> can be used to activate |
---|
3884 | the computation of the surface tolerance to be relative to the geometry |
---|
3885 | setup which has been defined. It can be done this way: |
---|
3886 | |
---|
3887 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3888 | G4GeometryManager::GetInstance()->SetWorldMaximumExtent(WorldExtent); |
---|
3889 | </pre></div><p> |
---|
3890 | |
---|
3891 | where, <code class="literal">WorldExtent</code> is the actual maximum extent of the |
---|
3892 | world volume used for placing the whole geometry setup. |
---|
3893 | </p><p> |
---|
3894 | Such call to <code class="literal">G4GeometryManager</code> must be done |
---|
3895 | <span class="bold"><strong>before</strong></span> defining any geometrical component of |
---|
3896 | the setup (solid shape or volume), and can be done only |
---|
3897 | <span class="bold"><strong>once</strong></span> ! |
---|
3898 | </p><p> |
---|
3899 | The class <code class="literal">G4GeometryTolerance</code> is to be used for retrieving the |
---|
3900 | actual values defined for tolerances, surface (Cartesian), angular or radial |
---|
3901 | respectively: |
---|
3902 | |
---|
3903 | </p><div class="informalexample"><pre class="programlisting"> |
---|
3904 | G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); |
---|
3905 | G4GeometryTolerance::GetInstance()->GetAngularTolerance(); |
---|
3906 | G4GeometryTolerance::GetInstance()->GetRadialTolerance(); |
---|
3907 | </pre></div><p> |
---|
3908 | |
---|
3909 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Edit"></a>4.1.9. |
---|
3910 | A Simple Geometry Editor |
---|
3911 | </h3></div></div></div><p> |
---|
3912 | GGE is the Geant4 Graphical Geometry Editor. It is implemented |
---|
3913 | in JAVA and is part of the Momo environment. GGE aims to serve |
---|
3914 | physicists who have a little knowledge of C++ and the Geant4 |
---|
3915 | toolkit to construct his or her own detector geometry in a |
---|
3916 | graphical manner. |
---|
3917 | </p><p> |
---|
3918 | GGE provides methods to: |
---|
3919 | |
---|
3920 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
3921 | construct a detector geometry including <code class="literal">G4Element</code>, |
---|
3922 | <code class="literal">G4Material</code>, <code class="literal">G4Solids</code>, |
---|
3923 | <code class="literal">G4LogicalVolume</code>, |
---|
3924 | <code class="literal">G4PVPlacement</code>, etc. |
---|
3925 | </p></li><li><p> |
---|
3926 | view the detector geometry using existing visualization system like DAWN |
---|
3927 | </p></li><li><p> |
---|
3928 | keep the detector object in a persistent way |
---|
3929 | </p></li><li><p> |
---|
3930 | produce corresponding C++ codes after the norm of Geant4 toolkit |
---|
3931 | </p></li><li><p> |
---|
3932 | make a Geant4 executable under adequate environment |
---|
3933 | </p></li></ol></div><p> |
---|
3934 | </p><p> |
---|
3935 | GGE is implemented with Java, using Java Foundation Class, |
---|
3936 | Swing-1.0.2. In essence, GGE is made a set of tables which contain |
---|
3937 | all relevant parameters to construct a simple detector |
---|
3938 | geometry. |
---|
3939 | </p><p> |
---|
3940 | The software, installation instructions and notes for GGE and other |
---|
3941 | JAVA-based UI tools can be freely downloaded from the |
---|
3942 | <a href="http://erpc1.naruto-u.ac.jp/~geant4/" target="_top"> |
---|
3943 | Geant4 GUI and Environments web site |
---|
3944 | </a> |
---|
3945 | of Naruto University of Education in Japan. |
---|
3946 | </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.Mate"></a>4.1.9.1. |
---|
3947 | Materials: elements and mixtures |
---|
3948 | </h4></div></div></div><p> |
---|
3949 | GGE provides the database of elements in a form of the periodic |
---|
3950 | table, which users can use to construct new materials. GGE provides |
---|
3951 | a pre-constructed database of materials taken from the PDG book. |
---|
3952 | They can be loaded, used, edited and saved as persistent |
---|
3953 | objects. |
---|
3954 | </p><p> |
---|
3955 | Users can also create new materials either from scratch or by |
---|
3956 | combining other materials. |
---|
3957 | |
---|
3958 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
3959 | creating a material from scratch: |
---|
3960 | </p><p> |
---|
3961 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody><tr><td>Use</td><td>Name</td><td>A</td><td>Z</td><td>Density</td><td>Unit</td><td>State</td><td>Temperature</td><td>Unit</td><td>Pressure</td><td>Unit</td></tr></tbody></table></div><p> |
---|
3962 | </p><p> |
---|
3963 | </p><p> |
---|
3964 | Only the elements and materials used in the logical volumes are |
---|
3965 | kept in the detector object and are used to generate C++ |
---|
3966 | constructors. <span class="bold"><strong>Use</strong></span> marks the used materials. |
---|
3967 | </p><p> |
---|
3968 | </p></li><li><p> |
---|
3969 | Constructor to create a material from a combination of |
---|
3970 | elements, subsequently added via <code class="literal">AddElement</code> |
---|
3971 | </p><p> |
---|
3972 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody><tr><td>Use</td><td>Name</td><td>Elements</td><td>Density</td><td>Unit</td><td>State</td><td>Temperature</td><td>Unit</td><td>Pressure</td><td>Unit</td></tr></tbody></table></div><p> |
---|
3973 | </p><p> |
---|
3974 | |
---|
3975 | </p><p> |
---|
3976 | By clicking the column <span class="bold"><strong>Elements</strong></span>, a new |
---|
3977 | window is open to select one of two methods: |
---|
3978 | |
---|
3979 | </p><div class="itemizedlist"><ul type="circle" compact><li><p> |
---|
3980 | Add an element, giving fraction by weight |
---|
3981 | </p></li><li><p> |
---|
3982 | Add an element, giving number of atoms. |
---|
3983 | </p></li></ul></div><p> |
---|
3984 | </p><p> |
---|
3985 | </p></li></ul></div><p> |
---|
3986 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.Solids"></a>4.1.9.2. |
---|
3987 | Solids |
---|
3988 | </h4></div></div></div><p> |
---|
3989 | The most popular CSG solids (<code class="literal">G4Box</code>, <code class="literal">G4Tubs</code>, |
---|
3990 | <code class="literal">G4Cons</code>, <code class="literal">G4Trd</code>) and specific BREPs solids |
---|
3991 | (Pcons, Pgons) are supported at present. All related parameters of such a |
---|
3992 | solid can be specified in a parameter widget. |
---|
3993 | </p><p> |
---|
3994 | Users will be able to view each solid using DAWN. |
---|
3995 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.LogVol"></a>4.1.9.3. |
---|
3996 | Logical Volume |
---|
3997 | </h4></div></div></div><p> |
---|
3998 | GGE can specify the following items: |
---|
3999 | |
---|
4000 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col></colgroup><tbody><tr><td>Name</td><td>Solid</td><td>Material</td><td>VisAttribute</td></tr></tbody></table></div><p> |
---|
4001 | </p><p> |
---|
4002 | The construction and assignment of appropriate entities for |
---|
4003 | <code class="literal">G4FieldManager</code> and <code class="literal">G4VSensitiveDetector</code> |
---|
4004 | are left to the user. |
---|
4005 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.PhysVol"></a>4.1.9.4. |
---|
4006 | Physical Volume |
---|
4007 | </h4></div></div></div><p> |
---|
4008 | A single copy of a physical volume can be created. Also repeated |
---|
4009 | copies can be created in several manners. First, a user can |
---|
4010 | translate the logical volume linearly. |
---|
4011 | |
---|
4012 | </p><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody><tr><td>Name</td><td>LogicalVolume</td><td>MotherVolume</td><td>Many</td><td>X0, Y0, Z0</td><td>Direction</td><td>StepSize</td><td>Unit</td><td>CopyNumber</td></tr></tbody></table></div><p> |
---|
4013 | </p><p> |
---|
4014 | Combined translation and rotation are also possible, placing an |
---|
4015 | object repeatedly on a ``cylindrical'' pattern. Simple models of |
---|
4016 | replicas and parametrised volume are also implemented. In the |
---|
4017 | replicas, a volume is slices to create new sub-volumes. In |
---|
4018 | parametrised volumes, several patterns of volumes can be |
---|
4019 | created. |
---|
4020 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.GeneCode"></a>4.1.9.5. |
---|
4021 | Generation of C++ code: <code class="literal">MyDetectorConstruction.cc</code> |
---|
4022 | </h4></div></div></div><p> |
---|
4023 | By simply pushing a button, source code in the form of an |
---|
4024 | include file and a source file are created. They are called |
---|
4025 | <code class="literal">MyDetectorConstruction.cc</code> and <code class="literal">.hh</code> files. |
---|
4026 | They reflect all current user modifications in real-time. |
---|
4027 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Edit.Vis"></a>4.1.9.6. |
---|
4028 | Visualization |
---|
4029 | </h4></div></div></div><p> |
---|
4030 | Examples of individual solids can be viewed with the help of |
---|
4031 | DAWN. The visualization of the whole geometry is be done after the |
---|
4032 | compilation of the source code <code class="literal">MyDetectorConstruction.cc</code> |
---|
4033 | with appropriate parts of Geant4. (In particular only the geometry |
---|
4034 | and visualization, together with the small other parts they depend |
---|
4035 | on, are needed.) |
---|
4036 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.ConvGeom"></a>4.1.10. |
---|
4037 | Converting Geometries from Geant3.21 |
---|
4038 | </h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.ConvGeom.App"></a>4.1.10.1. |
---|
4039 | Approach |
---|
4040 | </h4></div></div></div><p> |
---|
4041 | <span class="bold"><strong>G3toG4</strong></span> is the Geant4 facility to convert |
---|
4042 | GEANT 3.21 geometries into Geant4. This is done in two stages: |
---|
4043 | |
---|
4044 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
4045 | The user supplies a GEANT 3.21 RZ-file (.rz) containing the |
---|
4046 | initialization data structures. An executable <code class="literal">rztog4</code> reads |
---|
4047 | this file and produces an ASCII <span class="emphasis"><em>call list</em></span> file containing |
---|
4048 | instructions on how to build the geometry. The source code of |
---|
4049 | <code class="literal">rztog4</code> is FORTRAN. |
---|
4050 | </p></li><li><p> |
---|
4051 | A call list interpreter (<code class="literal">G4BuildGeom.cc</code>) reads these |
---|
4052 | instructions and builds the geometry in the user's client code for |
---|
4053 | Geant4. |
---|
4054 | </p></li></ol></div><p> |
---|
4055 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.ConvGeom.Import"></a>4.1.10.2. |
---|
4056 | Importing converted geometries into Geant4 |
---|
4057 | </h4></div></div></div><p> |
---|
4058 | Two examples of how to use the call list interpreter are |
---|
4059 | supplied in the directory <code class="literal">examples/extended/g3tog4</code>: |
---|
4060 | |
---|
4061 | </p><div class="orderedlist"><ol type="1" compact><li><p> |
---|
4062 | <code class="literal">cltog4</code> is a simple example which simply invokes the |
---|
4063 | call list interpreter method <code class="literal">G4BuildGeom</code> from the |
---|
4064 | <code class="literal">G3toG4DetectorConstruction</code> class, builds the geometry and |
---|
4065 | exits. |
---|
4066 | </p></li><li><p> |
---|
4067 | <code class="literal">clGeometry</code>, is more complete and is patterned as for |
---|
4068 | the novice Geant4 examples. It also invokes the call list |
---|
4069 | interpreter, but in addition, allows the geometry to be visualized |
---|
4070 | and particles to be tracked. |
---|
4071 | </p></li></ol></div><p> |
---|
4072 | </p><p> |
---|
4073 | To compile and build the G3toG4 libraries, you need to have set in |
---|
4074 | your environment the variable <code class="literal">G4LIB_BUILD_G3TOG4</code> at the |
---|
4075 | time of installation. The G3toG4 libraries are not built by |
---|
4076 | default. Then, simply type |
---|
4077 | |
---|
4078 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4079 | gmake |
---|
4080 | </pre></div><p> |
---|
4081 | |
---|
4082 | from the top-level <code class="literal">source/g3tog4</code> directory. |
---|
4083 | </p><p> |
---|
4084 | To build the converter executable <code class="literal">rztog4</code>, simply |
---|
4085 | type |
---|
4086 | |
---|
4087 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4088 | gmake bin |
---|
4089 | </pre></div><p> |
---|
4090 | </p><p> |
---|
4091 | To make everything, simply type: |
---|
4092 | |
---|
4093 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4094 | gmake global |
---|
4095 | </pre></div><p> |
---|
4096 | </p><p> |
---|
4097 | To remove all <code class="literal">G3toG4</code> libraries, executables and .d files, |
---|
4098 | simply type |
---|
4099 | |
---|
4100 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4101 | gmake clean |
---|
4102 | </pre></div><p> |
---|
4103 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.ConvGeom.Curr"></a>4.1.10.3. |
---|
4104 | Current Status |
---|
4105 | </h4></div></div></div><p> |
---|
4106 | The package has been tested with the geometries from experiments |
---|
4107 | like: BaBar, CMS, Atlas, Alice, Zeus, L3, and Opal. |
---|
4108 | </p><p> |
---|
4109 | Here is a comprehensive list of features supported and not |
---|
4110 | supported or implemented in the current version of the package: |
---|
4111 | |
---|
4112 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
4113 | Supported shapes: all GEANT 3.21 shapes except for |
---|
4114 | <code class="literal">GTRA</code>, <code class="literal">CTUB</code>. |
---|
4115 | </p></li><li><p> |
---|
4116 | <code class="literal">PGON</code>, <code class="literal">PCON</code> are built using the |
---|
4117 | <span class="emphasis"><em>specific</em></span> solids <code class="literal">G4Polycone</code> and |
---|
4118 | <code class="literal">G4Polyhedra</code>. |
---|
4119 | </p></li><li><p> |
---|
4120 | GEANT 3.21 <code class="literal">MANY</code> feature is only partially |
---|
4121 | supported. |
---|
4122 | <code class="literal">MANY</code> positions are resolved in the |
---|
4123 | <code class="literal">G3toG4MANY()</code> function, which has to be processed before |
---|
4124 | <code class="literal">G3toG4BuildTree()</code> (it is not called by default). |
---|
4125 | In order to resolve <code class="literal">MANY</code>, the user code has to provide |
---|
4126 | additional info using <code class="literal">G4gsbool(G4String volName, G4String |
---|
4127 | manyVolName)</code> function for all the overlapping volumes. |
---|
4128 | Daughters of overlapping volumes are then resolved automatically |
---|
4129 | and should not be specified via <code class="literal">Gsbool</code>. |
---|
4130 | <span class="bold"><strong>Limitation</strong></span>: a volume with a |
---|
4131 | <code class="literal">MANY</code> position can have |
---|
4132 | only this one position; if more than one position is needed a new |
---|
4133 | volume has to be defined (<code class="literal">gsvolu()</code>) for each |
---|
4134 | position. |
---|
4135 | </p></li><li><p> |
---|
4136 | <code class="literal">GSDV*</code> routines for dividing volumes are implemented, |
---|
4137 | using <code class="literal">G4PVReplica</code>s, for shapes: |
---|
4138 | |
---|
4139 | </p><div class="itemizedlist"><ul type="circle" compact><li><p> |
---|
4140 | <code class="literal">BOX</code>, <code class="literal">TUBE</code>, |
---|
4141 | <code class="literal">TUBS</code>, <code class="literal">PARA</code> - all axes; |
---|
4142 | </p></li><li><p> |
---|
4143 | <code class="literal">CONE</code>, <code class="literal">CONS</code> - axes 2, 3; |
---|
4144 | </p></li><li><p> |
---|
4145 | <code class="literal">TRD1</code>, <code class="literal">TRD2</code>, |
---|
4146 | <code class="literal">TRAP</code> - axis 3; |
---|
4147 | </p></li><li><p> |
---|
4148 | <code class="literal">PGON</code>, <code class="literal">PCON</code> - axis 2; |
---|
4149 | </p></li><li><p> |
---|
4150 | <code class="literal">PARA</code> -axis 1; axis 2,3 for a special case |
---|
4151 | </p></li></ul></div><p> |
---|
4152 | </p></li><li><p> |
---|
4153 | <code class="literal">GSPOSP</code> is implemented via individual logical volumes |
---|
4154 | for each instantiation. |
---|
4155 | </p></li><li><p> |
---|
4156 | <code class="literal">GSROTM</code> is implemented. Reflections of hierachies based |
---|
4157 | on plain CSG solids are implemented through the <code class="literal">G3Division</code> |
---|
4158 | class. |
---|
4159 | </p></li><li><p> |
---|
4160 | Hits are not implemented. |
---|
4161 | </p></li><li><p> |
---|
4162 | Conversion of GEANT 3.21 magnetic field is currently not |
---|
4163 | supported. However, the usage of magnetic field has to be turned on. |
---|
4164 | </p></li></ul></div><p> |
---|
4165 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Overlap"></a>4.1.11. |
---|
4166 | Detecting Overlapping Volumes |
---|
4167 | </h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Overlap.Prob"></a>4.1.11.1. |
---|
4168 | The problem of overlapping volumes |
---|
4169 | </h4></div></div></div><p> |
---|
4170 | Volumes are often positioned within other volumes with the |
---|
4171 | intent that one is fully contained within the other. If, however, a |
---|
4172 | volume extends beyond the boundaries of its mother volume, it is |
---|
4173 | defined as overlapping. It may also be intended that volumes are |
---|
4174 | positioned within the same mother volume such that they do not |
---|
4175 | intersect one another. When such volumes do intersect, they are |
---|
4176 | also defined as overlapping. |
---|
4177 | </p><p> |
---|
4178 | The problem of detecting overlaps between volumes is bounded by |
---|
4179 | the complexity of the solid model description. Hence it requires |
---|
4180 | the same mathematical sophistication which is needed to describe |
---|
4181 | the most complex solid topology, in general. However, a tunable |
---|
4182 | accuracy can be obtained by approximating the solids via first |
---|
4183 | and/or second order surfaces and checking their intersections. |
---|
4184 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Overlap.BuiltIn"></a>4.1.11.2. |
---|
4185 | Detecting overlaps: built-in kernel commands |
---|
4186 | </h4></div></div></div><p> |
---|
4187 | In general, the most powerful clash detection algorithms are |
---|
4188 | provided by CAD systems, treating the intersection between the |
---|
4189 | solids in their topological form. |
---|
4190 | </p><p> |
---|
4191 | Geant4 provides some built-in run-time commands to activate |
---|
4192 | verification tests for the user-defined geometry: |
---|
4193 | |
---|
4194 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4195 | geometry/test/grid_test [recursion_flag] |
---|
4196 | --> to start verification of geometry for overlapping regions |
---|
4197 | based on standard lines grid setup. If the "recursion_flag" is |
---|
4198 | set to 'false' (the default), the check is limited to the first |
---|
4199 | depth level of the geometry tree; otherwise it visits recursively |
---|
4200 | the whole geometry tree. In the latter case, it may take a long |
---|
4201 | time, depending on the complexity of the geometry. |
---|
4202 | geometry/test/cylinder_test [recursion_flag] |
---|
4203 | --> shoots lines according to a cylindrical pattern. If the |
---|
4204 | "recursion_flag" is set to 'false' (the default), the check is |
---|
4205 | limited to the first depth level of the geometry tree; otherwise |
---|
4206 | it visits recursively the whole geometry tree. In the latter case, |
---|
4207 | it may take a long time, depending on the complexity of the geometry. |
---|
4208 | geometry/test/line_test [recursion_flag] |
---|
4209 | --> shoots a line according to a specified direction and position |
---|
4210 | defined by the user. If the "recursion_flag" is set to 'false' |
---|
4211 | (the default), the check is limited to the first depth level of the |
---|
4212 | geometry tree; otherwise it visits recursively the whole geometry |
---|
4213 | tree. |
---|
4214 | geometry/test/position |
---|
4215 | --> to specify position for the line_test. |
---|
4216 | geometry/test/direction |
---|
4217 | --> to specify direction for the line_test. |
---|
4218 | geometry/test/grid_cells |
---|
4219 | --> to define the resolution of the lines in the grid test as number |
---|
4220 | of cells, specifying them for each dimension, X, Y and Z. |
---|
4221 | The new settings will be applied to the grid_test command. |
---|
4222 | geometry/test/cylinder_geometry |
---|
4223 | --> to define the details of the cylinder geometry, by specifying: |
---|
4224 | nPhi - number of lines per Phi |
---|
4225 | nZ - number of Z points |
---|
4226 | nRho - number of Rho points |
---|
4227 | The new settings will be applied to the cylinder_test command. |
---|
4228 | geometry/test/cylinder_scaleZ |
---|
4229 | --> to define the resolution of the cylinder geometry, by specifying |
---|
4230 | the fraction scale for points along Z. |
---|
4231 | The new settings will be applied to the cylinder_test command. |
---|
4232 | geometry/test/cylinder_scaleRho |
---|
4233 | --> to define the resolution of the cylinder geometry, by specifying |
---|
4234 | the fraction scale for points along Rho. |
---|
4235 | The new settings will be applied to the cylinder_test command. |
---|
4236 | geometry/test/recursion_start |
---|
4237 | --> to set the initial level in the geometry tree for starting the |
---|
4238 | recursion (default value being zero, i.e. the world volume). |
---|
4239 | The new settings will then be applied to any recursive test. |
---|
4240 | geometry/test/recursion_depth |
---|
4241 | --> to set the depth in the geometry tree for recursion, so that |
---|
4242 | recursion will stop after having reached the specified depth (the |
---|
4243 | default being the full depth of the geometry tree). |
---|
4244 | The new settings will then be applied to any recursive test. |
---|
4245 | </pre></div><p> |
---|
4246 | </p><p> |
---|
4247 | To detect overlapping volumes, the built-in test uses the |
---|
4248 | intersection of solids with linear trajectories. For example, |
---|
4249 | consider <a href="ch04.html#fig.Geom.Overlap_1" title="Figure 4.4. |
---|
4250 | Different cases of placed volumes overlapping each other. |
---|
4251 | ">Figure 4.4</a>: |
---|
4252 | |
---|
4253 | </p><div class="figure"><a name="fig.Geom.Overlap_1"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="./AllResources/Detector/geometry.src/geomtest.gif" align="middle" alt="Different cases of placed volumes overlapping each other."></div></div><p class="title"><b>Figure 4.4. |
---|
4254 | Different cases of placed volumes overlapping each other. |
---|
4255 | </b></p></div><p><br class="figure-break"> |
---|
4256 | </p><p> |
---|
4257 | Here we have a line intersecting some physical volume (large, |
---|
4258 | black rectangle). Belonging to the volume are four daughters: A, B, |
---|
4259 | C, and D. Indicated by the dots are the intersections of the line |
---|
4260 | with the mother volume and the four daughters. |
---|
4261 | </p><p> |
---|
4262 | This example has two geometry errors. First, volume A sticks |
---|
4263 | outside its mother volume (this practice, sometimes used in |
---|
4264 | GEANT3.21, is not allowed in Geant4). This can be noticed because |
---|
4265 | the intersection point (leftmost magenta dot) lies outside the |
---|
4266 | mother volume, as defined by the space between the two black |
---|
4267 | dots. |
---|
4268 | </p><p> |
---|
4269 | The second error is that daughter volumes A and B overlap. This |
---|
4270 | is noticeable because one of the intersections with A (rightmost |
---|
4271 | magenta dot) is inside the volume B, as defined as the space |
---|
4272 | between the red dots. Alternatively, one of the intersections with |
---|
4273 | B (leftmost red dot) is inside the volume A, as defined as the |
---|
4274 | space between the magenta dots. |
---|
4275 | </p><p> |
---|
4276 | Each of these two types of errors is represented by a line |
---|
4277 | segment, which has a start point, an end point, and, a length. |
---|
4278 | Depending on the type of error, the points are most clearly |
---|
4279 | recognized in either the coordinate system of the volume, the |
---|
4280 | global coordinate system, or the coordinate system of the daughters |
---|
4281 | involved. |
---|
4282 | </p><p> |
---|
4283 | Also notice that certain errors will be missed unless a line is |
---|
4284 | supplied in precisely the correct path. Unfortunately, it is hard |
---|
4285 | to predict which lines are best at uncovering potential geometry |
---|
4286 | errors. Instead, the geometry testing code uses a grid of lines, in |
---|
4287 | the hope of at least uncovering gross geometry errors. More subtle |
---|
4288 | errors could easily be missed. |
---|
4289 | </p><p> |
---|
4290 | Another difficult issue is roundoff error. For example, |
---|
4291 | daughters C and D lie precisely next to each other. It is possible, |
---|
4292 | due to roundoff, that one of the intersections points will lie just |
---|
4293 | slightly inside the space of the other. In addition, a volume that |
---|
4294 | lies tightly up against the outside of its mother may have an |
---|
4295 | intersection point that just slightly lies outside the mother. |
---|
4296 | </p><p> |
---|
4297 | To avoid spurious errors caused by roundoff, a rather generous |
---|
4298 | tolerance of 0.1 micron is used by default. This tolerance can be |
---|
4299 | adjusted as needed by the application through the run-time |
---|
4300 | command: |
---|
4301 | |
---|
4302 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4303 | geometry/test/tolerance <new-value> |
---|
4304 | </pre></div><p> |
---|
4305 | </p><p> |
---|
4306 | Finally, notice that no mention is made of the possible daughter |
---|
4307 | volumes of A, B, C, and D. To keep the code simple, only the |
---|
4308 | immediate daughters of a volume are checked at one pass. To test |
---|
4309 | these "granddaughter" volumes, the daughters A, B, C, and D each |
---|
4310 | have to be tested themselves in turn. To make this more automatic, |
---|
4311 | an optional recursive algorithm is included; it first tests a |
---|
4312 | target volume, then it loops over all daughter volumes and calls |
---|
4313 | itself. |
---|
4314 | </p><p> |
---|
4315 | Pay attention! For a complex geometry, checking the entire |
---|
4316 | volume hierarchy can be extremely time consuming. |
---|
4317 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Overlap.AtConst"></a>4.1.11.3. |
---|
4318 | Detecting overlaps at construction |
---|
4319 | </h4></div></div></div><p> |
---|
4320 | Since release 8.0, the Geant4 geometry modeler provides the |
---|
4321 | ability to detect overlaps of placed volumes (normal placements or |
---|
4322 | parameterised) at the time of construction. This check is optional |
---|
4323 | and can be activated when instantiating a placement (see |
---|
4324 | <code class="literal">G4PVPlacement</code> constructor in |
---|
4325 | <a href="ch04.html#sect.Geom.PhysVol.PlaceSingle" title="4.1.4.1. |
---|
4326 | Placements: single positioned copy |
---|
4327 | ">Section 4.1.4.1</a>) or a parameterised |
---|
4328 | volume (see <code class="literal">G4PVParameterised</code> constructor in |
---|
4329 | <a href="ch04.html#sect.Geom.PhysVol.RepeatVol" title="4.1.4.2. |
---|
4330 | Repeated volumes |
---|
4331 | ">Section 4.1.4.2</a>). |
---|
4332 | </p><p> |
---|
4333 | The positioning of that specific volume will be checked against all |
---|
4334 | volumes in the same hierarchy level and its mother volume. |
---|
4335 | Depending on the complexity of the geometry being checked, the |
---|
4336 | check may require considerable CPU time; it is therefore suggested |
---|
4337 | to use it only for debugging the geometry setup and to apply it |
---|
4338 | only to the part of the geometry setup which requires |
---|
4339 | debugging. |
---|
4340 | </p><p> |
---|
4341 | The classes <code class="literal">G4PVPlacement</code> and |
---|
4342 | <code class="literal">G4PVParameterised</code> also provide a method: |
---|
4343 | |
---|
4344 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4345 | G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true) |
---|
4346 | </pre></div><p> |
---|
4347 | |
---|
4348 | which will force the check for the specified volume. The check |
---|
4349 | verifies if each placed or parameterised instance is overlapping |
---|
4350 | with other instances or with its mother volume. A default |
---|
4351 | resolution for the number of points to be generated and verified is |
---|
4352 | provided. The method returns <code class="literal">true</code> if an overlap |
---|
4353 | occurs. It is also possible to specify a "tolerance" by which overlaps |
---|
4354 | not exceeding such quantity will not be reported; by default, all |
---|
4355 | overlaps are reported. |
---|
4356 | </p><p> |
---|
4357 | <span class="bold"><strong>Using the visualization driver: DAVID</strong></span> |
---|
4358 | </p><p> |
---|
4359 | The Geant4 visualization offers a powerful debugging tool for |
---|
4360 | detecting potential intersections of physical volumes. The Geant4 |
---|
4361 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAVID.html" target="_top"> |
---|
4362 | DAVID</a> visualization tool can infact |
---|
4363 | automatically detect the overlaps between the volumes defined in |
---|
4364 | Geant4 and converted to a graphical representation for |
---|
4365 | visualization purposes. The accuracy of the graphical |
---|
4366 | representation can be tuned onto the exact geometrical description. |
---|
4367 | In the debugging, physical-volume surfaces are automatically |
---|
4368 | decomposed into 3D polygons, and intersections of the generated |
---|
4369 | polygons are investigated. If a polygon intersects with another |
---|
4370 | one, physical volumes which these polygons belong to are visualized |
---|
4371 | in color (red is the default). The <a href="ch04.html#fig.Geom.Overlap_2" title="Figure 4.5. |
---|
4372 | A geometry with overlapping volumes highlighted by DAVID. |
---|
4373 | ">Figure 4.5</a> |
---|
4374 | below is a sample visualization of a detector geometry with intersecting |
---|
4375 | physical volumes highlighted: |
---|
4376 | |
---|
4377 | </p><div class="figure"><a name="fig.Geom.Overlap_2"></a><div class="figure-contents"><div class="mediaobject" align="center"><img src="./AllResources/Detector/geometry.src/DAVID_SAMPLE.gif" align="middle" alt="A geometry with overlapping volumes highlighted by DAVID."></div></div><p class="title"><b>Figure 4.5. |
---|
4378 | A geometry with overlapping volumes highlighted by DAVID. |
---|
4379 | </b></p></div><p><br class="figure-break"> |
---|
4380 | </p><p> |
---|
4381 | At present physical volumes made of the following solids are |
---|
4382 | able to be debugged: <code class="literal">G4Box</code>, <code class="literal">G4Cons</code>, |
---|
4383 | <code class="literal">G4Para</code>, <code class="literal">G4Sphere</code>, <code class="literal">G4Trd</code>, |
---|
4384 | <code class="literal">G4Trap</code>, <code class="literal">G4Tubs</code>. (Existence of other solids is |
---|
4385 | harmless.) |
---|
4386 | </p><p> |
---|
4387 | Visual debugging of physical-volume surfaces is performed with |
---|
4388 | the DAWNFILE driver defined in the visualization category and with |
---|
4389 | the two application packages, i.e. Fukui Renderer "DAWN" and a |
---|
4390 | visual intersection debugger "DAVID". |
---|
4391 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWN.html" target="_top"> |
---|
4392 | DAWN</a> and |
---|
4393 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAVID.html" target="_top"> |
---|
4394 | DAVID</a> can be downloaded from the Web. |
---|
4395 | </p><p> |
---|
4396 | How to compile Geant4 with the DAWNFILE driver incorporated is |
---|
4397 | described in <a href="ch08s03.html" title="8.3. |
---|
4398 | The Visualization Drivers |
---|
4399 | ">Section 8.3</a>. |
---|
4400 | </p><p> |
---|
4401 | If the DAWNFILE driver, DAWN and DAVID are all working well in |
---|
4402 | your host machine, the visual intersection debugging of |
---|
4403 | physical-volume surfaces can be performed as follows: |
---|
4404 | </p><p> |
---|
4405 | Run your Geant4 executable, invoke the DAWNFILE driver, and |
---|
4406 | execute visualization commands to visualize your detector |
---|
4407 | geometry: |
---|
4408 | |
---|
4409 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4410 | Idle> /vis/open DAWNFILE |
---|
4411 | .....(setting camera etc)... |
---|
4412 | Idle> /vis/drawVolume |
---|
4413 | Idle> /vis/viewer/update |
---|
4414 | </pre></div><p> |
---|
4415 | </p><p> |
---|
4416 | Then a file "g4.prim", which describes the detector geometry, is |
---|
4417 | generated in the current directory and DAVID is invoked to read it. |
---|
4418 | (The description of the format of the file g4.prim can be found |
---|
4419 | from the |
---|
4420 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/G4PRIM_FORMAT_24/" target="_top"> |
---|
4421 | DAWN web site documentation</a>.) |
---|
4422 | </p><p> |
---|
4423 | If DAVID detects intersection of physical-volume surfaces, it |
---|
4424 | automatically invokes DAWN to visualize the detector geometry with |
---|
4425 | the intersected physical volumes highlighted (See the above sample |
---|
4426 | visualization). |
---|
4427 | </p><p> |
---|
4428 | If no intersection is detected, visualization is skipped and the |
---|
4429 | following message is displayed on the console: |
---|
4430 | |
---|
4431 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4432 | ------------------------------------------------------ |
---|
4433 | !!! Number of intersected volumes : 0 !!! |
---|
4434 | !!! Congratulations ! \(^o^)/ !!! |
---|
4435 | ------------------------------------------------------ |
---|
4436 | </pre></div><p> |
---|
4437 | </p><p> |
---|
4438 | If you always want to skip visualization, set an environmental |
---|
4439 | variable as follows beforehand: |
---|
4440 | |
---|
4441 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4442 | % setenv DAVID_NO_VIEW 1 |
---|
4443 | </pre></div><p> |
---|
4444 | </p><p> |
---|
4445 | To control the precision associated to computation of |
---|
4446 | intersections (default precision is set to 9), it is possible to |
---|
4447 | use the environmental variable for the DAWNFILE graphics driver, as |
---|
4448 | follows: |
---|
4449 | |
---|
4450 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4451 | % setenv G4DAWNFILE_PRECISION 10 |
---|
4452 | </pre></div><p> |
---|
4453 | </p><p> |
---|
4454 | If necessary, re-visualize the detector geometry with |
---|
4455 | intersected parts highlighted. The data are saved in a file |
---|
4456 | "g4david.prim" in the current directory. This file can be |
---|
4457 | re-visualized with DAWN as follows: |
---|
4458 | |
---|
4459 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4460 | % dawn g4david.prim |
---|
4461 | </pre></div><p> |
---|
4462 | </p><p> |
---|
4463 | It is also helpful to convert the generated file g4david.prim |
---|
4464 | into a VRML-formatted file and perform interactive visualization of |
---|
4465 | it with your WWW browser. The file conversion tool |
---|
4466 | <code class="literal">prim2wrml</code> can be downloaded from the |
---|
4467 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_prim2vrml1.html" target="_top"> |
---|
4468 | DAWN web site download pages</a>. |
---|
4469 | </p><p> |
---|
4470 | For more details, see the |
---|
4471 | <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAVID.html" target="_top"> |
---|
4472 | document of DAVID</a> mentioned above. |
---|
4473 | </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.Geom.Overlap.OLAP"></a>4.1.11.4. |
---|
4474 | Using the geometry debugging tool OLAP |
---|
4475 | </h4></div></div></div><p> |
---|
4476 | <span class="bold"><strong>OLAP</strong></span> is a tool developed in the CMS experiment |
---|
4477 | at CERN to help in identifying ovelapping volumes in a detector geometry. It |
---|
4478 | is placed in the area for specific tools/examples, in |
---|
4479 | <code class="literal">geant4/examples/extended/geometry</code>. The technique consists |
---|
4480 | in shooting <code class="literal">geantinos</code> particles in one direction and the |
---|
4481 | opposite one, and verifying that the boundary crossings are the |
---|
4482 | same. |
---|
4483 | </p><p> |
---|
4484 | The tool can be used for any Geant4 geometry, provided that the |
---|
4485 | user geometry to be debugged is available as a subclass of |
---|
4486 | <code class="literal">G4VUserDetectorConstruction</code> and is used to construct the |
---|
4487 | <code class="literal">OlapDetConstr</code> class of the tool. A dummy class |
---|
4488 | <code class="literal">RandomDetector</code> is provided for this purpose in the tool |
---|
4489 | itself. |
---|
4490 | </p><p> |
---|
4491 | Run-time commands are provided by the tool to navigate in the |
---|
4492 | geometry tree. UNIX like navigation of the logical volume hierarchy |
---|
4493 | is provided by the <code class="literal">/olap/cd</code> command. The root of the |
---|
4494 | logical volume tree can be accessed by the character '/'. Any node |
---|
4495 | in the volume tree can be accessed by a '/' separated string of |
---|
4496 | regular expressions. If '/' is at the beginning of the string, the |
---|
4497 | tree hierarchy is transversed from the root, otherwise from the |
---|
4498 | currently chosen logical volume. Further the command <code class="literal">/olap/goto |
---|
4499 | [regexp]</code> can be used to jump to the first logical volume |
---|
4500 | matching the expression <code class="literal">[regexp]</code>. Every successful |
---|
4501 | navigation command (<code class="literal">/olap/cd</code>, <code class="literal">olap/goto</code>) results |
---|
4502 | in the construction of a <code class="literal">NewWorld</code>, the mother volume being |
---|
4503 | the argument of the command and the daughter volumes being the |
---|
4504 | direct daughters of the mother volume. |
---|
4505 | </p><p> |
---|
4506 | <code class="literal">/olap/pwd</code> always shows where in the full geometrical |
---|
4507 | hierarchy the current <code class="literal">NewWorld</code> and mother volume are |
---|
4508 | located. |
---|
4509 | </p><p> |
---|
4510 | For more detailed information, view the <code class="literal">README</code> file |
---|
4511 | provided with the tool. |
---|
4512 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Dyna"></a>4.1.12. |
---|
4513 | Dynamic Geometry Setups |
---|
4514 | </h3></div></div></div><p> |
---|
4515 | Geant4 can handle geometries which vary in time (e.g. a geometry |
---|
4516 | varying between two runs in the same job). |
---|
4517 | </p><p> |
---|
4518 | It is considered a change to the geometry setup, whenever: |
---|
4519 | |
---|
4520 | </p><div class="itemizedlist"><ul type="disc" compact><li><p> |
---|
4521 | the shape or dimension of an existing solid is modified; |
---|
4522 | </p></li><li><p> |
---|
4523 | the positioning (translation or rotation) of a volume is |
---|
4524 | changed; |
---|
4525 | </p></li><li><p> |
---|
4526 | a volume (or a set of volumes, tree) is removed/replaced or |
---|
4527 | added. |
---|
4528 | </p></li></ul></div><p> |
---|
4529 | </p><p> |
---|
4530 | Whenever such a change happens, the geometry setup needs to be |
---|
4531 | first "opened" for the change to be applied and afterwards "closed" |
---|
4532 | for the optimisation to be reorganised. |
---|
4533 | </p><p> |
---|
4534 | In the general case, in order to notify the Geant4 system of the |
---|
4535 | change in the geometry setup, the <code class="literal">G4RunManager</code> has to be |
---|
4536 | messaged once the new geometry setup has been finalised: |
---|
4537 | |
---|
4538 | </p><div class="informalexample"><pre class="programlisting"> |
---|
4539 | G4RunManager::GeometryHasBeenModified(); |
---|
4540 | </pre></div><p> |
---|
4541 | </p><p> |
---|
4542 | The above notification needs to be performed also if a material |
---|
4543 | associated to a <span class="emphasis"><em>positioned</em></span> volume is changed, in order to |
---|
4544 | allow for the internal materials/cuts table to be updated. However, |
---|
4545 | for relatively complex geometries the re-optimisation step may be |
---|
4546 | extremely inefficient, since it has the effect that the whole |
---|
4547 | geometry setup will be re-optimised and re-initialised. In cases |
---|
4548 | where only a limited portion of the geometry has changed, it may be |
---|
4549 | suitable to apply the re-optimisation only to the affected portion |
---|
4550 | of the geometry (subtree). |
---|
4551 | </p><p> |
---|
4552 | Since release 7.1 of the Geant4 toolkit, it is possible to apply |
---|
4553 | re-optimisation local to the subtree of the geometry which has |
---|
4554 | changed. The user will have to explicitly "open/close" the geometry |
---|
4555 | providing a pointer to the top physical volume concerned: |
---|
4556 | |
---|
4557 | </p><div class="example"><a name="programlist_Geom.Dyna_1"></a><p class="title"><b>Example 4.9. |
---|
4558 | Opening and closing a portion of the geometry without |
---|
4559 | notifying the <code class="literal">G4RunManager</code>. |
---|
4560 | </b></p><div class="example-contents"><pre class="programlisting"> |
---|
4561 | #include "G4GeometryManager.hh" |
---|
4562 | |
---|
4563 | // Open geometry for the physical volume to be modified ... |
---|
4564 | // |
---|
4565 | G4GeometryManager::OpenGeometry(physCalor); |
---|
4566 | |
---|
4567 | // Modify dimension of the solid ... |
---|
4568 | // |
---|
4569 | physCalor->GetLogicalVolume()->GetSolid()->SetXHalfLength(12.5*cm); |
---|
4570 | |
---|
4571 | // Close geometry for the portion modified ... |
---|
4572 | // |
---|
4573 | G4GeometryManager::CloseGeometry(physCalor); |
---|
4574 | </pre></div></div><p><br class="example-break"> |
---|
4575 | </p><p> |
---|
4576 | If the existing geometry setup is modified locally in more than |
---|
4577 | one place, it may be convenient to apply such a technique only |
---|
4578 | once, by specifying a physical volume on top of the hierarchy |
---|
4579 | (subtree) containing all changed portions of the setup. |
---|
4580 | </p><p> |
---|
4581 | An alternative solution for dealing with dynamic geometries is |
---|
4582 | to specify NOT to apply optimisation for the subtree affected by |
---|
4583 | the change and apply the general solution of invoking the |
---|
4584 | <code class="literal">G4RunManager</code>. In this case, a performance penalty at |
---|
4585 | run-time may be observed (depending on the complexity of the |
---|
4586 | not-optimised subtree), considering that, without optimisation, |
---|
4587 | intersections to all volumes in the subtree will be explicitely |
---|
4588 | computed each time. |
---|
4589 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.GDML"></a>4.1.13. |
---|
4590 | Importing XML Models Using GDML |
---|
4591 | </h3></div></div></div><p> |
---|
4592 | Geometry Description Markup Language (<a href="http://cern.ch/gdml/" target="_top">GDML</a>) |
---|
4593 | is a markup language based on XML and suited for the description of detector |
---|
4594 | geometry models. It allows for easy exchange of geometry data in a |
---|
4595 | <span class="emphasis"><em>human-readable</em></span> XML-based description and structured |
---|
4596 | formatting. |
---|
4597 | </p><p> |
---|
4598 | The GDML parser is component of Geant4 which can be built |
---|
4599 | and installed as an optional choice. It allows for importing and |
---|
4600 | exporting GDML files, following the schema specified in the GDML |
---|
4601 | documentation. The installation of the plugin is optional and requires |
---|
4602 | the installation of the |
---|
4603 | <a href="http://xerces.apache.org/xerces-c/" target="_top">XercesC</a> |
---|
4604 | DOM parser. |
---|
4605 | </p><p> |
---|
4606 | An example of how to import and export a detector description |
---|
4607 | model based on |
---|
4608 | <a href="http://cern.ch/gdml/" target="_top"> |
---|
4609 | <span class="bold"><strong>GDML</strong></span> |
---|
4610 | </a> |
---|
4611 | is provided and can be found in <code class="literal">examples/extended/gdml</code>. |
---|
4612 | A description on how to define a geometry in GDML together with |
---|
4613 | an annotated example, is provided in the |
---|
4614 | <a href="http://cern.ch/gdml/g4example.html" target="_top"> |
---|
4615 | GDML example page</a>. |
---|
4616 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.Geom.Persistency"></a>4.1.14. |
---|
4617 | Saving geometry tree objects in binary format |
---|
4618 | </h3></div></div></div><p> |
---|
4619 | The Geant4 geometry tree can be stored in the Root binary file format |
---|
4620 | using the <span class="emphasis"><em>reflection</em></span> technique provided by the |
---|
4621 | Reflex tool (included in Root). Such a binary file can then be used |
---|
4622 | to quickly load the geometry into the memory or to move geometries |
---|
4623 | between different Geant4 applications. |
---|
4624 | </p><p> |
---|
4625 | See <a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s06.html" target="_top">Chapter 4.6</a> |
---|
4626 | for details and references. |
---|
4627 | </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch04s02.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">3.7. |
---|
4628 | Event Biasing Techniques |
---|
4629 | </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.2. |
---|
4630 | Material |
---|
4631 | </td></tr></table></div></body></html> |
---|