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

Last change on this file since 1222 was 1222, checked in by garnier, 15 years ago

CVS update

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