Visualization

Visualization#

Geant4 macro commands related to geometry and particle track visualization.

G4SEE example of SRAM memory irradiated with protons SRAM detailed

Note

For visualization, the following dependencies have to be installed: Xming (for Windows) or XQuartz (for Mac)

Visualization macro example: examples/vis.mac

Visualization commands#

Macro command

Type

Description

Syntax

Options/Examples

/vis/open

string

To open a driver

[driver name] [size_of_window]-[location_of_window]

OGL, DAWNFILE, HepRepFile, VRML2FILE

/vis/viewer/set/autoRefresh

bool

If true, view is automatically refreshed after a change of view parameters

[option]

false, true

/vis/verbose

string

To turn off unwanted visualization messages on the console

[level]

quiet, startup, errors, warnings, confirmations, parameters, all

/vis/drawVolume

-

Creates a scene containing defined geometry

-

-

/vis/viewer/set/viewpointThetaPhi
/vis/viewer/set/viewpointVector

double[2] u
double[3]

Set direction from target to camera

[theta_angle] [phi_angle] [unit]
[x] [y] [z]

90. 0. deg
1 1 1

/vis/viewer/set/lightsThetaPhi
/vis/viewer/setlightsVector

double[2] u
double[3]

Set direction from target to lights

[theta] [phi] [unit]
[x] [y] [z]

60 45 deg
1 1 1

/vis/viewer/zoom

double

To zoom the view

[scale factor]

2

/vis/viewer/reset

-

Reset view point

-

-

/vis/viewer/set/style

string

Set drawing style

[style]

wireframe, surface, cloud

/vis/scene/add/trajectories

string

Adds trajectories

[style]

rich (gives extra informations about parameters), smooth

/vis/scene/add/axes

double[4] u

Adds axes to current scene

[x_origin] [y_origin] [z_origin] [size] [units]

0 0 0 1 m

/vis/scene/add/hits

-

Adds hits if application has hits defined

-

-

/vis/scene/add/scale

double[3]

Adds scale to current scene

[lenght] [unit] [direction]

/vis/scene/add/eventID

double[3]

Adds eventID to current scene

[size] [x-position] [y-position]

18 -0.95 0.9

/vis/scene/add/date

-

Adds the date to the view

-

-

/vis/scene/add/frame

-

Adds simple frame around the view

-

-

/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize

-
bool
double

Create drawByCharge model
Draw step points
Setting step points size

-
[option]
[value]

-
true, false
2

/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/drawByParticleID-0/set

-
string

Create drawByParticleID model
Set particle colour by its ID, otherwise trajectories are colour-coded by default

-
[particle] [colour]

-
(e-, e+, proton, gamma, neutron, pi+, pi-, pi0) colour

/vis/filtering/trajectories/create/particleFilter
/vis/filtering/trajectories/particleFilter-0/add
/vis/filtering/trajectories/particleFilter-0/invert

-
string
bool

Apply filter to draw only certain trajectories
Only allows applied particles to draw
Draw every particle except the one we chose before

-
particle
[option]

-
e-, e+, proton, gamma, neutron, pi+, pi-, pi0
true

/vis/scene/endOfRunAction

string

To supress one drawing from the end of /run/beamOn

[option]

accumulate

/vis/scene/endOfEventAction

string

To get one drawing with all of the accumulated events from run

[option]

accumulate

/vis/multithreading/maxEventQueueSize

double u

To define maximum event queue size

[value]

1000

/vis/geometry/set/visibility

string double[2]

To set visibility of logical volume

[volume_name] [depth] [visibility]

World 0 1

/vis/geometry/set/colour

string double[5]

To set colour of logical volume

[volume_name] [depth] [red] [green] [blue] [opacity]

for SV use Sensitive, for Bulk use Bulk 0 1. 1 1 1

/vis/viewer/set/autoRefresh

bool

To temporarily turn off redrawing after every vis command that might change the view, than once everything is set up, turn on

[option]

false, true

/vis/ogl/export

string double

Exports output of visualization to relative directory in defined format

[name] [width] [height]

visualization.png

/vis/viewer/flush

-

To force output of a new file, to see visualization at some other time

-

-

More visualization commands and options can be found in Geant4 Application Developers’ Guide.