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