1 | <!-- ******************************************************** --> |
---|
2 | <!-- --> |
---|
3 | <!-- [History] --> |
---|
4 | <!-- Changed by: Katsuya Amako, 15-Jul-2000 --> |
---|
5 | <!-- Changed by: Dennis Wright, 27-Nov-2001 --> |
---|
6 | <!-- Proof read by: Joe Chuma, 5-Jul-1999 --> |
---|
7 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> |
---|
8 | <!-- Added Qt Info: Laurent Garnier, Dec-2008 --> |
---|
9 | <!-- Updates for Qt and HepRApp: Joseph Perl, Dec-2008 --> |
---|
10 | <!-- --> |
---|
11 | <!-- ******************************************************** --> |
---|
12 | |
---|
13 | |
---|
14 | <!-- ******************* Section (Level#1) ****************** --> |
---|
15 | <sect1 id="sect.VisIntro"> |
---|
16 | <title> |
---|
17 | Introduction to Visualization |
---|
18 | </title> |
---|
19 | |
---|
20 | <para> |
---|
21 | The Geant4 visualization system was developed in response to a |
---|
22 | diverse set of requirements: |
---|
23 | |
---|
24 | <orderedlist spacing="compact"> |
---|
25 | <listitem><para> |
---|
26 | Quick response to study geometries, trajectories and hits |
---|
27 | </para></listitem> |
---|
28 | <listitem><para> |
---|
29 | High-quality output for publications |
---|
30 | </para></listitem> |
---|
31 | <listitem><para> |
---|
32 | Flexible camera control to debug complex geometries |
---|
33 | </para></listitem> |
---|
34 | <listitem><para> |
---|
35 | Tools to show volume overlap errors in detector geometries |
---|
36 | </para></listitem> |
---|
37 | <listitem><para> |
---|
38 | Interactive picking to get more information on visualized objects |
---|
39 | </para></listitem> |
---|
40 | </orderedlist> |
---|
41 | </para> |
---|
42 | |
---|
43 | <para> |
---|
44 | No one graphics system is ideal for all of these requirements, |
---|
45 | and many of the large software frameworks into which Geant4 has |
---|
46 | been incorporated already have their own visualization systems, so |
---|
47 | Geant4 visualization was designed around an abstract interface that |
---|
48 | supports a diverse family of graphics systems. Some of these |
---|
49 | graphics systems use a graphics library compiled with Geant4, such |
---|
50 | as OpenGL, Qt, while others involve a separate application, such as |
---|
51 | HepRApp or DAWN. |
---|
52 | </para> |
---|
53 | |
---|
54 | <!-- ******************* Section (Level#2) ****************** --> |
---|
55 | <sect2 id="sect.VisIntro.What"> |
---|
56 | <title> |
---|
57 | What Can be Visualized |
---|
58 | </title> |
---|
59 | |
---|
60 | <para> |
---|
61 | Simulation data can be visualized: |
---|
62 | |
---|
63 | <itemizedlist spacing="compact"> |
---|
64 | <listitem><para> |
---|
65 | Detector components |
---|
66 | <itemizedlist spacing="compact"> |
---|
67 | <listitem><para> |
---|
68 | A hierarchical structure of physical volumes |
---|
69 | </para></listitem> |
---|
70 | <listitem><para> |
---|
71 | A piece of physical volume, logical volume, and solid |
---|
72 | </para></listitem> |
---|
73 | </itemizedlist> |
---|
74 | </para></listitem> |
---|
75 | <listitem><para> |
---|
76 | Particle trajectories and tracking steps |
---|
77 | </para></listitem> |
---|
78 | <listitem><para> |
---|
79 | Hits of particles in detector components |
---|
80 | </para></listitem> |
---|
81 | </itemizedlist> |
---|
82 | </para> |
---|
83 | |
---|
84 | <para> |
---|
85 | Other user defined objects can be visualized: |
---|
86 | |
---|
87 | <itemizedlist spacing="compact"> |
---|
88 | <listitem><para> |
---|
89 | Polylines, such as coordinate axes |
---|
90 | </para></listitem> |
---|
91 | <listitem><para> |
---|
92 | 3D Markers, such as eye guides |
---|
93 | </para></listitem> |
---|
94 | <listitem><para> |
---|
95 | Text, descriptive character strings, comments or titles |
---|
96 | </para></listitem> |
---|
97 | <listitem><para> |
---|
98 | Scales |
---|
99 | </para></listitem> |
---|
100 | <listitem><para> |
---|
101 | Logos |
---|
102 | </para></listitem> |
---|
103 | </itemizedlist> |
---|
104 | </para> |
---|
105 | |
---|
106 | </sect2> |
---|
107 | |
---|
108 | |
---|
109 | <!-- ******************* Section (Level#2) ****************** --> |
---|
110 | <sect2 id="sect.VisIntro.Choice"> |
---|
111 | <title> |
---|
112 | You have a Choice of Visualization Drivers |
---|
113 | </title> |
---|
114 | |
---|
115 | <para> |
---|
116 | The many graphics systems that Geant4 supports are complementary to |
---|
117 | each other. |
---|
118 | |
---|
119 | <itemizedlist spacing="compact"> |
---|
120 | <listitem><para> |
---|
121 | OpenGL |
---|
122 | <itemizedlist spacing="compact"> |
---|
123 | <listitem><para> |
---|
124 | View directly from Geant4 |
---|
125 | </para></listitem> |
---|
126 | <listitem><para> |
---|
127 | Requires addition of GL libraries that are freely avialable for all operating systems (and pre-installed on many) |
---|
128 | </para></listitem> |
---|
129 | <listitem><para> |
---|
130 | Rendered, photorealistic image with some interactive features |
---|
131 | </para></listitem> |
---|
132 | <listitem><para> |
---|
133 | zoom, rotate, translate |
---|
134 | </para></listitem> |
---|
135 | <listitem><para> |
---|
136 | Fast response (can usually exploit full potential of graphics |
---|
137 | hardware) |
---|
138 | </para></listitem> |
---|
139 | <listitem><para> |
---|
140 | Print to EPS (vector and pixel graphics) |
---|
141 | </para></listitem> |
---|
142 | </itemizedlist> |
---|
143 | </para></listitem> |
---|
144 | <listitem><para> |
---|
145 | Qt |
---|
146 | <itemizedlist spacing="compact"> |
---|
147 | <listitem><para> |
---|
148 | View directly from Geant4 |
---|
149 | </para></listitem> |
---|
150 | <listitem><para> |
---|
151 | Requies addition of Qt and GL libraries that are freely available on most operating |
---|
152 | systems |
---|
153 | </para></listitem> |
---|
154 | <listitem><para> |
---|
155 | Rendered, photorealistic image |
---|
156 | </para></listitem> |
---|
157 | <listitem><para> |
---|
158 | Many interactive features |
---|
159 | </para></listitem> |
---|
160 | <listitem><para> |
---|
161 | zoom, rotate, translate |
---|
162 | </para></listitem> |
---|
163 | <listitem><para> |
---|
164 | Fast response (can usually exploit full potential of graphics |
---|
165 | hardware) |
---|
166 | </para></listitem> |
---|
167 | <listitem><para> |
---|
168 | Expanded printing ability (vector and pixel graphics) |
---|
169 | </para></listitem> |
---|
170 | <listitem><para> |
---|
171 | Easy interface to make movies |
---|
172 | </para></listitem> |
---|
173 | </itemizedlist> |
---|
174 | </para></listitem> |
---|
175 | <listitem><para> |
---|
176 | OpenInventor |
---|
177 | <itemizedlist spacing="compact"> |
---|
178 | <listitem><para> |
---|
179 | View directly from Geant4 |
---|
180 | </para></listitem> |
---|
181 | <listitem><para> |
---|
182 | Requires addition of OpenInventor libraries (freely available |
---|
183 | for most Linux systems). |
---|
184 | </para></listitem> |
---|
185 | <listitem><para> |
---|
186 | Rendered, photorealistic image |
---|
187 | </para></listitem> |
---|
188 | <listitem><para> |
---|
189 | Many interactive features |
---|
190 | </para></listitem> |
---|
191 | <listitem><para> |
---|
192 | zoom, rotate, translate |
---|
193 | </para></listitem> |
---|
194 | <listitem><para> |
---|
195 | click to "see inside" opaque |
---|
196 | volumes |
---|
197 | </para></listitem> |
---|
198 | <listitem><para> |
---|
199 | Fast response (can usually exploit full potential of graphics |
---|
200 | hardware) |
---|
201 | </para></listitem> |
---|
202 | <listitem><para> |
---|
203 | Expanded printing ability (vector and pixel graphics) |
---|
204 | </para></listitem> |
---|
205 | </itemizedlist> |
---|
206 | </para></listitem> |
---|
207 | <listitem><para> |
---|
208 | HepRep |
---|
209 | <itemizedlist spacing="compact"> |
---|
210 | <listitem><para> |
---|
211 | Create a file to view in a HepRep browser such as HepRApp, |
---|
212 | FRED or WIRED4 |
---|
213 | </para></listitem> |
---|
214 | <listitem><para> |
---|
215 | Requires a HepRep browser (above options work on any operating system) |
---|
216 | </para></listitem> |
---|
217 | <listitem><para> |
---|
218 | Wireframe or simple area fills (not photorealistic) |
---|
219 | </para></listitem> |
---|
220 | <listitem><para> |
---|
221 | Many interactive features |
---|
222 | </para></listitem> |
---|
223 | <listitem><para> |
---|
224 | zoom, rotate, translate |
---|
225 | </para></listitem> |
---|
226 | <listitem><para> |
---|
227 | click to show attributes (momentum, etc.) |
---|
228 | </para></listitem> |
---|
229 | <listitem><para> |
---|
230 | special projections (FishEye, etc.) |
---|
231 | </para></listitem> |
---|
232 | <listitem><para> |
---|
233 | control visibility from hierarchical (tree) view of data |
---|
234 | </para></listitem> |
---|
235 | <listitem><para> |
---|
236 | Hierarchical view of the geometry |
---|
237 | </para></listitem> |
---|
238 | <listitem><para> |
---|
239 | Export to many vector graphic formats (PostScript, PDF, etc.) |
---|
240 | </para></listitem> |
---|
241 | </itemizedlist> |
---|
242 | </para></listitem> |
---|
243 | <listitem><para> |
---|
244 | DAWN |
---|
245 | <itemizedlist spacing="compact"> |
---|
246 | <listitem><para> |
---|
247 | Create a file to view in the DAWN Renderer |
---|
248 | </para></listitem> |
---|
249 | <listitem><para> |
---|
250 | Requires DAWN, available for all Linux and Windows systems. |
---|
251 | </para></listitem> |
---|
252 | <listitem><para> |
---|
253 | Rendered, photorealistic image |
---|
254 | </para></listitem> |
---|
255 | <listitem><para> |
---|
256 | No interactive features |
---|
257 | </para></listitem> |
---|
258 | <listitem><para> |
---|
259 | Highest quality technical rendering - output to vector PostScript |
---|
260 | </para></listitem> |
---|
261 | </itemizedlist> |
---|
262 | </para></listitem> |
---|
263 | <listitem><para> |
---|
264 | VRML |
---|
265 | <itemizedlist spacing="compact"> |
---|
266 | <listitem><para> |
---|
267 | Create a file to view in any VRML browser (some as web browser |
---|
268 | plug-ins). |
---|
269 | </para></listitem> |
---|
270 | <listitem><para> |
---|
271 | Requires VRML browser (many different choices for different |
---|
272 | operating systems). |
---|
273 | </para></listitem> |
---|
274 | <listitem><para> |
---|
275 | Rendered, photorealistic image with some interactive features |
---|
276 | </para></listitem> |
---|
277 | <listitem><para> |
---|
278 | zoom, rotate, translate |
---|
279 | </para></listitem> |
---|
280 | <listitem><para> |
---|
281 | Limited printing ability (pixel graphics, not vector graphics) |
---|
282 | </para></listitem> |
---|
283 | </itemizedlist> |
---|
284 | </para></listitem> |
---|
285 | <listitem><para> |
---|
286 | RayTracer |
---|
287 | <itemizedlist spacing="compact"> |
---|
288 | <listitem><para> |
---|
289 | Create a jpeg file |
---|
290 | </para></listitem> |
---|
291 | <listitem><para> |
---|
292 | Forms image by using Geant4's own tracking |
---|
293 | to follow photons through the detector |
---|
294 | </para></listitem> |
---|
295 | <listitem><para> |
---|
296 | Can show geometry but not trajectories |
---|
297 | </para></listitem> |
---|
298 | <listitem><para> |
---|
299 | Can render any geometry that Geant4 can handle (such as Boolean |
---|
300 | solids) |
---|
301 | </para></listitem> |
---|
302 | <listitem><para> |
---|
303 | Supports shadows, transparency and mirrored surfaces |
---|
304 | </para></listitem> |
---|
305 | </itemizedlist> |
---|
306 | </para></listitem> |
---|
307 | <listitem><para> |
---|
308 | ASCIITree |
---|
309 | <itemizedlist spacing="compact"> |
---|
310 | <listitem><para> |
---|
311 | Text dump of the geometry hierarchy |
---|
312 | </para></listitem> |
---|
313 | <listitem><para> |
---|
314 | Not graphical |
---|
315 | </para></listitem> |
---|
316 | <listitem><para> |
---|
317 | Control over level of detail to be dumped |
---|
318 | </para></listitem> |
---|
319 | <listitem><para> |
---|
320 | Can calculate mass and volume of any hierarchy of volumes |
---|
321 | </para></listitem> |
---|
322 | </itemizedlist> |
---|
323 | </para></listitem> |
---|
324 | </itemizedlist> |
---|
325 | </para> |
---|
326 | |
---|
327 | </sect2> |
---|
328 | |
---|
329 | |
---|
330 | <!-- ******************* Section (Level#2) ****************** --> |
---|
331 | <sect2 id="sect.VisIntro.ChoDrv"> |
---|
332 | <title> |
---|
333 | Choose the Driver that Meets Your Needs |
---|
334 | </title> |
---|
335 | |
---|
336 | <para> |
---|
337 | <itemizedlist spacing="compact"> |
---|
338 | <listitem><para> |
---|
339 | If you want very responsive photorealistic graphics (and have |
---|
340 | the OpenGL libraries installed) |
---|
341 | <itemizedlist spacing="compact"> |
---|
342 | <listitem><para> |
---|
343 | OpenGL is a good solution (if you have the Motif extensions, |
---|
344 | this also gives GUI control) |
---|
345 | </para></listitem> |
---|
346 | </itemizedlist> |
---|
347 | </para></listitem> |
---|
348 | <listitem><para> |
---|
349 | If you want very responsive photorealistic graphics plus more |
---|
350 | interactivity (and have the OpenInventor or Qt libraries installed) |
---|
351 | <itemizedlist spacing="compact"> |
---|
352 | <listitem><para> |
---|
353 | OpenInventor or Qt are good solutions |
---|
354 | </para></listitem> |
---|
355 | </itemizedlist> |
---|
356 | </para></listitem> |
---|
357 | <listitem><para> |
---|
358 | If you want GUI control, very responsive photorealistic graphics plus more |
---|
359 | interactivity (and have the Qt libraries installed). |
---|
360 | <itemizedlist spacing="compact"> |
---|
361 | <listitem><para> |
---|
362 | Qt is a good solution |
---|
363 | </para></listitem> |
---|
364 | </itemizedlist> |
---|
365 | </para></listitem> |
---|
366 | <listitem><para> |
---|
367 | If you want GUI control, want to be able to pick on items to |
---|
368 | inquire about them (identity, momentum, etc.), perhaps want to |
---|
369 | render to vector formats, and a wireframe look will do |
---|
370 | <itemizedlist spacing="compact"> |
---|
371 | <listitem><para> |
---|
372 | HepRep will meet your needs |
---|
373 | </para></listitem> |
---|
374 | </itemizedlist> |
---|
375 | </para></listitem> |
---|
376 | <listitem><para> |
---|
377 | If you want to render highest quality photorealistic images for |
---|
378 | use in a poster or a technical design report, and you can live |
---|
379 | without quick rotate and zoom |
---|
380 | <itemizedlist spacing="compact"> |
---|
381 | <listitem><para> |
---|
382 | DAWN is the way to go |
---|
383 | </para></listitem> |
---|
384 | </itemizedlist> |
---|
385 | </para></listitem> |
---|
386 | <listitem><para> |
---|
387 | If you want to render to a 3D format that others can view in a |
---|
388 | variety of commodity browsers (including some web browser plug-ins) |
---|
389 | <itemizedlist spacing="compact"> |
---|
390 | <listitem><para> |
---|
391 | VRML is the way to go |
---|
392 | </para></listitem> |
---|
393 | </itemizedlist> |
---|
394 | </para></listitem> |
---|
395 | </itemizedlist> |
---|
396 | |
---|
397 | <?soft-pagebreak ?> |
---|
398 | <itemizedlist spacing="compact"> |
---|
399 | <listitem><para> |
---|
400 | If you want to visualize a geometry that the other |
---|
401 | visualization drivers can't handle, or you need |
---|
402 | transparency or mirrors, and you don't need to |
---|
403 | visualize trajectories |
---|
404 | <itemizedlist spacing="compact"> |
---|
405 | <listitem><para> |
---|
406 | RayTracer will do it |
---|
407 | </para></listitem> |
---|
408 | </itemizedlist> |
---|
409 | </para></listitem> |
---|
410 | <listitem><para> |
---|
411 | If you just want to quickly check the geometry hierarchy, or if |
---|
412 | you want to calculate the volume or mass of any geometry hierarchy |
---|
413 | <itemizedlist spacing="compact"> |
---|
414 | <listitem><para> |
---|
415 | ASCIITree will meet your needs |
---|
416 | </para></listitem> |
---|
417 | </itemizedlist> |
---|
418 | </para></listitem> |
---|
419 | <listitem><para> |
---|
420 | You can also add your own visualization driver. |
---|
421 | <itemizedlist spacing="compact"> |
---|
422 | <listitem><para> |
---|
423 | Geant4's visualization system is modular. By |
---|
424 | creating just three new classes, you can direct Geant4 information |
---|
425 | to your own visualization system. |
---|
426 | </para></listitem> |
---|
427 | </itemizedlist> |
---|
428 | </para></listitem> |
---|
429 | </itemizedlist> |
---|
430 | </para> |
---|
431 | |
---|
432 | </sect2> |
---|
433 | |
---|
434 | <!-- ******************* Section (Level#2) ****************** --> |
---|
435 | <sect2 id="sect.VisIntro.CntVis"> |
---|
436 | <title> |
---|
437 | Controlling Visualization |
---|
438 | </title> |
---|
439 | |
---|
440 | <para> |
---|
441 | Your Geant4 code stays basically the same no matter which driver |
---|
442 | you use. |
---|
443 | </para> |
---|
444 | |
---|
445 | <para> |
---|
446 | Visualization is performed either with commands or from C++ code. |
---|
447 | |
---|
448 | <itemizedlist spacing="compact"> |
---|
449 | <listitem><para> |
---|
450 | Some visualization drivers work directly from Geant4 |
---|
451 | <itemizedlist spacing="compact"> |
---|
452 | <listitem><para> |
---|
453 | OpenGL |
---|
454 | </para></listitem> |
---|
455 | <listitem><para> |
---|
456 | Qt |
---|
457 | </para></listitem> |
---|
458 | <listitem><para> |
---|
459 | OpenInventor |
---|
460 | </para></listitem> |
---|
461 | <listitem><para> |
---|
462 | RayTracer |
---|
463 | </para></listitem> |
---|
464 | <listitem><para> |
---|
465 | ASCIITree |
---|
466 | </para></listitem> |
---|
467 | </itemizedlist> |
---|
468 | </para></listitem> |
---|
469 | <listitem><para> |
---|
470 | For other visualization drivers, you first have Geant4 produce |
---|
471 | a file, and then you have that file rendered by another application |
---|
472 | (which may have GUI control) |
---|
473 | <itemizedlist spacing="compact"> |
---|
474 | <listitem><para> |
---|
475 | HepRep |
---|
476 | </para></listitem> |
---|
477 | <listitem><para> |
---|
478 | DAWN |
---|
479 | </para></listitem> |
---|
480 | <listitem><para> |
---|
481 | VRML |
---|
482 | </para></listitem> |
---|
483 | </itemizedlist> |
---|
484 | </para></listitem> |
---|
485 | </itemizedlist> |
---|
486 | </para> |
---|
487 | |
---|
488 | </sect2> |
---|
489 | |
---|
490 | |
---|
491 | <!-- ******************* Section (Level#2) ****************** --> |
---|
492 | <sect2 id="sect.VisIntro.Details"> |
---|
493 | <title> |
---|
494 | Visualization Details |
---|
495 | </title> |
---|
496 | |
---|
497 | <para> |
---|
498 | The following sections of this guide cover the details of Geant4 |
---|
499 | visualization: |
---|
500 | |
---|
501 | <itemizedlist spacing="compact"> |
---|
502 | <listitem><para> |
---|
503 | <xref linkend="sect.VisAddExe" /> |
---|
504 | Adding Visualization to Your Executable |
---|
505 | </para></listitem> |
---|
506 | <listitem><para> |
---|
507 | <xref linkend="sect.VisDrv" /> |
---|
508 | The Visualization Drivers |
---|
509 | </para></listitem> |
---|
510 | <listitem><para> |
---|
511 | <xref linkend="sect.VisCntCmmd" /> |
---|
512 | Controlling Visualization from Commands |
---|
513 | </para></listitem> |
---|
514 | <listitem><para> |
---|
515 | <xref linkend="sect.VisCntCmpl" /> |
---|
516 | Controlling Visualization from Compiled Code |
---|
517 | </para></listitem> |
---|
518 | <listitem><para> |
---|
519 | <xref linkend="sect.VisAtt" /> |
---|
520 | Visualization Attributes |
---|
521 | </para></listitem> |
---|
522 | <listitem><para> |
---|
523 | <xref linkend="sect.VisEnhTrj" /> |
---|
524 | Enhanced Trajectory Drawing |
---|
525 | </para></listitem> |
---|
526 | <listitem><para> |
---|
527 | <xref linkend="sect.VisPlylMrkTxt" /> |
---|
528 | Polylines, Markers and Text |
---|
529 | </para></listitem> |
---|
530 | <listitem><para> |
---|
531 | <xref linkend="sect.MkMovie" /> |
---|
532 | Making a Movie |
---|
533 | </para></listitem> |
---|
534 | </itemizedlist> |
---|
535 | </para> |
---|
536 | |
---|
537 | <para> |
---|
538 | Other useful references for Geant4 visualization outside of this |
---|
539 | user guide: |
---|
540 | |
---|
541 | <itemizedlist spacing="compact"> |
---|
542 | <listitem><para> |
---|
543 | Introduction to Geant4 Visualization ( |
---|
544 | <ulink url="http://geant4.slac.stanford.edu/Presentations/vis/G4VisTutorial.pdf"> |
---|
545 | pdf</ulink>, |
---|
546 | <ulink url="http://geant4.slac.stanford.edu/Presentations/vis/G4VisTutorial.ppt"> |
---|
547 | ppt</ulink> ) |
---|
548 | </para></listitem> |
---|
549 | <listitem><para> |
---|
550 | Status of Geant4 Visualization (giving current status and a |
---|
551 | summary of what has been improved over the last few releases) ( |
---|
552 | <ulink url="http://geant4.slac.stanford.edu/Presentations/vis/G4VisStatus.pdf"> |
---|
553 | pdf</ulink>, |
---|
554 | <ulink url="http://geant4.slac.stanford.edu/Presentations/vis/G4VisStatus.ppt"> |
---|
555 | ppt</ulink> ) |
---|
556 | </para></listitem> |
---|
557 | <listitem><para> |
---|
558 | Macro files distributed in Geant4 source in |
---|
559 | <literal>examples/novice/N03/visTutor/</literal>. |
---|
560 | </para></listitem> |
---|
561 | </itemizedlist> |
---|
562 | </para> |
---|
563 | |
---|
564 | |
---|
565 | </sect2> |
---|
566 | </sect1> |
---|