Loading...
Searching...
No Matches
plotter.mac
Go to the documentation of this file.
1#
2# Use with a TSG vis driver.
3# Activate with:
4# /control/execute plotter.mac
5# /run/beamOn 10 # it will update the plotter regions at end of run.
6#
7
8#/vis/verbose errors
9#/vis/verbose confirmations
10
11#///////////////////////////////////////////////////////////////////////
12#/// activate the TSG vis driver: //////////////////////////////////////
13#///////////////////////////////////////////////////////////////////////
14/vis/sceneHandler/create TSG scene-handler-plotter
15
16#///////////////////////////////////////////////////////////////////////
17#/// viewer: ///////////////////////////////////////////////////////////
18#///////////////////////////////////////////////////////////////////////
19/vis/viewer/create scene-handler-plotter viewer-plotter 600x600-0+0
20
21/vis/viewer/set/background 1 1 1
22/vis/viewer/zoomTo 1
23/vis/viewer/set/viewpointVector 0 0 1
24
25#///////////////////////////////////////////////////////////////////////
26#/// scene: ////////////////////////////////////////////////////////////
27#///////////////////////////////////////////////////////////////////////
28/vis/plotter/create plotter-0
29
30/vis/scene/create scene-plotter
31/vis/scene/add/plotter plotter-0
32/vis/sceneHandler/attach scene-plotter
33
34#///////////////////////////////////////////////////////////////////////
35#/// create plotter regions and attach histograms to them: /////////////
36#///////////////////////////////////////////////////////////////////////
37/vis/plotter/setLayout plotter-0 2 2 # create 2x2 plotting regions.
38
39# B5 specific:
40/vis/plotter/add/h1 0 plotter-0 0
41/vis/plotter/add/h1 1 plotter-0 1
42/vis/plotter/add/h2 0 plotter-0 2
43/vis/plotter/add/h2 1 plotter-0 3
44
45#///////////////////////////////////////////////////////////////////////
46#/// plotters customisation: ///////////////////////////////////////////
47#///////////////////////////////////////////////////////////////////////
48
49# For texts, as titles and axis labels, the good old Hershey vectorial font is used
50# by default, but you can also specify a freetype font To use a freetype font, you
51# must build Geant4 by specifying -DGEANT4_USE_FREETYPE=ON yin your cmake flags.
52# (The ROOT_default and hippodraw styles (see below) uses freetype fonts).
53# Two embedded ttf fonts comes with the ToolsSG plotting: roboto_bold (some open source
54# kind of the Microsoft arialbd) and lato_regular (close to an helvetica).
55# You can use your own .ttf files by using the TOOLS_FONT_PATH environment variable
56# to specify the directory where they could be found.
57
58#///////////////////////////////////////////////////////////////////////
59#/// using styles: /////////////////////////////////////////////////////
60#///////////////////////////////////////////////////////////////////////
61/vis/plotter/style/list
62
63/vis/plotter/addStyle plotter-0 reset
64
65#
66# The below lines show how to customise a plotter by using an embedded style
67# (for example ROOT_default, hippodraw, default) or a style defined with commands.
68# The description of the embedded styles can be seen in Geant4 source code at:
69# source/externals/g4tools/include/tools/sg/plotter_some_styles
70#
71# A style can be applied on all regions by using:
72# /vis/plotter/addStyle <plotter> <style>
73# or on one region only by using:
74# /vis/plotter/addRegionStyle <plotter> <region> <style>
75#
76# The "all regions" styles are applied first, and then the per region ones.
77#
78# Without using a style, you can customise anyway directly by using
79# the command:
80# /vis/plotter/addRegionParameter
81# See below for examples.
82#
83#/vis/plotter/addStyle plotter-0 ROOT_default
84#/vis/plotter/addStyle plotter-0 hippodraw
85
86#///////////////////////////////////////////////////////////////////////
87#/// create and use style-0 style: /////////////////////////////////////
88#///////////////////////////////////////////////////////////////////////
89##/vis/plotter/style/remove style-0
90#/vis/plotter/style/select style-0
91#/vis/plotter/style/add infos_width 0.2 # percent of plotter width.
92#/vis/plotter/style/add bins_style.0.color blue
93#/vis/plotter/style/add bins_style.0.line_width 3
94#/vis/plotter/style/add infos_style.visible true
95#/vis/plotter/style/add infos_style.font roboto_bold.ttf
96#/vis/plotter/style/add infos_style.front_face cw
97
98#///////////////////////////////////////////////////////////////////////
99# example to have x_axis as ROOT_default:
100#/vis/plotter/style/add x_axis.modeling hplot
101#/vis/plotter/style/add x_axis.divisions 510
102#/vis/plotter/style/add x_axis.title_hjust right
103#/vis/plotter/style/add x_axis.label_to_axis 0.005
104#/vis/plotter/style/add x_axis.label_height 0.04
105#/vis/plotter/style/add x_axis.tick_length 0.03
106#/vis/plotter/style/add x_axis.title_to_axis 0.05
107#/vis/plotter/style/add x_axis.title_height 0.04
108#/vis/plotter/style/add x_axis.is_log false
109
110#/vis/plotter/style/add x_axis.line_style.color black
111#/vis/plotter/style/add x_axis.line_style.line_width 1
112
113#/vis/plotter/style/add x_axis.ticks_style.color black
114#/vis/plotter/style/add x_axis.ticks_style.line_width 1
115
116#/vis/plotter/style/add x_axis.labels_style.color black
117#/vis/plotter/style/add x_axis.labels_style.scale 0.6
118#/vis/plotter/style/add x_axis.labels_style.font roboto_bold.ttf
119#/vis/plotter/style/add x_axis.labels_style.front_face cw
120#/vis/plotter/style/add x_axis.labels_style.smoothing true
121
122#/vis/plotter/style/add x_axis.title_style.color black
123#/vis/plotter/style/add x_axis.title_style.visible true
124#/vis/plotter/style/add x_axis.title_style.scale 0.6
125#/vis/plotter/style/add x_axis.title_style.font roboto_bold.ttf
126#/vis/plotter/style/add x_axis.title_style.front_face cw
127#/vis/plotter/style/add x_axis.title_style.smoothing true
128
129#/vis/plotter/style/add x_axis.mag_style.color black
130#/vis/plotter/style/add x_axis.mag_style.scale 0.6
131#/vis/plotter/style/add x_axis.mag_style.font roboto_bold.ttf
132#/vis/plotter/style/add x_axis.mag_style.front_face cw
133#/vis/plotter/style/add x_axis.mag_style.smoothing true
134#///////////////////////////////////////////////////////////////////////
135
136#/vis/plotter/style/list
137#/vis/plotter/style/print style-0
138
139#/vis/plotter/addRegionStyle plotter-0 0 style-0
140#/vis/plotter/addRegionStyle plotter-0 1 style-0
141
142#///////////////////////////////////////////////////////////////////////
143#/// set directly region parameters: ///////////////////////////////////
144#///////////////////////////////////////////////////////////////////////
145#
146# Without passing by a style, a plotting region can be customised directly
147# by using the command:
148# /vis/plotter/addRegionParameter
149# Use:
150# /vis/tsg/plotter/printParameters
151# to see the available parameters.
152# The declared parameters to be changed are applied after styles.
153#
154
155# to see region borders:
156#/vis/plotter/addRegionParameter plotter-0 0 background_style.line_width 0.001
157#/vis/plotter/addRegionParameter plotter-0 1 background_style.line_width 0.001
158#/vis/plotter/addRegionParameter plotter-0 2 background_style.line_width 0.001
159#/vis/plotter/addRegionParameter plotter-0 3 background_style.line_width 0.001
160
161/vis/plotter/addRegionParameter plotter-0 0 infos_width 0.2
162/vis/plotter/addRegionParameter plotter-0 1 infos_width 0.2
163/vis/plotter/addRegionParameter plotter-0 2 infos_width 0.2
164/vis/plotter/addRegionParameter plotter-0 3 infos_width 0.2
165#
166/vis/plotter/addRegionParameter plotter-0 0 bins_style.0.color blue
167/vis/plotter/addRegionParameter plotter-0 0 bins_style.0.line_width 3
168/vis/plotter/addRegionParameter plotter-0 1 bins_style.0.color blue
169/vis/plotter/addRegionParameter plotter-0 1 bins_style.0.line_width 3
170
171/vis/plotter/addRegionParameter plotter-0 2 bins_style.0.color blue
172/vis/plotter/addRegionParameter plotter-0 2 bins_style.0.line_width 1
173/vis/plotter/addRegionParameter plotter-0 3 bins_style.0.color blue
174/vis/plotter/addRegionParameter plotter-0 3 bins_style.0.line_width 1
175#
176/vis/plotter/addRegionParameter plotter-0 0 x_axis.title detector
177#/vis/plotter/addRegionParameter plotter-0 0 x_axis_automated false
178#/vis/plotter/addRegionParameter plotter-0 0 x_axis_min 0
179#/vis/plotter/addRegionParameter plotter-0 0 x_axis_max 50
180#/vis/plotter/addRegionParameter plotter-0 0 x_axis_is_log true
181#
182#/vis/plotter/addRegionParameter plotter-0 3 title_automated false
183#/vis/plotter/addRegionParameter plotter-0 3 title "my title"
184/vis/plotter/addRegionParameter plotter-0 1 bins_style.0.color red
185/vis/plotter/addRegionParameter plotter-0 3 background_style.back_color "0.95 0.95 0.95"
186
187#///////////////////////////////////////////////////////////////////////
188#/// let's go: /////////////////////////////////////////////////////////
189#///////////////////////////////////////////////////////////////////////
190#/run/beamOn 100 #it will update the plotters at end of run.
191
192#///////////////////////////////////////////////////////////////////////
193#/// To produce some "paper" output: ///////////////////////////////////
194#///////////////////////////////////////////////////////////////////////
195# Use gl2ps to produce a PostScript file (may be long if the scene as a lot of primitives):
196#/control/shell rm ./out.eps
197#/vis/tsg/export # it produces out.eps
198#/control/shell open ./out.eps # if on a Mac.
199#/control/shell display ./out.eps # with ImageMagick on a Linux.
200
201# Use gl2ps to produce a pdf file (may be long if the scene as a lot of primitives):
202#/control/shell rm ./out.pdf
203#/vis/tsg/export gl2ps_pdf out.pdf
204#/control/shell open ./out.pdf # if on a Mac.
205#/control/shell display ./out.pdf # with ImageMagick on a Linux.
206
207# Use the tools::sg offscreen zbuffer to produce an image and put it in a PostScript file:
208#/control/shell rm ./out.ps
209#/vis/tsg/export zb_ps out.ps
210#/control/shell open ./out.ps # if on a Mac.
211#/control/shell display ./out.ps # with ImageMagick on a Linux.

Applications | User Support | Publications | Collaboration