source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch08s04.html@ 901

Last change on this file since 901 was 901, checked in by garnier, 17 years ago

Add Geant4 Documentation at 8.12.2008

File size: 36.5 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>8.4.  Controlling Visualization from Commands</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="ch08.html" title="Chapter 8.  Visualization"><link rel="prev" href="ch08s03.html" title="8.3.  The Visualization Drivers"><link rel="next" href="ch08s05.html" title="8.5.  Controlling Visualization from Compiled Code"><script language="JavaScript">
2function 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">8.4. 
9Controlling Visualization from Commands
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08s03.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 8. 
11Visualization
12</th><td width="20%" align="right"> <a accesskey="n" href="ch08s05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.VisCntCmmd"></a>8.4. 
13Controlling Visualization from Commands
14</h2></div></div></div><p>
15This section describes just a few of the more commonly used
16visualization commands. For the complete list of commands and
17options, see the
18<a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
19Control...UICommands</a> section of this user guide.
20</p><p>
21For simplicity, this section assumes that the Geant4 executable
22was compiled incorporating the DAWNFILE and the OpenGL-Xlib
23drivers. For details on creating an executable for visualization
24see <a href="ch08s02.html" title="8.2. 
25Adding Visualization to Your Executable
26">Section 8.2</a>.
27</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.ScnHndVw"></a>8.4.1. 
28Scene, scene handler, and viewer
29</h3></div></div></div><p>
30In using the visualization commands, it is useful to know the
31concept of "scene", "scene handler", and "viewer". A "scene" is a
32set of visualizable raw 3D data. A "scene handler" is a
33graphics-data modeler, which processes raw data in a scene for
34later visualization. And a "viewer" generates images based on data
35processed by a scene handler. Roughly speaking, a set of a scene
36handler and a viewer corresponds to a visualization driver.
37</p><p>
38The steps of performing Geant4 visualization are explained
39below, though some of these steps may be done for you so that in
40practice you may use as few as just two commands (such as /vis/open
41OGLIX plus /vis/drawVolume) The seven steps of visualization are:
42
43</p><div class="itemizedlist"><ul type="disc" compact><li><p>
44 Step 1. Create a scene handler and a viewer.
45 </p></li><li><p>
46 Step 2. Create an empty scene.
47 </p></li><li><p>
48 Step 3. Add raw 3D data to the created scene.
49 </p></li><li><p>
50 Step 4. Attach the current scene handler to the current scene.
51 </p></li><li><p>
52 Step 5. Set camera parameters, drawing style (wireframe/surface), etc.
53 </p></li><li><p>
54 Step 6. Make the viewer execute visualization.
55 </p></li><li><p>
56 Step 7. Declare the end of visualization for flushing.
57 </p></li></ul></div><p>
58</p><p>
59These seven steps can be controlled explicitly to create
60multiple scenes and multiple viewers, each with its own set of
61parameters, with easy switching from one scene to another. But for
62the most common case of just having one scene and one viewer, many
63steps are handled implicitly for you.
64</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.CrtScnVw"></a>8.4.2. 
65Create a scene handler and a viewer: <code class="literal">/vis/open</code> command
66</h3></div></div></div><p>
67Command "<code class="literal">/vis/open</code>" creates a scene handler and a viewer,
68which corresponds to Step 1.
69</p><p>
70<span class="bold"><strong>Command: </strong></span>
71<code class="literal">/vis/open [driver_tag_name]</code>
72</p><div class="itemizedlist"><ul type="disc" compact><li><p>
73 <span class="bold"><strong>Argument</strong></span>
74 </p><p>
75 A name of (a mode of) an available visualization driver.
76 </p><p>
77 </p></li><li><p>
78 <span class="bold"><strong>Action</strong></span>
79 </p><p>
80 Create a visualization driver, i.e. a set of a scene hander and a
81 viewer.
82 </p><p>
83 </p></li><li><p>
84 <span class="bold"><strong>Example: Create the OpenGL-Xlib driver with its
85 immediate mode</strong></span>
86 </p><p>
87 <code class="literal">Idle&gt; /vis/open OGLIX</code>
88 </p><p>
89 </p></li><li><p>
90 <span class="bold"><strong>Additional notes</strong></span>
91 </p><p>
92 For immediate viewers, such as OGLIX, your geometry will
93 immediately be rendered in the new GL window
94 </p><p>
95 </p></li></ul></div><p>
96How to list available driver_tag_name:
97
98</p><pre class="programlisting">
99Idle&gt; help /vis/open
100</pre><p>
101
102or
103
104</p><div class="informalexample"><pre class="programlisting">
105Idle&gt; help /vis/sceneHandler/create
106</pre></div><p>
107
108The list is, for example, displayed as follows:
109
110</p><div class="informalexample"><pre class="programlisting">
111.....
112Candidates : DAWNFILE OGLIX OGLSX
113.....
114</pre></div><p>
115</p><p>
116For additional options, see the
117<a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
118Control...UICommands</a> section of this user guide.
119</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.CrtEmp"></a>8.4.3. 
120Create an empty scene: <code class="literal">/vis/scene/create</code> command
121</h3></div></div></div><p>
122Command "<code class="literal">/vis/scene/create</code>" creates an empty scene,
123which corresponds to Step 2.
124</p><p>
125<span class="bold"><strong>Command: </strong></span>
126<code class="literal">
127/vis/scene/create [scene_name]
128</code>
129</p><div class="itemizedlist"><ul type="disc" compact><li><p><span class="bold"><strong>Argument</strong></span>
130 </p><p>
131 A name for this scene. Created for you if you don't specify one.
132 </p><p>
133 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.PhyVol"></a>8.4.4. 
134Visualization of a physical volume: <code class="literal">/vis/drawVolume</code> command
135</h3></div></div></div><p>
136Command "<code class="literal">/vis/drawVolume</code>" adds a physical volume to the
137scene. It also does some of the other steps, if you haven't done
138them explicitly. It takes care of steps 2, 3, 4 and 6. Command
139"<code class="literal">/vis/viewer/flush</code>" should follow in order to do the final
140Step 7.
141</p><p>
142<span class="bold"><strong>Commands:</strong></span>
143</p><p>
144</p><div class="informalexample"><pre class="programlisting">
145/vis/drawVolume [physical-volume-name]
146.....
147Idle&gt; /vis/viewer/flush
148</pre></div><p>
149</p><div class="itemizedlist"><ul type="disc" compact><li><p>
150 <span class="bold"><strong>Argument</strong></span>
151 </p><p>
152 A physical-volume name. The default value is "world", which is
153 omittable.
154 </p><p>
155 </p></li><li><p>
156 <span class="bold"><strong>Action</strong></span>
157 </p><p>
158 Creates a scene consisting of the given physical volume and asks
159 the current viewer to draw it. The scene becomes current. Command
160 "<code class="literal">/vis/viewer/flush</code>" should follow this command in order to
161 declare end of visualization.
162 </p><p>
163 </p></li><li><p>
164 <span class="bold"><strong>Example: Visualization of the whole world with
165 coordinate axes</strong></span>
166 </p><div class="informalexample"><pre class="programlisting">
167 Idle&gt; /vis/drawVolume
168 Idle&gt; /vis/scene/add/axes 0 0 0 500 mm
169 Idle&gt; /vis/viewer/flush
170 </pre></div><p>
171 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.LogVol"></a>8.4.5. 
172Visualization of a logical volume: <code class="literal">/vis/specify</code> command
173</h3></div></div></div><p>
174Command "<code class="literal">/vis/specify</code>" visualizes a logical volume. If
175allows you to control how much details is shown and whether to show
176booleans, voxels and readout geometries. It also does some of the
177other steps, if you haven't done them explicitly. It takes care of
178steps 2, 3, 4 and 6. Command "<code class="literal">/vis/viewer/flush</code>" should
179follow the command in order to do the final Step 7.
180</p><p>
181<span class="bold"><strong>Command: </strong></span>
182<code class="literal">/vis/specify [logical-volume-name][depth-of-descent]
183[booleans-flag] [voxels-flag] [readout-flag]</code>
184</p><div class="itemizedlist"><ul type="disc" compact><li><p>
185 <span class="bold"><strong>Argument</strong></span>
186 </p><p>
187 A logical-volume name.
188 </p><p>
189 </p></li><li><p>
190 <span class="bold"><strong>Action</strong></span>
191 </p><p>
192 Creates a scene consisting of the given logical volume and asks the
193 current viewer to draw it. The scene becomes current.
194 </p><p>
195 </p></li><li><p>
196 <span class="bold"><strong>Example (visualization of a selected logical
197 volume with coordinate axes)</strong></span>
198
199 </p><div class="informalexample"><pre class="programlisting">
200 Idle&gt; /vis/specify Absorber
201 Idle&gt; /vis/scene/add/axes 0 0 0 500 mm
202 Idle&gt; /vis/scene/add/text 0 0 0 mm 40 -100 -200 LogVol:Absorber
203 Idle&gt; /vis/viewer/flush
204 </pre></div><p>
205 </p></li></ul></div><p>
206For more options, see the
207<a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
208Control...UICommands</a> section of this user guide.
209</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.Traj"></a>8.4.6. 
210Visualization of trajectories: <code class="literal">/vis/scene/add/trajectories</code> command
211</h3></div></div></div><p>
212
213Command "<code class="literal">/vis/scene/add/trajectories [smooth] [rich]</code>"
214adds trajectories to the current scene. The optional
215parameters "smooth" and/or "rich" (you may specify either, both or
216neither) invoke, if "smooth" is specified, the storing and displaying
217of extra points on curved trajectories and, if "rich" is specified,
218the storing, for possible subsequent selection and display, of
219additional information, such as volume names, creator process, energy
220deposited, global time. Be aware, of course, that this imposes
221computational and memory overheads. Note that this automatically
222issues the appropriate
223"<code class="literal">/tracking/storeTrajectory</code>" command so that trajectories are
224stored (by default they are not). The visualization is performed
225with the command "<code class="literal">/run/beamOn</code>" unless you have non-default
226values for /vis/scene/endOfEventAction or /vis/scene/endOfRunAction
227(described below).
228</p><p>
229<span class="bold"><strong>Command: </strong></span>
230<code class="literal">/vis/scene/add/trajectories [smooth] [rich]</code>
231</p><div class="itemizedlist"><ul type="disc" compact><li><p>
232 <span class="bold"><strong>Action</strong></span>
233 </p><p>
234 The command adds trajectories to the current scene. Trajectories
235 are drawn at end of event when the scene in which they are added is
236 current.
237 </p><p>
238 </p></li><li><p>
239 <span class="bold"><strong>Example: Visualization of trajectories</strong></span>
240 </p><div class="informalexample"><pre class="programlisting">
241 Idle&gt; /vis/scene/add/trajectories
242 Idle&gt; /run/beamOn 10
243 </pre></div><p>
244 </p></li><li><p>
245 <span class="bold"><strong>Additional note 1</strong></span>
246 </p><p>
247 See the section
248 <a href="ch08s07.html#sect.VisEnhTrj.CntlComm" title="8.7.3. 
249Controlling from Commands
250">Section 8.7.3</a>
251 Enhanced Trajectory Drawing
252 for details on how to control how trajectories are
253 color-coded.
254 </p><p>
255 </p></li></ul></div><p>
256For more options, see the
257<a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
258Control...UICommands </a> section of this user guide.
259</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.Hits"></a>8.4.7. 
260Visualization of hits: <code class="literal">/vis/scene/add/hits</code> command
261</h3></div></div></div><p>
262Command "<code class="literal">/vis/scene/add/hits</code>" adds hits to the current
263scene, assuming that you have a hit class and that the hits have
264visualization information. The visualization is performed with the
265command "<code class="literal">/run/beamOn</code>" unless you have non-default values
266for /vis/scene/endOfEventAction or /vis/scene/endOfRunAction
267(described above).
268</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.HrAtHits"></a>8.4.8. 
269HepRep Attributes for Hits
270</h3></div></div></div><p>
271The HepRep file formats, HepRepFile and HepRepXML, attach various
272attributes to hits such that you can view these attributes, label
273trajectories by these attributes or make visibility cuts based on
274these attributes. Examples of adding HepRep attributes to hit
275classes can be found in examples /extended/analysis/A01 and
276/extended/runAndEvent/RE01.
277</p><p>
278For example, in example RE01's class RE01CalorimeterHit.cc,
279available attributes will be:
280
281</p><div class="itemizedlist"><ul type="disc" compact><li><p>
282 Hit Type
283 </p></li><li><p>
284 Track ID
285 </p></li><li><p>
286 Z Cell ID
287 </p></li><li><p>
288 Phi Cell ID
289 </p></li><li><p>
290 Energy Deposited
291 </p></li><li><p>
292 Energy Deposited by Track
293 </p></li><li><p>
294 Position
295 </p></li><li><p>
296 Logical Volume
297 </p></li></ul></div><p>
298</p><p>
299You can add additional attributes of your choosing by modifying the
300relevant part of the hit class (look for the methods GetAttDefs and
301CreateAttValues).
302</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.BscCmrWrk"></a>8.4.9. 
303Basic camera workings: <code class="literal">/vis/viewer/</code> commands
304</h3></div></div></div><p>
305Commands in the command directory "<code class="literal">/vis/viewer/</code>" set
306camera parameters and drawing style of the current viewer, which
307corresponds to Step 5. Note that the camera parameters and the
308drawing style should be set separately for each viewer. They can be
309initialized to the default values with command
310"<code class="literal">/vis/viewer/reset</code>". Some visualization systems, such as
311the VRML and HepRep browsers also allow camera control from the
312standalone graphics application.
313</p><p>
314Just a few of the camera commands are described here. For more
315commands, see the
316<a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
317Control...UICommands</a> section of this user guide.
318</p><p>
319</p><p><span class="bold"><strong>Command: </strong></span>
320<code class="literal">/vis/viewer/set/viewpointThetaPhi [theta] [phi]
321[deg|rad]</code>
322</p><p>
323
324</p><div class="itemizedlist"><ul type="disc" compact><li><p>
325 <span class="bold"><strong>Arguments</strong></span>
326 </p><p>
327 Arguments "theta" and "phi" are polar and azimuthal camera angles,
328 respectively. The default unit is "degree".
329 </p><p>
330 </p></li><li><p>
331 <span class="bold"><strong>Action</strong></span>
332 </p><p>
333 Set a view point in direction of (theta, phi).
334 </p><p>
335 </p></li><li><p>
336 <span class="bold"><strong>Example: Set the viewpoint in direction of (70 deg,
337 20 deg)</strong></span>
338
339 /</p><div class="informalexample"><pre class="programlisting">
340 Idle&gt; /vis/viewer/set/viewpointThetaPhi 70 20
341 </pre></div><p>
342 </p></li><li><p>
343 <span class="bold"><strong>Additional notes</strong></span>
344 </p><p>
345 Camera parameters should be set for each viewer. They are
346 initialized with command "<code class="literal">/vis/viewer/reset</code>".
347 </p><p>
348 </p></li></ul></div><p>
349
350</p><p>
351<span class="bold"><strong>Command: </strong></span>
352<code class="literal">/vis/viewer/zoom [scale_factor]</code>
353</p><p>
354
355</p><div class="itemizedlist"><ul type="disc" compact><li><p>
356 <span class="bold"><strong>Argument</strong></span>
357 </p><p>
358 The scale factor. The command multiplies magnification of the view
359 by this factor.
360 </p><p>
361 </p></li><li><p>
362 <span class="bold"><strong>Action</strong></span>
363 </p><p>
364 Zoom up/down of view.
365 </p><p>
366 </p></li><li><p>
367 <span class="bold"><strong>Example: Zoom up by factor 1.5</strong></span>
368 </p><div class="informalexample"><pre class="programlisting">
369 Idle&gt; /vis/viewer/zoom 1.5
370 </pre></div><p>
371 </p></li><li><p>
372 <span class="bold"><strong>Additional notes</strong></span>
373 </p><p>
374 Camera parameters should be set for each viewer. They are
375 initialized with command "<code class="literal">/vis/viewer/reset</code>".
376 </p><p>
377 </p><p>
378 A similar pair of commands, scale and scaleTo allow non-uniform
379 scaling (i.e., zoom differently along different axes). For details,
380 see the
381 <a href="./AllResources/Control/UIcommands/_vis_.html" target="_top">
382 Control...UICommands</a> section of this user guide.
383 </p><p>
384 </p></li></ul></div><p>
385</p><p>
386<span class="bold"><strong>Command: </strong></span>
387<code class="literal">/vis/viewer/set/style [style_name]</code>
388</p><div class="itemizedlist"><ul type="disc" compact><li><p>
389 <span class="bold"><strong>Arguments</strong></span>
390 </p><p>
391 Candidate values of the argument are "wireframe" and "surface".
392 ("w" and "s" also work.)
393 </p><p>
394 </p></li><li><p>
395 <span class="bold"><strong>Action</strong></span>
396 </p><p>
397 Set a drawing style to wireframe or surface.
398 </p><p>
399 </p></li><li><p>
400 <span class="bold"><strong>Example: Set the drawing style to "surface"</strong></span>
401 </p><div class="informalexample"><pre class="programlisting">
402 Idle&gt; /vis/viewer/set/style surface
403 </pre></div><p>
404 </p></li><li><p>
405 <span class="bold"><strong>Additional notes</strong></span>
406 </p><p>
407 The style of some geometry components may have been forced one way
408 or the other through calls in compiled code. The set/style command
409 will NOT override such force styles.
410 </p><p>
411 </p><p>
412 Drawing style should be set for each viewer. The drawing style is
413 initialized with command "<code class="literal">/vis/viewer/reset</code>".
414 </p><p>
415 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.DclEndFlsh"></a>8.4.10. 
416Declare the end of visualization for flushing: <code class="literal">/vis/viewer/flush</code> command
417</h3></div></div></div><p>
418<span class="bold"><strong>Command: </strong></span>
419<code class="literal">/vis/viewer/flush</code>
420</p><div class="itemizedlist"><ul type="disc" compact><li><p>
421 <span class="bold"><strong>Action</strong></span>
422 </p><p>
423 Declare the end of visualization for flushing.
424 </p><p>
425 </p></li><li><p>
426 <span class="bold"><strong>Additional notes</strong></span>
427 </p><p>
428 Command "<code class="literal">/vis/viewer/flush</code>" should follow
429 "<code class="literal">/vis/drawVolume</code>", "<code class="literal">/vis/specify</code>",
430 etc in order to complete visualization. It corresponds to Step 7.
431 </p><p>
432 </p><p>
433 The flush is done automatically after every /run/beamOn command
434 unless you have non-default values for /vis/scene/endOfEventAction
435 or /vis/scene/endOfRunAction (described above).
436 </p><p>
437 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.EndEvtRun"></a>8.4.11. 
438End of Event Action and End of Run Action:
439<code class="literal">/vis/viewer/endOfEventAction</code> and
440<code class="literal">/vis/viewer/endOfEventAction</code> commands
441</h3></div></div></div><p>
442By default, a separate picture is created for each event. You can
443change this behavior to accumulate multiple events, or even
444multiple runs, in a single picture.
445</p><p>
446<span class="bold"><strong>Command: </strong></span>
447<code class="literal">/vis/scene/endOfEventAction [refresh|accumulate]</code>
448</p><div class="itemizedlist"><ul type="disc" compact><li><p>
449 <span class="bold"><strong>Action</strong></span>
450 </p><p>
451 Control how often the picture should be cleared.
452 <code class="literal">refresh</code> means each event will be written to a new
453 picture.
454 <code class="literal">accumulate</code> means events will be accumulated into a single
455 picture. Picture will be flushed at end of run, unless you have
456 also set <code class="literal">/vis/scene/endOfRunAction accumulate</code>
457 </p><p>
458 </p></li><li><p>
459 <span class="bold"><strong>Additional note</strong></span>
460 </p><p>
461 You may instead choose to use update commands from your
462 BeginOfRunAction or EndOfEventAction, as in early examples, but now
463 the vis manager ia able to do most of what most users require
464 through the above commands.
465 </p><p>
466 </p></li></ul></div><p>
467<span class="bold"><strong>Command: </strong></span>
468<code class="literal">/vis/scene/endOfRunAction [refresh|accumulate]</code>
469</p><div class="itemizedlist"><ul type="disc" compact><li><p>
470 <span class="bold"><strong>Action</strong></span>
471 </p><p>
472 Control how often the picture should be cleared.
473 <code class="literal">refresh</code> means each run will be written to a new
474 picture.
475 <code class="literal">accumulate</code> means runs will be accumulated into a single
476 picture. To start a new picture, you must explicitly issue
477 <code class="literal">/vis/viewer/refresh</code>, <code class="literal">/vis/viewer/update</code>
478 or <code class="literal">/vis/viewer/flush</code>
479 </p><p>
480 </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.HpRpTraj"></a>8.4.12. 
481HepRep Attributes for Trajectories
482</h3></div></div></div><p>
483The HepRep file formats, HepRepFile and HepRepXML, attach various
484attributes to trajectories such that you can view these attributes,
485label trajectories by these attributes or make visibility cuts
486based on these attributes. If you use the default Geant4 trajectory
487class from /tracking/src/G4Trajectory.cc (this is what you get with
488the plain <code class="literal">/vis/scene/add/trajectories</code> command),
489available attributes will be:
490
491</p><div class="itemizedlist"><ul type="disc" compact><li><p>
492 Track ID
493 </p></li><li><p>
494 Parent ID
495 </p></li><li><p>
496 Particle Name
497 </p></li><li><p>
498 Charge
499 </p></li><li><p>
500 PDG Encoding
501 </p></li><li><p>
502 Momentum 3-Vector
503 </p></li><li><p>
504 Momentum magnitude
505 </p></li><li><p>
506 Number of points
507 </p></li></ul></div><p>
508</p><p>
509Using <code class="literal">/vis/scene/add/trajectories rich</code> will get you
510additional attributes.
511You may also add additional attributes of your choosing by modifying the
512relevant part of G4Trajectory (look for the methods GetAttDefs and
513CreateAttValues). If you are using your own trajectory class, you
514may want to consider copying these methods from G4Trajectory.
515</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.SvVwPs"></a>8.4.13. 
516How to save a visualized views to PostScript files
517</h3></div></div></div><p>
518Most of the visualization drivers offer ways to save visualized
519views to PostScript files (or Encapsulated PostScript (EPS) files)
520by themselves.
521</p><p>
522The DAWNFILE driver, which co-works with Fukui Renderer DAWN,
523generates "vectorized" PostScript data with "analytical
524hidden-line/surface removal", and so it is well suited for
525technical high-quality outputs for presentation, documentation, and
526debugging geometry. In the default setting of the DAWNFILE drivers,
527EPS files named "<code class="literal">g4_00.eps, g4_01.eps, g4_02.eps</code>,..." are
528automatically generated in the current directory each time when
529visualization is performed, and then a PostScript viewer
530"<code class="literal">gv</code>"is automatically invoked to visualize the generated
531EPS files.
532</p><p>
533For large data sets, it may take time to generate the vectorized
534PostScript data. In such a case, visualize the 3D scene with a
535faster visualization driver beforehand for previewing, and then use
536the DAWNFILE drivers. For example, the following visualizes the
537whole detector with the OpenGL-Xlib driver (immediate mode) first,
538and then with the DAWNFILE driver to generate an EPS file
539<code class="literal">g4_XX.eps</code> to save the visualized view:
540
541</p><div class="informalexample"><pre class="programlisting">
542# Invoke the OpenGL visualization driver in its immediate mode
543/vis/open OGLIX
544
545# Camera setting
546/vis/viewer/set/viewpointThetaPhi 20 20
547
548# Camera setting
549/vis/drawVolume
550/vis/viewer/flush
551
552# Invoke the DAWNFILE visualization driver
553/vis/open DAWNFILE
554
555# Camera setting
556/vis/viewer/set/viewpointThetaPhi 20 20
557
558# Camera setting
559/vis/drawVolume
560/vis/viewer/flush
561</pre></div><p>
562</p><p>
563This is a good example to show that the visualization drivers are
564complementary to each other.
565</p><p>
566In the OpenInventor drivers, you can simply click the "Print"
567button on their GUI to generate a PostScript file as a hard copy of
568a visualized view.
569</p><p>
570The OpenGL X drivers can also generate PostScript files, either from
571a pull-down menu (Motif drivers) or with <code class="literal">/vis/ogl/printEPS</code>.
572It can generate either vectorized or rasterized PostScript
573data. In generating vectorized PostScript data, hidden-surface
574removal is performed, based on the painter's algorithm after
575dividing facets of shapes into small sub-triangles.
576</p><p>
577The WIRED3 HepRep Browser and WIRED4 JAS Plug-In can generate a
578wide variety of bitmap and vector output formats including
579PostScript and PDF.
580</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.Cull"></a>8.4.14. 
581Culling
582</h3></div></div></div><p>
583"Culling" means to skip visualizing parts of a 3D scene. Culling is
584useful for avoiding complexity of visualized views, keeping
585transparent features of the 3D scene, and for quick visualization.
586</p><p>
587Geant4 Visualization supports the following 3 kinds of
588culling:
589
590</p><div class="itemizedlist"><ul type="disc" compact><li><p>
591 Culling of invisible physical volumes
592 </p></li><li><p>
593 Culling of low density physical volumes.
594 </p></li><li><p>
595 Culling of covered physical volumes by others
596 </p></li></ul></div><p>
597</p><p>
598In order that one or all types of the above culling are on, i.e.,
599activated, the global culling flag should also be on.
600</p><p>
601<a href="ch08s04.html#table.VisCntCmmd_1" title="Table 8.2. 
602The default culling policies.
603">Table 8.2</a> summarizes the default culling policies.
604
605</p><div class="table"><a name="table.VisCntCmmd_1"></a><div class="table-contents"><table summary="
606The default culling policies.
607" border="1"><colgroup><col><col></colgroup><tbody><tr><td align="center">
608 <span class="bold"><strong>Culling Type</strong></span>
609 </td><td align="center">
610 <span class="bold"><strong>Default Value</strong></span>
611 </td></tr><tr><td align="center">
612 global
613 </td><td align="center">
614 ON
615 </td></tr><tr><td align="center">
616 invisible
617 </td><td align="center">
618 ON
619 </td></tr><tr><td align="center">
620 low density
621 </td><td align="center">
622 OFF
623 </td></tr><tr><td align="center">
624 covered daughter
625 </td><td align="center">
626 OFF
627 </td></tr></tbody></table></div><p class="title"><b>Table 8.2. 
628The default culling policies.
629</b></p></div><p><br class="table-break">
630</p><p>
631The default threshold density of the low-density culling is 0.01
632g/cm<sup>3</sup>.
633</p><p>
634The default culling policies can be modified with the following
635visualization commands. (Below the argument <code class="literal">flag</code> takes a
636value of <code class="literal">true</code> or <code class="literal">false</code>.)
637
638</p><div class="informalexample"><pre class="programlisting">
639 # global
640 /vis/viewer/set/culling global flag
641
642 # invisible
643 /vis/viewer/set/culling invisible flag
644
645 # low density
646 # "value" is a proper value of a treshold density
647 # "unit" is either g/cm3, mg/cm3 or kg/m3
648 /vis/viewer/set/culling density flag value unit
649
650 # covered daughter
651 /vis/viewer/set/culling coveredDaughters flag density
652</pre></div><p>
653</p><p>
654The HepRepFile graphic system will, by default, include culled
655objects in the file so that they can still be made visible later
656from controls in the HepRep browser. If this behavior would cause
657files to be too large, you can instead choose to have culled
658objects be omitted from the HepRep file. See details in the
659HepRepFile Driver section of this user guide.
660</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.CutVw"></a>8.4.15. 
661Cut view
662</h3></div></div></div><h5><a name="id510671"></a>
663Sectioning
664</h5><p>
665"Sectioning" means to make a thin slice of a 3D scene around a
666given plane. At present, this function is supported by the OpenGL
667drivers. The sectioning is realized by setting a sectioning plane
668before performing visualization. The sectioning plane can be set by
669the command,
670
671</p><div class="informalexample"><pre class="programlisting">
672 /vis/viewer/set/sectionPlane on x y z units nx ny nz
673</pre></div><p>
674
675where the vector (x,y,z) defines a point on the sectioning plane,
676and the vector (nx,ny,nz) defines the normal vector of the
677sectioning plane. For example, the following sets a sectioning
678plane to a yz plane at x = 2 cm:
679
680</p><div class="informalexample"><pre class="programlisting">
681 Idle&gt; /vis/viewer/set/sectionPlane on 2.0 0.0 0.0 cm 1.0 0.0 0.0
682</pre></div><p>
683</p><h5><a name="id510706"></a>
684Cutting away
685</h5><p>
686"Cutting away" means to remove a half space, defined with a plane,
687from a 3D scene.
688
689</p><div class="itemizedlist"><ul type="disc" compact><li><p>
690 Cutting away is supported by the DAWNFILE driver "off-line". Do
691 the following:
692
693 </p><div class="itemizedlist"><ul type="circle" compact><li><p>
694 Perform visualization with the DAWNFILE driver to generate a
695 file <code class="literal">g4.prim</code>, describing the whole 3D scene.
696 </p></li><li><p>
697 Make the application "DAWNCUT" read the generated file to make
698 a view of cutting away.
699 </p></li></ul></div><p>
700
701 See the following WWW page for details:
702 <a href="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html" target="_top">
703 http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html
704 </a>
705 </p></li><li><p>
706 Alternatively, add up to three cutaway planes:
707
708 </p><div class="informalexample"><pre class="programlisting">
709 /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0
710 /vis/viewer/addCutawayPlane 0 0 0 m 0 1 0
711 ...
712 </pre></div><p>
713 and, for more that one plane, you can change the mode to
714
715 </p><div class="itemizedlist"><ul type="circle" compact><li><p>
716 (a) "add" or, equivalently, "union" (default) or
717 </p></li><li><p>
718 (b) "multiply" or, equivalently, "intersection":
719 </p></li></ul></div><p>
720
721 </p><div class="informalexample"><pre class="programlisting">
722 /vis/viewer/set/cutawayMode multiply
723 </pre></div><p>
724
725 To de-activate:
726
727 </p><div class="informalexample"><pre class="programlisting">
728 /vis/viewer/clearCutawayPlanes
729 </pre></div><p>
730
731 OpenGL supports this feature.
732 </p></li></ul></div><p>
733</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.VisCntCmmd.TutMac"></a>8.4.16. 
734Tutorial macros
735</h3></div></div></div><p>
736The followings are tutorial macros in the directory
737<code class="literal">examples/novice/N03/visTutor/</code>:
738
739</p><div class="itemizedlist"><ul type="disc" compact><li><p>
740 <a href="./Visualization/visTutor/exN03Vis0_mac.html" target="_top">
741 exN03Vis0.mac:</a>
742 </p><p>
743 A basic macro for visualization of detector geometry and events
744 using OpenGL in Immediate mode and DAWN.
745 </p><p>
746 </p></li><li><p>
747 <a href="./Visualization/visTutor/exN03Vis1_mac.html" target="_top">
748 exN03Vis1.mac:</a>
749 </p><p>
750 A basic macro for visualization of detector geometry using OpenGL
751 in Stored mode and DAWN.
752 </p><p>
753 </p></li><li><p>
754 <a href="./Visualization/visTutor/exN03Vis2_mac.html" target="_top">
755 exN03Vis2.mac:</a>
756 </p><p>
757 A basic macro for visualization of detector geometry and events
758 using OpenGL in Stored mode and DAWN.
759 </p><p>
760 </p></li><li><p>
761 <a href="./Visualization/visTutor/exN03Vis3_mac.html" target="_top">
762 exN03Vis3.mac:</a>
763 </p><p>
764 A basic macro for demonstrating various drawing styles using OpenGL
765 in Immediate mode and DAWN.
766 </p><p>
767 </p></li><li><p>
768 <a href="./Visualization/visTutor/exN03Vis4_mac.html" target="_top">
769 exN03Vis4.mac:</a>
770 </p><p>
771 An example of visualizing specific logical volumes using OpenGL in
772 Immediate mode and DAWN.
773 </p><p>
774 </p></li><li><p>
775 <a href="./Visualization/visTutor/exN03Vis5_mac.html" target="_top">
776 exN03Vis5.mac:</a>
777 </p><p>
778 A basic macro for visualization of detector geometry and events
779 using OpenInventor on Unix.
780 </p><p>
781 </p></li><li><p>
782 <a href="./Visualization/visTutor/exN03Vis6_mac.html" target="_top">
783 exN03Vis6.mac:</a>
784 </p><p>
785 A basic macro for visualization of detector geometry and events
786 using VRML.
787 </p><p>
788 </p></li><li><p>
789 <a href="./Visualization/visTutor/exN03Vis7_mac.html" target="_top">
790 exN03Vis7.mac:</a>
791 </p><p>
792 A macro to demonstrate "batch" visualization to generate PostScript
793 files with the DAWNFILE driver
794 </p><p>
795 </p></li><li><p>
796 <a href="./Visualization/visTutor/exN03Vis8_mac.html" target="_top">
797 exN03Vis8.mac:</a>
798 </p><p>
799 A macro to demonstrate creation of a "multi-page" PostScript file
800 with the DAWNFILE driver
801 </p><p>
802 </p></li><li><p>
803 <a href="./Visualization/visTutor/exN03Vis9_mac.html" target="_top">
804 exN03Vis9.mac:</a>
805 </p><p>
806 A basic macro for visualization of detector geometry and events
807 using OpenGL for Windows.
808 </p><p>
809 </p></li><li><p>
810 <a href="./Visualization/visTutor/exN03Vis10_mac.html" target="_top">
811 exN03Vis10.mac:</a>
812 </p><p>
813 A basic macro for visualization of detector geometry and events
814 using OpenInventor on Windows.
815 </p><p>
816 </p></li><li><p>
817 <a href="./Visualization/visTutor/exN03Vis11_mac.html" target="_top">
818 exN03Vis11.mac:</a>
819 </p><p>
820 A basic macro for visualization of detector geometry and events
821 using OpenGL in Stored Motif mode and DAWN.
822 </p><p>
823 </p></li><li><p>
824 <a href="./Visualization/visTutor/exN03Vis12_mac.html" target="_top">
825 exN03Vis12.mac:</a> and
826 <a href="./Visualization/visTutor/exN03Vis12_loop.html" target="_top">
827 exN03Vis12.loop:</a>
828 </p><p>
829 A basic macro for demonstrating time slicing.
830 </p><p>
831 </p></li><li><p>
832 <a href="./Visualization/visTutor/exN03Vis13_mac.html" target="_top">
833 exN03Vis13.mac:</a> and
834 <a href="./Visualization/visTutor/exN03Vis13_loop.html" target="_top">
835 exN03Vis3.loop:</a>
836 </p><p>
837 Time development of an electrmagnetic shower.
838 </p><p>
839 </p></li><li><p>
840 <a href="./Visualization/visTutor/exN03Tree0_mac.html" target="_top">
841 exN03Tree0.mac:</a>
842 </p><p>
843 A macro to demonstrate ASCII tree.
844 </p><p>
845 </p></li><li><p>
846 <a href="./Visualization/visTutor/exN03Tree1_mac.html" target="_top">
847 exN03Tree1.mac:</a>
848 </p><p>
849 A macro to demonstrate GAG tree.
850 </p><p>
851 </p></li></ul></div><p>
852</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08s03.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch08s05.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">8.3. 
853The Visualization Drivers
854 </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"> 8.5. 
855Controlling Visualization from Compiled Code
856</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.