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

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

CVS update

File size: 37.3 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 vectorized or rasterized 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 printed 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 : Print stuff is done tanks to gl2ps library (incorporated in vis driver)
900Due to a gl2ps limitation, printing an opengl view with <literal>/vis/viewer/set/hiddenMarker 1</literal>
901will have the same effect as printing with <literal>/vis/viewer/set/hiddenMarker 0</literal>
902</para>
903<para>
904Note : <literal>/vis/ogl/set/printSize</literal> command can be used to print
905EPS files larger than screen size. The only size limitation is graphics card
906viewport dimension: GL_MAX_VIEWPORT_DIMS
907
908<informalexample>
909<programlisting>
910# Invoke the OpenGL visualization driver in its stored mode
911/vis/open OGLSX
912
913# Camera setting
914/vis/viewer/set/viewpointThetaPhi 20 20
915
916# Camera setting
917/vis/drawVolume
918/vis/viewer/flush
919
920# set print mode to vectored
921/vis/ogl/set/printMode vectored
922
923# set print size larger than screen
924/vis/ogl/set/printSize 2000 2000
925
926# print
927/vis/ogl/printEPS
928
929</programlisting>
930</informalexample>
931</para>
932</para>
933</listitem>
934
935<listitem>
936<para>
937<emphasis role="bold">HepRep</emphasis>
938<para>
939The HepRApp HepRep Browser and WIRED4 JAS Plug-In can generate a
940wide variety of bitmap and vector output formats including
941PostScript and PDF.
942</para>
943</para>
944</listitem>
945</itemizedlist>
946</para>
947</sect2>
948
949
950<!-- ******************* Section (Level#2) ****************** -->
951<sect2 id="sect.VisCntCmmd.Cull">
952<title>
953Culling
954</title>
955
956<para>
957"Culling" means to skip visualizing parts of a 3D scene. Culling is
958useful for avoiding complexity of visualized views, keeping
959transparent features of the 3D scene, and for quick visualization.
960</para>
961
962<para>
963Geant4 Visualization supports the following 3 kinds of
964culling:
965
966<itemizedlist spacing="compact">
967  <listitem><para>
968    Culling of invisible physical volumes
969  </para></listitem>
970  <listitem><para>
971    Culling of low density physical volumes.
972  </para></listitem>
973  <listitem><para>
974    Culling of covered physical volumes by others
975  </para></listitem>
976</itemizedlist>
977</para>
978
979<para>
980In order that one or all types of the above culling are on, i.e.,
981activated, the global culling flag should also be on.
982</para>
983
984<para>
985<xref linkend="table.VisCntCmmd_1" /> summarizes the default culling policies.
986
987<table id="table.VisCntCmmd_1" align="center">
988<title>
989The default culling policies.
990</title>
991
992<tgroup cols="2">
993  <tbody>
994  <row>
995    <entry>
996      <emphasis role="bold">Culling Type</emphasis>
997    </entry>
998    <entry>
999      <emphasis role="bold">Default Value</emphasis>
1000    </entry>
1001  </row>
1002  <row>
1003    <entry>
1004      global
1005    </entry>
1006    <entry>
1007      ON
1008    </entry>
1009  </row>
1010  <row>
1011    <entry>
1012      invisible
1013    </entry>
1014    <entry>
1015      ON
1016    </entry>
1017  </row>
1018  <row>
1019    <entry>
1020      low density
1021    </entry>
1022    <entry>
1023      OFF
1024    </entry>
1025  </row>
1026  <row>
1027    <entry>
1028      covered daughter
1029    </entry>
1030    <entry>
1031      OFF
1032    </entry>
1033  </row>
1034  </tbody>
1035</tgroup>
1036</table>
1037</para>
1038
1039<para>
1040The default threshold density of the low-density culling is 0.01
1041g/cm<superscript>3</superscript>.
1042</para>
1043
1044<para>
1045The default culling policies can be modified with the following
1046visualization commands. (Below the argument <literal>flag</literal> takes a
1047value of <literal>true</literal> or <literal>false</literal>.)
1048
1049<informalexample>
1050<programlisting>
1051     # global
1052     /vis/viewer/set/culling  global  flag
1053
1054     # invisible
1055     /vis/viewer/set/culling  invisible  flag
1056
1057     # low density
1058     #   "value" is a proper value of a treshold density
1059     #   "unit" is either g/cm3, mg/cm3 or kg/m3
1060     /vis/viewer/set/culling  density  flag  value  unit
1061
1062     # covered daughter
1063     /vis/viewer/set/culling  coveredDaughters  flag     density
1064</programlisting> 
1065</informalexample>
1066</para>
1067
1068<para>
1069The HepRepFile graphic system will, by default, include culled
1070objects in the file so that they can still be made visible later
1071from controls in the HepRep browser. If this behavior would cause
1072files to be too large, you can instead choose to have culled
1073objects be omitted from the HepRep file. See details in the
1074HepRepFile Driver section of this user guide.
1075</para>
1076
1077</sect2>
1078
1079
1080<!-- ******************* Section (Level#2) ****************** -->
1081<sect2 id="sect.VisCntCmmd.CutVw">
1082<title>
1083Cut view
1084</title> 
1085
1086<!-- ******* Bridgehead ******* -->
1087<bridgehead renderas='sect4'>
1088Sectioning
1089</bridgehead>
1090
1091<para>
1092"Sectioning" means to make a thin slice of a 3D scene around a
1093given plane. At present, this function is supported by the OpenGL
1094drivers. The sectioning is realized by setting a sectioning plane
1095before performing visualization. The sectioning plane can be set by
1096the command,
1097
1098<informalexample>
1099<programlisting>
1100     /vis/viewer/set/sectionPlane on x y z units nx ny nz
1101</programlisting>
1102</informalexample>
1103
1104where the vector (x,y,z) defines a point on the sectioning plane,
1105and the vector (nx,ny,nz) defines the normal vector of the
1106sectioning plane. For example, the following sets a sectioning
1107plane to a yz plane at x = 2 cm:
1108
1109<informalexample>
1110<programlisting>
1111     Idle&gt; /vis/viewer/set/sectionPlane  on  2.0  0.0  0.0  cm  1.0  0.0  0.0
1112</programlisting>
1113</informalexample>
1114</para>
1115
1116<!-- ******* Bridgehead ******* -->
1117<bridgehead renderas='sect4'>
1118Cutting away
1119</bridgehead>
1120
1121<para>
1122"Cutting away" means to remove a half space, defined with a plane,
1123from a 3D scene.
1124
1125<itemizedlist spacing="compact">
1126  <listitem><para>
1127    Cutting away is supported by the DAWNFILE driver "off-line". Do
1128    the following:
1129
1130    <itemizedlist spacing="compact">
1131      <listitem><para>
1132        Perform visualization with the DAWNFILE driver to generate a
1133        file <literal>g4.prim</literal>, describing the whole 3D scene.
1134      </para></listitem>
1135      <listitem><para>
1136        Make the application "DAWNCUT" read the generated file to make
1137        a view of cutting away.
1138      </para></listitem>
1139    </itemizedlist>
1140
1141    See the following WWW page for details:
1142    <ulink url="http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html">
1143    http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAWNCUT.html
1144    </ulink>
1145  </para></listitem>
1146  <listitem><para>
1147    Alternatively, add up to three cutaway planes:
1148
1149    <informalexample>
1150    <programlisting>
1151     /vis/viewer/addCutawayPlane 0 0 0 m 1 0 0
1152     /vis/viewer/addCutawayPlane 0 0 0 m 0 1 0
1153     ...
1154    </programlisting>
1155    </informalexample>
1156    and, for more that one plane, you can change the mode to
1157
1158    <itemizedlist spacing="compact">
1159      <listitem><para>
1160        (a) "add" or, equivalently, "union" (default) or
1161      </para></listitem>
1162      <listitem><para>
1163        (b) "multiply" or, equivalently, "intersection":
1164      </para></listitem>
1165    </itemizedlist>
1166
1167    <informalexample>
1168    <programlisting>
1169     /vis/viewer/set/cutawayMode multiply
1170    </programlisting>
1171    </informalexample>
1172
1173    To de-activate:
1174
1175    <informalexample>
1176    <programlisting>
1177     /vis/viewer/clearCutawayPlanes
1178    </programlisting>
1179    </informalexample>
1180
1181    OpenGL supports this feature.
1182  </para></listitem>
1183</itemizedlist>
1184</para>
1185
1186</sect2>
1187
1188
1189<!-- ******************* Section (Level#2) ****************** -->
1190<sect2 id="sect.VisCntCmmd.TutMac">
1191<title>
1192Tutorial macros
1193</title>
1194
1195<para>
1196The followings are tutorial macros in the directory
1197<literal>examples/novice/N03/visTutor/</literal>:
1198
1199<itemizedlist spacing="compact">
1200  <listitem><para>
1201    <ulink url="./Visualization/visTutor/exN03Vis0_mac.html">
1202    exN03Vis0.mac:</ulink>
1203    <para>
1204    A basic macro for visualization of detector geometry and events
1205    using OpenGL in Immediate mode and DAWN.
1206    </para>
1207  </para></listitem>
1208  <listitem><para>
1209    <ulink url="./Visualization/visTutor/exN03Vis1_mac.html">
1210    exN03Vis1.mac:</ulink>
1211    <para>
1212    A basic macro for visualization of detector geometry using OpenGL
1213    in Stored mode and DAWN.
1214    </para>
1215  </para></listitem>
1216  <listitem><para>
1217    <ulink url="./Visualization/visTutor/exN03Vis2_mac.html">
1218    exN03Vis2.mac:</ulink>
1219    <para>
1220    A basic macro for visualization of detector geometry and events
1221    using OpenGL in Stored mode and DAWN.
1222    </para>
1223  </para></listitem>
1224  <listitem><para>
1225    <ulink url="./Visualization/visTutor/exN03Vis3_mac.html">
1226    exN03Vis3.mac:</ulink>
1227    <para>
1228    A basic macro for demonstrating various drawing styles using OpenGL
1229    in Immediate mode and DAWN.
1230    </para>
1231  </para></listitem>
1232  <listitem><para>
1233    <ulink url="./Visualization/visTutor/exN03Vis4_mac.html">
1234    exN03Vis4.mac:</ulink>
1235    <para>
1236    An example of visualizing specific logical volumes using OpenGL in
1237    Immediate mode and DAWN.
1238    </para>
1239  </para></listitem>
1240  <listitem><para>
1241    <ulink url="./Visualization/visTutor/exN03Vis5_mac.html">
1242    exN03Vis5.mac:</ulink>
1243    <para>
1244    A basic macro for visualization of detector geometry and events
1245    using OpenInventor on Unix.
1246    </para>
1247  </para></listitem>
1248  <listitem><para>
1249    <ulink url="./Visualization/visTutor/exN03Vis6_mac.html">
1250    exN03Vis6.mac:</ulink>
1251    <para>
1252    A basic macro for visualization of detector geometry and events
1253    using VRML.
1254    </para>
1255  </para></listitem>
1256  <listitem><para>
1257    <ulink url="./Visualization/visTutor/exN03Vis7_mac.html">
1258    exN03Vis7.mac:</ulink>
1259    <para>
1260    A macro to demonstrate "batch" visualization to generate PostScript
1261    files with the DAWNFILE driver
1262    </para>
1263  </para></listitem>
1264  <listitem><para>
1265    <ulink url="./Visualization/visTutor/exN03Vis8_mac.html">
1266    exN03Vis8.mac:</ulink>
1267    <para>
1268    A macro to demonstrate creation of a "multi-page" PostScript file
1269    with the DAWNFILE driver
1270    </para>
1271  </para></listitem>
1272  <listitem><para>
1273    <ulink url="./Visualization/visTutor/exN03Vis9_mac.html">
1274    exN03Vis9.mac:</ulink>
1275    <para>
1276    A basic macro for visualization of detector geometry and events
1277    using OpenGL for Windows.
1278    </para>
1279  </para></listitem>
1280  <listitem><para>
1281    <ulink url="./Visualization/visTutor/exN03Vis10_mac.html">
1282    exN03Vis10.mac:</ulink>
1283    <para>
1284    A basic macro for visualization of detector geometry and events
1285    using OpenInventor on Windows.
1286    </para>
1287  </para></listitem>
1288  <listitem><para>
1289    <ulink url="./Visualization/visTutor/exN03Vis11_mac.html">
1290    exN03Vis11.mac:</ulink>
1291    <para>
1292    A basic macro for visualization of detector geometry and events
1293    using OpenGL in Stored Motif mode and DAWN.
1294    </para>
1295  </para></listitem>
1296  <listitem><para>
1297    <ulink url="./Visualization/visTutor/exN03Vis12_mac.html">
1298    exN03Vis12.mac:</ulink> and
1299    <ulink url="./Visualization/visTutor/exN03Vis12_loop.html">
1300    exN03Vis12.loop:</ulink>
1301    <para>
1302    A basic macro for demonstrating time slicing.
1303    </para>
1304  </para></listitem>
1305  <listitem><para>
1306    <ulink url="./Visualization/visTutor/exN03Vis13_mac.html">
1307    exN03Vis13.mac:</ulink> and
1308    <ulink url="./Visualization/visTutor/exN03Vis13_loop.html">
1309    exN03Vis3.loop:</ulink>
1310    <para>
1311    Time development of an electrmagnetic shower.
1312    </para>
1313  </para></listitem>
1314  <listitem><para>
1315    <ulink url="./Visualization/visTutor/exN03Vis14_mac.html">
1316    exN03Vis14.mac:</ulink>
1317    <para>
1318    A basic macro for visualization of detector geometry and events
1319    using Qt in Stored mode.
1320    </para>
1321  </para></listitem>
1322   <listitem><para>
1323    <ulink url="./Visualization/visTutor/exN03Tree0_mac.html">
1324    exN03Tree0.mac:</ulink>
1325    <para>
1326    A macro to demonstrate ASCII tree.
1327    </para>
1328  </para></listitem>
1329  <listitem><para>
1330    <ulink url="./Visualization/visTutor/exN03Tree1_mac.html">
1331    exN03Tree1.mac:</ulink>
1332    <para>
1333    A macro to demonstrate GAG tree.
1334    </para>
1335  </para></listitem>
1336</itemizedlist>
1337</para>
1338
1339
1340</sect2>
1341</sect1>
Note: See TracBrowser for help on using the repository browser.