source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Visualization/commandcontrol.xml@ 917

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

update

File size: 34.9 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
5<!-- -->
6<!-- ******************************************************** -->
7
8
9<!-- ******************* Section (Level#1) ****************** -->
10<sect1 id="sect.VisCntCmmd">
11<title>
12Controlling Visualization from Commands
13</title>
14
15<para>
16This section describes just a few of the more commonly used
17visualization commands. For the complete list of commands and
18options, see the
19<ulink url="./AllResources/Control/UIcommands/_vis_.html">
20Control...UICommands</ulink> section of this user guide.
21</para>
22
23<para>
24For simplicity, this section assumes that the Geant4 executable
25was compiled incorporating the DAWNFILE and the OpenGL-Xlib
26drivers. For details on creating an executable for visualization
27see <xref linkend="sect.VisAddExe" />.
28</para>
29
30
31<!-- ******************* Section (Level#2) ****************** -->
32<sect2 id="sect.VisCntCmmd.ScnHndVw">
33<title>
34Scene, scene handler, and viewer
35</title>
36
37<para>
38In using the visualization commands, it is useful to know the
39concept of "scene", "scene handler", and "viewer". A "scene" is a
40set of visualizable raw 3D data. A "scene handler" is a
41graphics-data modeler, which processes raw data in a scene for
42later visualization. And a "viewer" generates images based on data
43processed by a scene handler. Roughly speaking, a set of a scene
44handler and a viewer corresponds to a visualization driver.
45</para>
46
47<para>
48The steps of performing Geant4 visualization are explained
49below, though some of these steps may be done for you so that in
50practice you may use as few as just two commands (such as /vis/open
51OGLIX plus /vis/drawVolume) The seven steps of visualization are:
52
53<itemizedlist spacing="compact">
54 <listitem><para>
55 Step 1. Create a scene handler and a viewer.
56 </para></listitem>
57 <listitem><para>
58 Step 2. Create an empty scene.
59 </para></listitem>
60 <listitem><para>
61 Step 3. Add raw 3D data to the created scene.
62 </para></listitem>
63 <listitem><para>
64 Step 4. Attach the current scene handler to the current scene.
65 </para></listitem>
66 <listitem><para>
67 Step 5. Set camera parameters, drawing style (wireframe/surface), etc.
68 </para></listitem>
69 <listitem><para>
70 Step 6. Make the viewer execute visualization.
71 </para></listitem>
72 <listitem><para>
73 Step 7. Declare the end of visualization for flushing.
74 </para></listitem>
75</itemizedlist>
76</para>
77
78<para>
79These seven steps can be controlled explicitly to create
80multiple scenes and multiple viewers, each with its own set of
81parameters, with easy switching from one scene to another. But for
82the most common case of just having one scene and one viewer, many
83steps are handled implicitly for you.
84</para>
85
86</sect2>
87
88<!-- ******************* Section (Level#2) ****************** -->
89<sect2 id="sect.VisCntCmmd.CrtScnVw">
90<title>
91Create a scene handler and a viewer: <literal>/vis/open</literal> command
92</title>
93
94<para>
95Command "<literal>/vis/open</literal>" creates a scene handler and a viewer,
96which corresponds to Step 1.
97</para>
98
99<para>
100<emphasis role="bold">Command: </emphasis>
101<literal>/vis/open [driver_tag_name]</literal>
102</para>
103
104<itemizedlist spacing="compact">
105 <listitem><para>
106 <emphasis role="bold">Argument</emphasis>
107 <para>
108 A name of (a mode of) an available visualization driver.
109 </para>
110 </para></listitem>
111 <listitem><para>
112 <emphasis role="bold">Action</emphasis>
113 <para>
114 Create a visualization driver, i.e. a set of a scene hander and a
115 viewer.
116 </para>
117 </para></listitem>
118 <listitem><para>
119 <emphasis role="bold">Example: Create the OpenGL-Xlib driver with its
120 immediate mode</emphasis>
121 <para>
122 <literal>Idle&gt; /vis/open OGLIX</literal>
123 </para>
124 </para></listitem>
125 <listitem><para>
126 <emphasis role="bold">Additional notes</emphasis>
127 <para>
128 For immediate viewers, such as OGLIX, your geometry will
129 immediately be rendered in the new GL window
130 </para>
131 </para></listitem>
132</itemizedlist>
133
134<para>
135How to list available driver_tag_name:
136
137<programlisting>
138Idle&gt; help /vis/open
139</programlisting>
140
141or
142
143<informalexample>
144<programlisting>
145Idle&gt; help /vis/sceneHandler/create
146</programlisting>
147</informalexample>
148
149The list is, for example, displayed as follows:
150
151<informalexample>
152<programlisting>
153.....
154Candidates : DAWNFILE OGLIX OGLSX
155.....
156</programlisting>
157</informalexample>
158</para>
159
160<para>
161For additional options, see the
162<ulink url="./AllResources/Control/UIcommands/_vis_.html">
163Control...UICommands</ulink> section of this user guide.
164</para>
165
166</sect2>
167
168
169<!-- ******************* Section (Level#2) ****************** -->
170<sect2 id="sect.VisCntCmmd.CrtEmp">
171<title>
172Create an empty scene: <literal>/vis/scene/create</literal> command
173</title>
174
175<para>
176Command "<literal>/vis/scene/create</literal>" creates an empty scene,
177which corresponds to Step 2.
178</para>
179
180<para>
181<emphasis role="bold">Command: </emphasis>
182<literal>
183/vis/scene/create [scene_name]
184</literal>
185</para>
186
187<itemizedlist spacing="compact">
188 <listitem><para><emphasis role="bold">Argument</emphasis>
189 <para>
190 A name for this scene. Created for you if you don't specify one.
191 </para>
192 </para></listitem>
193</itemizedlist>
194
195</sect2>
196
197
198<!-- ******************* Section (Level#2) ****************** -->
199<sect2 id="sect.VisCntCmmd.PhyVol">
200<title>
201Visualization of a physical volume: <literal>/vis/drawVolume</literal> command
202</title>
203
204<para>
205Command "<literal>/vis/drawVolume</literal>" adds a physical volume to the
206scene. It also does some of the other steps, if you haven't done
207them explicitly. It takes care of steps 2, 3, 4 and 6. Command
208"<literal>/vis/viewer/flush</literal>" should follow in order to do the final
209Step 7.
210</para>
211
212<para>
213<emphasis role="bold">Commands:</emphasis>
214</para>
215<para>
216<informalexample>
217<programlisting>
218/vis/drawVolume [physical-volume-name]
219.....
220Idle&gt; /vis/viewer/flush
221</programlisting>
222</informalexample>
223</para>
224
225<itemizedlist spacing="compact">
226 <listitem><para>
227 <emphasis role="bold">Argument</emphasis>
228 <para>
229 A physical-volume name. The default value is "world", which is
230 omittable.
231 </para>
232 </para></listitem>
233 <listitem><para>
234 <emphasis role="bold">Action</emphasis>
235 <para>
236 Creates a scene consisting of the given physical volume and asks
237 the current viewer to draw it. The scene becomes current. Command
238 "<literal>/vis/viewer/flush</literal>" should follow this command in order to
239 declare end of visualization.
240 </para>
241 </para></listitem>
242 <listitem><para>
243 <emphasis role="bold">Example: Visualization of the whole world with
244 coordinate axes</emphasis>
245 <informalexample>
246 <programlisting>
247 Idle&gt; /vis/drawVolume
248 Idle&gt; /vis/scene/add/axes 0 0 0 500 mm
249 Idle&gt; /vis/viewer/flush
250 </programlisting>
251 </informalexample>
252 </para></listitem>
253</itemizedlist>
254
255</sect2>
256
257
258<!-- ******************* Section (Level#2) ****************** -->
259<sect2 id="sect.VisCntCmmd.LogVol">
260<title>
261Visualization of a logical volume: <literal>/vis/specify</literal> command
262</title>
263
264<para>
265Command "<literal>/vis/specify</literal>" visualizes a logical volume. If
266allows you to control how much details is shown and whether to show
267booleans, voxels and readout geometries. It also does some of the
268other steps, if you haven't done them explicitly. It takes care of
269steps 2, 3, 4 and 6. Command "<literal>/vis/viewer/flush</literal>" should
270follow the command in order to do the final Step 7.
271</para>
272
273<para>
274<emphasis role="bold">Command: </emphasis>
275<literal>/vis/specify [logical-volume-name][depth-of-descent]
276[booleans-flag] [voxels-flag] [readout-flag]</literal>
277</para>
278
279<itemizedlist spacing="compact">
280 <listitem><para>
281 <emphasis role="bold">Argument</emphasis>
282 <para>
283 A logical-volume name.
284 </para>
285 </para></listitem>
286 <listitem><para>
287 <emphasis role="bold">Action</emphasis>
288 <para>
289 Creates a scene consisting of the given logical volume and asks the
290 current viewer to draw it. The scene becomes current.
291 </para>
292 </para></listitem>
293 <listitem><para>
294 <emphasis role="bold">Example (visualization of a selected logical
295 volume with coordinate axes)</emphasis>
296
297 <informalexample>
298 <programlisting>
299 Idle&gt; /vis/specify Absorber
300 Idle&gt; /vis/scene/add/axes 0 0 0 500 mm
301 Idle&gt; /vis/scene/add/text 0 0 0 mm 40 -100 -200 LogVol:Absorber
302 Idle&gt; /vis/viewer/flush
303 </programlisting>
304 </informalexample>
305 </para></listitem>
306</itemizedlist>
307
308<para>
309For more options, see the
310<ulink url="./AllResources/Control/UIcommands/_vis_.html">
311Control...UICommands</ulink> section of this user guide.
312</para>
313
314</sect2>
315
316
317<!-- ******************* Section (Level#2) ****************** -->
318<sect2 id="sect.VisCntCmmd.Traj">
319<title>
320Visualization of trajectories: <literal>/vis/scene/add/trajectories</literal> command
321</title>
322
323<para>
324
325Command "<literal>/vis/scene/add/trajectories [smooth] [rich]</literal>"
326adds trajectories to the current scene. The optional
327parameters "smooth" and/or "rich" (you may specify either, both or
328neither) invoke, if "smooth" is specified, the storing and displaying
329of extra points on curved trajectories and, if "rich" is specified,
330the storing, for possible subsequent selection and display, of
331additional information, such as volume names, creator process, energy
332deposited, global time. Be aware, of course, that this imposes
333computational and memory overheads. Note that this automatically
334issues the appropriate
335"<literal>/tracking/storeTrajectory</literal>" command so that trajectories are
336stored (by default they are not). The visualization is performed
337with the command "<literal>/run/beamOn</literal>" unless you have non-default
338values for /vis/scene/endOfEventAction or /vis/scene/endOfRunAction
339(described below).
340</para>
341
342<para>
343<emphasis role="bold">Command: </emphasis>
344<literal>/vis/scene/add/trajectories [smooth] [rich]</literal>
345</para>
346
347<itemizedlist spacing="compact">
348 <listitem><para>
349 <emphasis role="bold">Action</emphasis>
350 <para>
351 The command adds trajectories to the current scene. Trajectories
352 are drawn at end of event when the scene in which they are added is
353 current.
354 </para>
355 </para></listitem>
356 <listitem><para>
357 <emphasis role="bold">Example: Visualization of trajectories</emphasis>
358 <informalexample>
359 <programlisting>
360 Idle&gt; /vis/scene/add/trajectories
361 Idle&gt; /run/beamOn 10
362 </programlisting>
363 </informalexample>
364 </para></listitem>
365 <listitem><para>
366 <emphasis role="bold">Additional note 1</emphasis>
367 <para>
368 See the section
369 <xref linkend="sect.VisEnhTrj.CntlComm" />
370 Enhanced Trajectory Drawing
371 for details on how to control how trajectories are
372 color-coded.
373 </para>
374 </para></listitem>
375</itemizedlist>
376
377<para>
378For more options, see the
379<ulink url="./AllResources/Control/UIcommands/_vis_.html">
380Control...UICommands </ulink> section of this user guide.
381</para>
382
383</sect2>
384
385
386<!-- ******************* Section (Level#2) ****************** -->
387<sect2 id="sect.VisCntCmmd.Hits">
388<title>
389Visualization of hits: <literal>/vis/scene/add/hits</literal> command
390</title>
391
392<para>
393Command "<literal>/vis/scene/add/hits</literal>" adds hits to the current
394scene, assuming that you have a hit class and that the hits have
395visualization information. The visualization is performed with the
396command "<literal>/run/beamOn</literal>" unless you have non-default values
397for /vis/scene/endOfEventAction or /vis/scene/endOfRunAction
398(described above).
399</para>
400
401</sect2>
402
403
404<!-- ******************* Section (Level#2) ****************** -->
405<sect2 id="sect.VisCntCmmd.HrAtHits">
406<title>
407HepRep Attributes for Hits
408</title>
409
410<para>
411The HepRep file formats, HepRepFile and HepRepXML, attach various
412attributes to hits such that you can view these attributes, label
413trajectories by these attributes or make visibility cuts based on
414these attributes. Examples of adding HepRep attributes to hit
415classes can be found in examples /extended/analysis/A01 and
416/extended/runAndEvent/RE01.
417</para>
418
419<para>
420For example, in example RE01's class RE01CalorimeterHit.cc,
421available attributes will be:
422
423<itemizedlist spacing="compact">
424 <listitem><para>
425 Hit Type
426 </para></listitem>
427 <listitem><para>
428 Track ID
429 </para></listitem>
430 <listitem><para>
431 Z Cell ID
432 </para></listitem>
433 <listitem><para>
434 Phi Cell ID
435 </para></listitem>
436 <listitem><para>
437 Energy Deposited
438 </para></listitem>
439 <listitem><para>
440 Energy Deposited by Track
441 </para></listitem>
442 <listitem><para>
443 Position
444 </para></listitem>
445 <listitem><para>
446 Logical Volume
447 </para></listitem>
448</itemizedlist>
449</para>
450
451<para>
452You can add additional attributes of your choosing by modifying the
453relevant part of the hit class (look for the methods GetAttDefs and
454CreateAttValues).
455</para>
456
457</sect2>
458
459
460<!-- ******************* Section (Level#2) ****************** -->
461<sect2 id="sect.VisCntCmmd.BscCmrWrk">
462<title>
463Basic camera workings: <literal>/vis/viewer/</literal> commands
464</title>
465
466<para>
467Commands in the command directory "<literal>/vis/viewer/</literal>" set
468camera parameters and drawing style of the current viewer, which
469corresponds to Step 5. Note that the camera parameters and the
470drawing style should be set separately for each viewer. They can be
471initialized to the default values with command
472"<literal>/vis/viewer/reset</literal>". Some visualization systems, such as
473the VRML and HepRep browsers also allow camera control from the
474standalone graphics application.
475</para>
476
477<para>
478Just a few of the camera commands are described here. For more
479commands, see the
480<ulink url="./AllResources/Control/UIcommands/_vis_.html">
481Control...UICommands</ulink> section of this user guide.
482</para>
483
484<para>
485<para><emphasis role="bold">Command: </emphasis>
486<literal>/vis/viewer/set/viewpointThetaPhi [theta] [phi]
487[deg|rad]</literal>
488</para>
489
490<itemizedlist spacing="compact">
491 <listitem><para>
492 <emphasis role="bold">Arguments</emphasis>
493 <para>
494 Arguments "theta" and "phi" are polar and azimuthal camera angles,
495 respectively. The default unit is "degree".
496 </para>
497 </para></listitem>
498 <listitem><para>
499 <emphasis role="bold">Action</emphasis>
500 <para>
501 Set a view point in direction of (theta, phi).
502 </para>
503 </para></listitem>
504 <listitem><para>
505 <emphasis role="bold">Example: Set the viewpoint in direction of (70 deg,
506 20 deg)</emphasis>
507
508 /<informalexample>
509 <programlisting>
510 Idle&gt; /vis/viewer/set/viewpointThetaPhi 70 20
511 </programlisting>
512 </informalexample>
513 </para></listitem>
514 <listitem><para>
515 <emphasis role="bold">Additional notes</emphasis>
516 <para>
517 Camera parameters should be set for each viewer. They are
518 initialized with command "<literal>/vis/viewer/reset</literal>".
519 </para>
520 </para></listitem>
521</itemizedlist>
522
523<para>
524<emphasis role="bold">Command: </emphasis>
525<literal>/vis/viewer/zoom [scale_factor]</literal>
526</para>
527
528<itemizedlist spacing="compact">
529 <listitem><para>
530 <emphasis role="bold">Argument</emphasis>
531 <para>
532 The scale factor. The command multiplies magnification of the view
533 by this factor.
534 </para>
535 </para></listitem>
536 <listitem><para>
537 <emphasis role="bold">Action</emphasis>
538 <para>
539 Zoom up/down of view.
540 </para>
541 </para></listitem>
542 <listitem><para>
543 <emphasis role="bold">Example: Zoom up by factor 1.5</emphasis>
544 <informalexample>
545 <programlisting>
546 Idle&gt; /vis/viewer/zoom 1.5
547 </programlisting>
548 </informalexample>
549 </para></listitem>
550 <listitem><para>
551 <emphasis role="bold">Additional notes</emphasis>
552 <para>
553 Camera parameters should be set for each viewer. They are
554 initialized with command "<literal>/vis/viewer/reset</literal>".
555 </para>
556 <para>
557 A similar pair of commands, scale and scaleTo allow non-uniform
558 scaling (i.e., zoom differently along different axes). For details,
559 see the
560 <ulink url="./AllResources/Control/UIcommands/_vis_.html">
561 Control...UICommands</ulink> section of this user guide.
562 </para>
563 </para></listitem>
564</itemizedlist>
565</para>
566
567<para>
568<emphasis role="bold">Command: </emphasis>
569<literal>/vis/viewer/set/style [style_name]</literal>
570</para>
571
572<itemizedlist spacing="compact">
573 <listitem><para>
574 <emphasis role="bold">Arguments</emphasis>
575 <para>
576 Candidate values of the argument are "wireframe" and "surface".
577 ("w" and "s" also work.)
578 </para>
579 </para></listitem>
580 <listitem><para>
581 <emphasis role="bold">Action</emphasis>
582 <para>
583 Set a drawing style to wireframe or surface.
584 </para>
585 </para></listitem>
586 <listitem><para>
587 <emphasis role="bold">Example: Set the drawing style to "surface"</emphasis>
588 <informalexample>
589 <programlisting>
590 Idle&gt; /vis/viewer/set/style surface
591 </programlisting>
592 </informalexample>
593 </para></listitem>
594 <listitem><para>
595 <emphasis role="bold">Additional notes</emphasis>
596 <para>
597 The style of some geometry components may have been forced one way
598 or the other through calls in compiled code. The set/style command
599 will NOT override such force styles.
600 </para>
601 <para>
602 Drawing style should be set for each viewer. The drawing style is
603 initialized with command "<literal>/vis/viewer/reset</literal>".
604 </para>
605 </para></listitem>
606</itemizedlist>
607
608</sect2>
609
610
611<!-- ******************* Section (Level#2) ****************** -->
612<sect2 id="sect.VisCntCmmd.DclEndFlsh">
613<title>
614Declare the end of visualization for flushing: <literal>/vis/viewer/flush</literal> command
615</title>
616
617<para>
618<emphasis role="bold">Command: </emphasis>
619<literal>/vis/viewer/flush</literal>
620</para>
621
622<itemizedlist spacing="compact">
623 <listitem><para>
624 <emphasis role="bold">Action</emphasis>
625 <para>
626 Declare the end of visualization for flushing.
627 </para>
628 </para></listitem>
629 <listitem><para>
630 <emphasis role="bold">Additional notes</emphasis>
631 <para>
632 Command "<literal>/vis/viewer/flush</literal>" should follow
633 "<literal>/vis/drawVolume</literal>", "<literal>/vis/specify</literal>",
634 etc in order to complete visualization. It corresponds to Step 7.
635 </para>
636 <para>
637 The flush is done automatically after every /run/beamOn command
638 unless you have non-default values for /vis/scene/endOfEventAction
639 or /vis/scene/endOfRunAction (described above).
640 </para>
641 </para></listitem>
642</itemizedlist>
643
644</sect2>
645
646
647<!-- ******************* Section (Level#2) ****************** -->
648<sect2 id="sect.VisCntCmmd.EndEvtRun">
649<title>
650End of Event Action and End of Run Action:
651<literal>/vis/viewer/endOfEventAction</literal> and
652<literal>/vis/viewer/endOfEventAction</literal> commands
653</title>
654
655<para>
656By default, a separate picture is created for each event. You can
657change this behavior to accumulate multiple events, or even
658multiple runs, in a single picture.
659</para>
660
661<para>
662<emphasis role="bold">Command: </emphasis>
663<literal>/vis/scene/endOfEventAction [refresh|accumulate]</literal>
664</para>
665
666<itemizedlist spacing="compact">
667 <listitem><para>
668 <emphasis role="bold">Action</emphasis>
669 <para>
670 Control how often the picture should be cleared.
671 <literal>refresh</literal> means each event will be written to a new
672 picture.
673 <literal>accumulate</literal> means events will be accumulated into a single
674 picture. Picture will be flushed at end of run, unless you have
675 also set <literal>/vis/scene/endOfRunAction accumulate</literal>
676 </para>
677 </para></listitem>
678 <listitem><para>
679 <emphasis role="bold">Additional note</emphasis>
680 <para>
681 You may instead choose to use update commands from your
682 BeginOfRunAction or EndOfEventAction, as in early examples, but now
683 the vis manager ia able to do most of what most users require
684 through the above commands.
685 </para>
686 </para></listitem>
687</itemizedlist>
688
689<para>
690<emphasis role="bold">Command: </emphasis>
691<literal>/vis/scene/endOfRunAction [refresh|accumulate]</literal>
692</para>
693
694<itemizedlist spacing="compact">
695 <listitem><para>
696 <emphasis role="bold">Action</emphasis>
697 <para>
698 Control how often the picture should be cleared.
699 <literal>refresh</literal> means each run will be written to a new
700 picture.
701 <literal>accumulate</literal> means runs will be accumulated into a single
702 picture. To start a new picture, you must explicitly issue
703 <literal>/vis/viewer/refresh</literal>, <literal>/vis/viewer/update</literal>
704 or <literal>/vis/viewer/flush</literal>
705 </para>
706 </para></listitem>
707</itemizedlist>
708
709</sect2>
710
711
712<!-- ******************* Section (Level#2) ****************** -->
713<sect2 id="sect.VisCntCmmd.HpRpTraj">
714<title>
715HepRep Attributes for Trajectories
716</title>
717
718<para>
719The HepRep file formats, HepRepFile and HepRepXML, attach various
720attributes to trajectories such that you can view these attributes,
721label trajectories by these attributes or make visibility cuts
722based on these attributes. If you use the default Geant4 trajectory
723class from /tracking/src/G4Trajectory.cc (this is what you get with
724the plain <literal>/vis/scene/add/trajectories</literal> command),
725available attributes will be:
726
727<itemizedlist spacing="compact">
728 <listitem><para>
729 Track ID
730 </para></listitem>
731 <listitem><para>
732 Parent ID
733 </para></listitem>
734 <listitem><para>
735 Particle Name
736 </para></listitem>
737 <listitem><para>
738 Charge
739 </para></listitem>
740 <listitem><para>
741 PDG Encoding
742 </para></listitem>
743 <listitem><para>
744 Momentum 3-Vector
745 </para></listitem>
746 <listitem><para>
747 Momentum magnitude
748 </para></listitem>
749 <listitem><para>
750 Number of points
751 </para></listitem>
752</itemizedlist>
753</para>
754
755<para>
756Using <literal>/vis/scene/add/trajectories rich</literal> will get you
757additional attributes.
758You may also add additional attributes of your choosing by modifying the
759relevant part of G4Trajectory (look for the methods GetAttDefs and
760CreateAttValues). If you are using your own trajectory class, you
761may want to consider copying these methods from G4Trajectory.
762</para>
763
764</sect2>
765
766
767<!-- ******************* Section (Level#2) ****************** -->
768<sect2 id="sect.VisCntCmmd.SvVwPs">
769<title>
770How to save a visualized views to PostScript files
771</title>
772
773<para>
774Most of the visualization drivers offer ways to save visualized
775views to PostScript files (or Encapsulated PostScript (EPS) files)
776by themselves.
777</para>
778
779<para>
780The DAWNFILE driver, which co-works with Fukui Renderer DAWN,
781generates "vectorized" PostScript data with "analytical
782hidden-line/surface removal", and so it is well suited for
783technical high-quality outputs for presentation, documentation, and
784debugging geometry. In the default setting of the DAWNFILE drivers,
785EPS files named "<literal>g4_00.eps, g4_01.eps, g4_02.eps</literal>,..." are
786automatically generated in the current directory each time when
787visualization is performed, and then a PostScript viewer
788"<literal>gv</literal>"is automatically invoked to visualize the generated
789EPS files.
790</para>
791
792<para>
793For large data sets, it may take time to generate the vectorized
794PostScript data. In such a case, visualize the 3D scene with a
795faster visualization driver beforehand for previewing, and then use
796the DAWNFILE drivers. For example, the following visualizes the
797whole detector with the OpenGL-Xlib driver (immediate mode) first,
798and then with the DAWNFILE driver to generate an EPS file
799<literal>g4_XX.eps</literal> to save the visualized view:
800
801<informalexample>
802<programlisting>
803# Invoke the OpenGL visualization driver in its immediate mode
804/vis/open OGLIX
805
806# Camera setting
807/vis/viewer/set/viewpointThetaPhi 20 20
808
809# Camera setting
810/vis/drawVolume
811/vis/viewer/flush
812
813# Invoke the DAWNFILE visualization driver
814/vis/open DAWNFILE
815
816# Camera setting
817/vis/viewer/set/viewpointThetaPhi 20 20
818
819# Camera setting
820/vis/drawVolume
821/vis/viewer/flush
822</programlisting>
823</informalexample>
824</para>
825
826<para>
827This is a good example to show that the visualization drivers are
828complementary to each other.
829</para>
830
831<para>
832In the OpenInventor drivers, you can simply click the "Print"
833button on their GUI to generate a PostScript file as a hard copy of
834a visualized view.
835</para>
836
837<para>
838The OpenGL X drivers can also generate PostScript files, either from
839a pull-down menu (Motif drivers) or with <literal>/vis/ogl/printEPS</literal>.
840It can generate either vectorized or rasterized PostScript
841data. In generating vectorized PostScript data, hidden-surface
842removal is performed, based on the painter's algorithm after
843dividing facets of shapes into small sub-triangles.
844</para>
845
846<para>
847The WIRED3 HepRep Browser and WIRED4 JAS Plug-In can generate a
848wide variety of bitmap and vector output formats including
849PostScript and PDF.
850</para>
851
852</sect2>
853
854
855<!-- ******************* Section (Level#2) ****************** -->
856<sect2 id="sect.VisCntCmmd.Cull">
857<title>
858Culling
859</title>
860
861<para>
862"Culling" means to skip visualizing parts of a 3D scene. Culling is
863useful for avoiding complexity of visualized views, keeping
864transparent features of the 3D scene, and for quick visualization.
865</para>
866
867<para>
868Geant4 Visualization supports the following 3 kinds of
869culling:
870
871<itemizedlist spacing="compact">
872 <listitem><para>
873 Culling of invisible physical volumes
874 </para></listitem>
875 <listitem><para>
876 Culling of low density physical volumes.
877 </para></listitem>
878 <listitem><para>
879 Culling of covered physical volumes by others
880 </para></listitem>
881</itemizedlist>
882</para>
883
884<para>
885In order that one or all types of the above culling are on, i.e.,
886activated, the global culling flag should also be on.
887</para>
888
889<para>
890<xref linkend="table.VisCntCmmd_1" /> summarizes the default culling policies.
891
892<table id="table.VisCntCmmd_1" align="center">
893<title>
894The default culling policies.
895</title>
896
897<tgroup cols="2">
898 <tbody>
899 <row>
900 <entry>
901 <emphasis role="bold">Culling Type</emphasis>
902 </entry>
903 <entry>
904 <emphasis role="bold">Default Value</emphasis>
905 </entry>
906 </row>
907 <row>
908 <entry>
909 global
910 </entry>
911 <entry>
912 ON
913 </entry>
914 </row>
915 <row>
916 <entry>
917 invisible
918 </entry>
919 <entry>
920 ON
921 </entry>
922 </row>
923 <row>
924 <entry>
925 low density
926 </entry>
927 <entry>
928 OFF
929 </entry>
930 </row>
931 <row>
932 <entry>
933 covered daughter
934 </entry>
935 <entry>
936 OFF
937 </entry>
938 </row>
939 </tbody>
940</tgroup>
941</table>
942</para>
943
944<para>
945The default threshold density of the low-density culling is 0.01
946g/cm<superscript>3</superscript>.
947</para>
948
949<para>
950The default culling policies can be modified with the following
951visualization commands. (Below the argument <literal>flag</literal> takes a
952value of <literal>true</literal> or <literal>false</literal>.)
953
954<informalexample>
955<programlisting>
956 # global
957 /vis/viewer/set/culling global flag
958
959 # invisible
960 /vis/viewer/set/culling invisible flag
961
962 # low density
963 # "value" is a proper value of a treshold density
964 # "unit" is either g/cm3, mg/cm3 or kg/m3
965 /vis/viewer/set/culling density flag value unit
966
967 # covered daughter
968 /vis/viewer/set/culling coveredDaughters flag density
969</programlisting>
970</informalexample>
971</para>
972
973<para>
974The HepRepFile graphic system will, by default, include culled
975objects in the file so that they can still be made visible later
976from controls in the HepRep browser. If this behavior would cause
977files to be too large, you can instead choose to have culled
978objects be omitted from the HepRep file. See details in the
979HepRepFile Driver section of this user guide.
980</para>
981
982</sect2>
983
984
985<!-- ******************* Section (Level#2) ****************** -->
986<sect2 id="sect.VisCntCmmd.CutVw">
987<title>
988Cut view
989</title>
990
991<!-- ******* Bridgehead ******* -->
992<bridgehead renderas='sect4'>
993Sectioning
994</bridgehead>
995
996<para>
997"Sectioning" means to make a thin slice of a 3D scene around a
998given plane. At present, this function is supported by the OpenGL
999drivers. The sectioning is realized by setting a sectioning plane
1000before performing visualization. The sectioning plane can be set by
1001the command,
1002
1003<informalexample>
1004<programlisting>
1005 /vis/viewer/set/sectionPlane on x y z units nx ny nz
1006</programlisting>
1007</informalexample>
1008
1009where the vector (x,y,z) defines a point on the sectioning plane,
1010and the vector (nx,ny,nz) defines the normal vector of the
1011sectioning plane. For example, the following sets a sectioning
1012plane to a yz plane at x = 2 cm:
1013
1014<informalexample>
1015<programlisting>
1016 Idle&gt; /vis/viewer/set/sectionPlane on 2.0 0.0 0.0 cm 1.0 0.0 0.0
1017</programlisting>
1018</informalexample>
1019</para>
1020
1021<!-- ******* Bridgehead ******* -->
1022<bridgehead renderas='sect4'>
1023Cutting away
1024</bridgehead>
1025
1026<para>
1027"Cutting away" means to remove a half space, defined with a plane,
1028from a 3D scene.
1029
1030<itemizedlist spacing="compact">
1031 <listitem><para>
1032 Cutting away is supported by the DAWNFILE driver "off-line". Do
1033 the following:
1034
1035 <itemizedlist spacing="compact">
1036 <listitem><para>
1037 Perform visualization with the DAWNFILE driver to generate a
1038 file <literal>g4.prim</literal>, describing the whole 3D scene.
1039 </para></listitem>
1040 <listitem><para>
1041 Make the application "DAWNCUT" read the generated file to make
1042 a view of cutting away.
1043 </para></listitem>
1044 </itemizedlist>
1045
1046 See the following WWW page for details:
1047 <ulink url="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html">
1048 http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html
1049 </ulink>
1050 </para></listitem>
1051 <listitem><para>
1052 Alternatively, add up to three cutaway planes:
1053
1054 <informalexample>
1055 <programlisting>
1056 /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0
1057 /vis/viewer/addCutawayPlane 0 0 0 m 0 1 0
1058 ...
1059 </programlisting>
1060 </informalexample>
1061 and, for more that one plane, you can change the mode to
1062
1063 <itemizedlist spacing="compact">
1064 <listitem><para>
1065 (a) "add" or, equivalently, "union" (default) or
1066 </para></listitem>
1067 <listitem><para>
1068 (b) "multiply" or, equivalently, "intersection":
1069 </para></listitem>
1070 </itemizedlist>
1071
1072 <informalexample>
1073 <programlisting>
1074 /vis/viewer/set/cutawayMode multiply
1075 </programlisting>
1076 </informalexample>
1077
1078 To de-activate:
1079
1080 <informalexample>
1081 <programlisting>
1082 /vis/viewer/clearCutawayPlanes
1083 </programlisting>
1084 </informalexample>
1085
1086 OpenGL supports this feature.
1087 </para></listitem>
1088</itemizedlist>
1089</para>
1090
1091</sect2>
1092
1093
1094<!-- ******************* Section (Level#2) ****************** -->
1095<sect2 id="sect.VisCntCmmd.TutMac">
1096<title>
1097Tutorial macros
1098</title>
1099
1100<para>
1101The followings are tutorial macros in the directory
1102<literal>examples/novice/N03/visTutor/</literal>:
1103
1104<itemizedlist spacing="compact">
1105 <listitem><para>
1106 <ulink url="./Visualization/visTutor/exN03Vis0_mac.html">
1107 exN03Vis0.mac:</ulink>
1108 <para>
1109 A basic macro for visualization of detector geometry and events
1110 using OpenGL in Immediate mode and DAWN.
1111 </para>
1112 </para></listitem>
1113 <listitem><para>
1114 <ulink url="./Visualization/visTutor/exN03Vis1_mac.html">
1115 exN03Vis1.mac:</ulink>
1116 <para>
1117 A basic macro for visualization of detector geometry using OpenGL
1118 in Stored mode and DAWN.
1119 </para>
1120 </para></listitem>
1121 <listitem><para>
1122 <ulink url="./Visualization/visTutor/exN03Vis2_mac.html">
1123 exN03Vis2.mac:</ulink>
1124 <para>
1125 A basic macro for visualization of detector geometry and events
1126 using OpenGL in Stored mode and DAWN.
1127 </para>
1128 </para></listitem>
1129 <listitem><para>
1130 <ulink url="./Visualization/visTutor/exN03Vis3_mac.html">
1131 exN03Vis3.mac:</ulink>
1132 <para>
1133 A basic macro for demonstrating various drawing styles using OpenGL
1134 in Immediate mode and DAWN.
1135 </para>
1136 </para></listitem>
1137 <listitem><para>
1138 <ulink url="./Visualization/visTutor/exN03Vis4_mac.html">
1139 exN03Vis4.mac:</ulink>
1140 <para>
1141 An example of visualizing specific logical volumes using OpenGL in
1142 Immediate mode and DAWN.
1143 </para>
1144 </para></listitem>
1145 <listitem><para>
1146 <ulink url="./Visualization/visTutor/exN03Vis5_mac.html">
1147 exN03Vis5.mac:</ulink>
1148 <para>
1149 A basic macro for visualization of detector geometry and events
1150 using OpenInventor on Unix.
1151 </para>
1152 </para></listitem>
1153 <listitem><para>
1154 <ulink url="./Visualization/visTutor/exN03Vis6_mac.html">
1155 exN03Vis6.mac:</ulink>
1156 <para>
1157 A basic macro for visualization of detector geometry and events
1158 using VRML.
1159 </para>
1160 </para></listitem>
1161 <listitem><para>
1162 <ulink url="./Visualization/visTutor/exN03Vis7_mac.html">
1163 exN03Vis7.mac:</ulink>
1164 <para>
1165 A macro to demonstrate "batch" visualization to generate PostScript
1166 files with the DAWNFILE driver
1167 </para>
1168 </para></listitem>
1169 <listitem><para>
1170 <ulink url="./Visualization/visTutor/exN03Vis8_mac.html">
1171 exN03Vis8.mac:</ulink>
1172 <para>
1173 A macro to demonstrate creation of a "multi-page" PostScript file
1174 with the DAWNFILE driver
1175 </para>
1176 </para></listitem>
1177 <listitem><para>
1178 <ulink url="./Visualization/visTutor/exN03Vis9_mac.html">
1179 exN03Vis9.mac:</ulink>
1180 <para>
1181 A basic macro for visualization of detector geometry and events
1182 using OpenGL for Windows.
1183 </para>
1184 </para></listitem>
1185 <listitem><para>
1186 <ulink url="./Visualization/visTutor/exN03Vis10_mac.html">
1187 exN03Vis10.mac:</ulink>
1188 <para>
1189 A basic macro for visualization of detector geometry and events
1190 using OpenInventor on Windows.
1191 </para>
1192 </para></listitem>
1193 <listitem><para>
1194 <ulink url="./Visualization/visTutor/exN03Vis11_mac.html">
1195 exN03Vis11.mac:</ulink>
1196 <para>
1197 A basic macro for visualization of detector geometry and events
1198 using OpenGL in Stored Motif mode and DAWN.
1199 </para>
1200 </para></listitem>
1201 <listitem><para>
1202 <ulink url="./Visualization/visTutor/exN03Vis12_mac.html">
1203 exN03Vis12.mac:</ulink> and
1204 <ulink url="./Visualization/visTutor/exN03Vis12_loop.html">
1205 exN03Vis12.loop:</ulink>
1206 <para>
1207 A basic macro for demonstrating time slicing.
1208 </para>
1209 </para></listitem>
1210 <listitem><para>
1211 <ulink url="./Visualization/visTutor/exN03Vis13_mac.html">
1212 exN03Vis13.mac:</ulink> and
1213 <ulink url="./Visualization/visTutor/exN03Vis13_loop.html">
1214 exN03Vis3.loop:</ulink>
1215 <para>
1216 Time development of an electrmagnetic shower.
1217 </para>
1218 </para></listitem>
1219 <listitem><para>
1220 <ulink url="./Visualization/visTutor/exN03Vis14_mac.html">
1221 exN03Vis14.mac:</ulink>
1222 <para>
1223 A basic macro for visualization of detector geometry and events
1224 using Qt in Stored mode.
1225 </para>
1226 </para></listitem>
1227 <listitem><para>
1228 <ulink url="./Visualization/visTutor/exN03Vis15_mac.html">
1229 exN03Vis15.mac:</ulink>
1230 <para>
1231 A basic macro for visualization of detector geometry and events
1232 using Qt.
1233 </para>
1234 </para></listitem>
1235 <listitem><para>
1236 <ulink url="./Visualization/visTutor/exN03Tree0_mac.html">
1237 exN03Tree0.mac:</ulink>
1238 <para>
1239 A macro to demonstrate ASCII tree.
1240 </para>
1241 </para></listitem>
1242 <listitem><para>
1243 <ulink url="./Visualization/visTutor/exN03Tree1_mac.html">
1244 exN03Tree1.mac:</ulink>
1245 <para>
1246 A macro to demonstrate GAG tree.
1247 </para>
1248 </para></listitem>
1249</itemizedlist>
1250</para>
1251
1252
1253</sect2>
1254</sect1>
Note: See TracBrowser for help on using the repository browser.