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

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

en test de gl2ps. Problemes de libraries

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