| 1 | <!-- ******************************************************** -->
|
|---|
| 2 | <!-- -->
|
|---|
| 3 | <!-- [History] -->
|
|---|
| 4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
|
|---|
| 5 | <!-- -->
|
|---|
| 6 | <!-- ******************************************************** -->
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | <!-- ******************* Section (Level#1) ****************** -->
|
|---|
| 10 | <sect1 id="sect.VisEnhTrj">
|
|---|
| 11 | <title>
|
|---|
| 12 | Enhanced Trajectory Drawing
|
|---|
| 13 | </title>
|
|---|
| 14 |
|
|---|
| 15 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 16 | <sect2 id="sect.VisEnhTrj.DflCnfg">
|
|---|
| 17 | <title>
|
|---|
| 18 | Default Configuration
|
|---|
| 19 | </title>
|
|---|
| 20 |
|
|---|
| 21 | <para>
|
|---|
| 22 | Trajectory drawing styles are specified through trajectory drawing
|
|---|
| 23 | models. Each drawing model has a default configuration provided
|
|---|
| 24 | through a G4VisTrajContext object. The default context settings are
|
|---|
| 25 | shown below.
|
|---|
| 26 |
|
|---|
| 27 | <informaltable>
|
|---|
| 28 | <tgroup cols="2">
|
|---|
| 29 | <tbody>
|
|---|
| 30 | <row>
|
|---|
| 31 | <entry>
|
|---|
| 32 | <emphasis role="bold">Property</emphasis>
|
|---|
| 33 | </entry>
|
|---|
| 34 | <entry>
|
|---|
| 35 | <emphasis role="bold">Default Setting</emphasis>
|
|---|
| 36 | </entry>
|
|---|
| 37 | </row>
|
|---|
| 38 | <row>
|
|---|
| 39 | <entry>
|
|---|
| 40 | Line colour
|
|---|
| 41 | </entry>
|
|---|
| 42 | <entry>
|
|---|
| 43 | grey
|
|---|
| 44 | </entry>
|
|---|
| 45 | </row>
|
|---|
| 46 | <row>
|
|---|
| 47 | <entry>
|
|---|
| 48 | Line visibility
|
|---|
| 49 | </entry>
|
|---|
| 50 | <entry>
|
|---|
| 51 | true
|
|---|
| 52 | </entry>
|
|---|
| 53 | </row>
|
|---|
| 54 | <row>
|
|---|
| 55 | <entry>
|
|---|
| 56 | Draw line
|
|---|
| 57 | </entry>
|
|---|
| 58 | <entry>
|
|---|
| 59 | true
|
|---|
| 60 | </entry>
|
|---|
| 61 | </row>
|
|---|
| 62 | <row>
|
|---|
| 63 | <entry>
|
|---|
| 64 | Draw auxiliary points
|
|---|
| 65 | </entry>
|
|---|
| 66 | <entry>
|
|---|
| 67 | false
|
|---|
| 68 | </entry>
|
|---|
| 69 | </row>
|
|---|
| 70 | <row>
|
|---|
| 71 | <entry>
|
|---|
| 72 | Auxiliary point type
|
|---|
| 73 | </entry>
|
|---|
| 74 | <entry>
|
|---|
| 75 | squares
|
|---|
| 76 | </entry>
|
|---|
| 77 | </row>
|
|---|
| 78 | <row>
|
|---|
| 79 | <entry>
|
|---|
| 80 | Auxiliary point size
|
|---|
| 81 | </entry>
|
|---|
| 82 | <entry>
|
|---|
| 83 | 0
|
|---|
| 84 | </entry>
|
|---|
| 85 | </row>
|
|---|
| 86 | <row>
|
|---|
| 87 | <entry>
|
|---|
| 88 | Auxiliary point fill style
|
|---|
| 89 | </entry>
|
|---|
| 90 | <entry>
|
|---|
| 91 | filled
|
|---|
| 92 | </entry>
|
|---|
| 93 | </row>
|
|---|
| 94 | <row>
|
|---|
| 95 | <entry>
|
|---|
| 96 | Auxiliary point colour
|
|---|
| 97 | </entry>
|
|---|
| 98 | <entry>
|
|---|
| 99 | magenta
|
|---|
| 100 | </entry>
|
|---|
| 101 | </row>
|
|---|
| 102 | <row>
|
|---|
| 103 | <entry>
|
|---|
| 104 | Auxiliary point visibility
|
|---|
| 105 | </entry>
|
|---|
| 106 | <entry>
|
|---|
| 107 | true
|
|---|
| 108 | </entry>
|
|---|
| 109 | </row>
|
|---|
| 110 | <row>
|
|---|
| 111 | <entry>
|
|---|
| 112 | Draw step point
|
|---|
| 113 | </entry>
|
|---|
| 114 | <entry>
|
|---|
| 115 | false
|
|---|
| 116 | </entry>
|
|---|
| 117 | </row>
|
|---|
| 118 | <row>
|
|---|
| 119 | <entry>
|
|---|
| 120 | Step point type
|
|---|
| 121 | </entry>
|
|---|
| 122 | <entry>
|
|---|
| 123 | circles
|
|---|
| 124 | </entry>
|
|---|
| 125 | </row>
|
|---|
| 126 | <row>
|
|---|
| 127 | <entry>
|
|---|
| 128 | Step point size
|
|---|
| 129 | </entry>
|
|---|
| 130 | <entry>
|
|---|
| 131 | 0
|
|---|
| 132 | </entry>
|
|---|
| 133 | </row>
|
|---|
| 134 | <row>
|
|---|
| 135 | <entry>
|
|---|
| 136 | Step point fill style
|
|---|
| 137 | </entry>
|
|---|
| 138 | <entry>
|
|---|
| 139 | filled
|
|---|
| 140 | </entry>
|
|---|
| 141 | </row>
|
|---|
| 142 | <row>
|
|---|
| 143 | <entry>
|
|---|
| 144 | Step point colour
|
|---|
| 145 | </entry>
|
|---|
| 146 | <entry>
|
|---|
| 147 | yellow
|
|---|
| 148 | </entry>
|
|---|
| 149 | </row>
|
|---|
| 150 | <row>
|
|---|
| 151 | <entry>
|
|---|
| 152 | Step point visibility
|
|---|
| 153 | </entry>
|
|---|
| 154 | <entry>
|
|---|
| 155 | true
|
|---|
| 156 | </entry>
|
|---|
| 157 | </row>
|
|---|
| 158 | <row>
|
|---|
| 159 | <entry>
|
|---|
| 160 | Time slice interval
|
|---|
| 161 | </entry>
|
|---|
| 162 | <entry>
|
|---|
| 163 | 0
|
|---|
| 164 | </entry>
|
|---|
| 165 | </row>
|
|---|
| 166 | </tbody>
|
|---|
| 167 | </tgroup>
|
|---|
| 168 | </informaltable>
|
|---|
| 169 | </para>
|
|---|
| 170 |
|
|---|
| 171 | <para>
|
|---|
| 172 | Points to note:
|
|---|
| 173 |
|
|---|
| 174 | <itemizedlist spacing="compact">
|
|---|
| 175 | <listitem><para>
|
|---|
| 176 | The context approach is intended to replace the configuration
|
|---|
| 177 | through the imode parameter. The use of imode is depreciated and
|
|---|
| 178 | will be removed in Geant4 v9.0.
|
|---|
| 179 | </para></listitem>
|
|---|
| 180 | <listitem><para>
|
|---|
| 181 | Different visualisation drivers handle trajectory configuration
|
|---|
| 182 | in different ways, so trajectories may not necessarily get
|
|---|
| 183 | displayed as you have configured them.
|
|---|
| 184 | </para></listitem>
|
|---|
| 185 | </itemizedlist>
|
|---|
| 186 | </para>
|
|---|
| 187 |
|
|---|
| 188 | </sect2>
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 192 | <sect2 id="sect.VisEnhTrj.DrdMdl">
|
|---|
| 193 | <title>
|
|---|
| 194 | Trajectory Drawing Models
|
|---|
| 195 | </title>
|
|---|
| 196 |
|
|---|
| 197 | <para>
|
|---|
| 198 | A trajectory drawing model can override the default context
|
|---|
| 199 | according to the properties of a given trajectory. The following
|
|---|
| 200 | models are supplied with the Geant4 distribution:
|
|---|
| 201 |
|
|---|
| 202 | <itemizedlist spacing="compact">
|
|---|
| 203 | <listitem><para>
|
|---|
| 204 | G4TrajectoryGenericDrawer (generic)
|
|---|
| 205 | </para></listitem>
|
|---|
| 206 | <listitem><para>
|
|---|
| 207 | G4TrajectoryDrawByCharge (drawByCharge)
|
|---|
| 208 | </para></listitem>
|
|---|
| 209 | <listitem><para>
|
|---|
| 210 | G4TrajectoryDrawByParticleID (drawByParticleID)
|
|---|
| 211 | </para></listitem>
|
|---|
| 212 | <listitem><para>
|
|---|
| 213 | G4TrajectoryDrawByOriginVolume (drawByOriginVolume)
|
|---|
| 214 | </para></listitem>
|
|---|
| 215 | <listitem><para>
|
|---|
| 216 | G4TrajectoryDrawByAttribute (drawByAttribute)
|
|---|
| 217 | </para></listitem>
|
|---|
| 218 | </itemizedlist>
|
|---|
| 219 | </para>
|
|---|
| 220 |
|
|---|
| 221 | <para>
|
|---|
| 222 | Both the context and model properties can be configured by the
|
|---|
| 223 | user. The models are described briefly below, followed by some
|
|---|
| 224 | example configuration commands.
|
|---|
| 225 | </para>
|
|---|
| 226 |
|
|---|
| 227 | <!-- ******* Bridgehead ******* -->
|
|---|
| 228 | <bridgehead renderas='sect4'>
|
|---|
| 229 | G4TrajectoryGenericDrawer
|
|---|
| 230 | </bridgehead>
|
|---|
| 231 |
|
|---|
| 232 | <para>
|
|---|
| 233 | This model simply draws all trajectories in the same style, with
|
|---|
| 234 | the properties provided by the context.
|
|---|
| 235 | </para>
|
|---|
| 236 |
|
|---|
| 237 | <!-- ******* Bridgehead ******* -->
|
|---|
| 238 | <bridgehead renderas='sect4'>
|
|---|
| 239 | G4TrajectoryDrawByCharge
|
|---|
| 240 | </bridgehead>
|
|---|
| 241 |
|
|---|
| 242 | <para>
|
|---|
| 243 | This is the default model - if no model is specified by the user,
|
|---|
| 244 | this model will be constructed automatically. The trajectory lines
|
|---|
| 245 | are coloured according to charge, with all other configuration
|
|---|
| 246 | parameters provided by the default context. The default colouring
|
|---|
| 247 | scheme is shown below.
|
|---|
| 248 |
|
|---|
| 249 | <informalexample>
|
|---|
| 250 | <programlisting>
|
|---|
| 251 | Charge Colour
|
|---|
| 252 | ----------------------
|
|---|
| 253 | 1 Blue
|
|---|
| 254 | -1 Red
|
|---|
| 255 | 0 Green
|
|---|
| 256 | </programlisting>
|
|---|
| 257 | </informalexample>
|
|---|
| 258 | </para>
|
|---|
| 259 |
|
|---|
| 260 | <!-- ******* Bridgehead ******* -->
|
|---|
| 261 | <bridgehead renderas='sect4'>
|
|---|
| 262 | G4TrajectoryDrawByParticleID
|
|---|
| 263 | </bridgehead>
|
|---|
| 264 |
|
|---|
| 265 | <para>
|
|---|
| 266 | This model colours trajectory lines according to particle type. All
|
|---|
| 267 | other configuration parameters are provided by the default context.
|
|---|
| 268 | By default, all trajectories are coloured grey. Chosen particle
|
|---|
| 269 | types can be highlighted with specified colours.
|
|---|
| 270 | </para>
|
|---|
| 271 |
|
|---|
| 272 | <!-- ******* Bridgehead ******* -->
|
|---|
| 273 | <bridgehead renderas='sect4'>
|
|---|
| 274 | G4TrajectoryDrawByOriginVolume
|
|---|
| 275 | </bridgehead>
|
|---|
| 276 |
|
|---|
| 277 | <para>
|
|---|
| 278 | This model colours trajectory lines according to the trajectories
|
|---|
| 279 | originating volume name. The volume can be either a logical or
|
|---|
| 280 | physical volume. Physical volume takes precedence over logical
|
|---|
| 281 | volume. All trajectories are coloured grey by default.
|
|---|
| 282 | </para>
|
|---|
| 283 |
|
|---|
| 284 | <!-- ******* Bridgehead ******* -->
|
|---|
| 285 | <bridgehead renderas='sect4'>
|
|---|
| 286 | G4TrajectoryDrawByAttribute
|
|---|
| 287 | </bridgehead>
|
|---|
| 288 |
|
|---|
| 289 | <para>
|
|---|
| 290 | This model draws trajectories based on the HepRep style attributes
|
|---|
| 291 | associated with trajectories. Each attribute drawer can be configured
|
|---|
| 292 | with interval and/or single value data. A new context object is
|
|---|
| 293 | created for each interval/single value. This makes it possible to
|
|---|
| 294 | have different step point markers etc, as well as line colour for
|
|---|
| 295 | trajectory attributes falling into different intervals, or matching
|
|---|
| 296 | single values. The single value data should override the interval data,
|
|---|
| 297 | allowing specific values to be highlighted. Units should be specified
|
|---|
| 298 | on the command line if the attribute unit is specified either as a
|
|---|
| 299 | G4BestUnit or if the unit is part of the value string.
|
|---|
| 300 | </para>
|
|---|
| 301 |
|
|---|
| 302 | </sect2>
|
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 306 | <sect2 id="sect.VisEnhTrj.CntlComm">
|
|---|
| 307 | <title>
|
|---|
| 308 | Controlling from Commands
|
|---|
| 309 | </title>
|
|---|
| 310 |
|
|---|
| 311 | <para>
|
|---|
| 312 | Multiple trajectory models can be created and configured using
|
|---|
| 313 | commands in the "<literal>/vis/modeling/trajectories/</literal>" directory.
|
|---|
| 314 | It is then possible to list available models and select one to be
|
|---|
| 315 | current.
|
|---|
| 316 | </para>
|
|---|
| 317 |
|
|---|
| 318 | <para>
|
|---|
| 319 | Model configuration commands are generated dynamically when a
|
|---|
| 320 | model is instantiated. These commands apply directly to that
|
|---|
| 321 | instance. This makes it possible to have multiple instances of the
|
|---|
| 322 | drawByCharge model for example, each independently configurable
|
|---|
| 323 | through it's own set of commands.
|
|---|
| 324 | </para>
|
|---|
| 325 |
|
|---|
| 326 | <para>
|
|---|
| 327 | See the interactive help for more information on the available
|
|---|
| 328 | commands.
|
|---|
| 329 | </para>
|
|---|
| 330 |
|
|---|
| 331 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 332 | <sect3 id="sect.VisEnhTrj.CntlComm.ExpComm">
|
|---|
| 333 | <title>
|
|---|
| 334 | Example commands
|
|---|
| 335 | </title>
|
|---|
| 336 |
|
|---|
| 337 | <para>
|
|---|
| 338 | #Create a generic model named generic-0 by default
|
|---|
| 339 |
|
|---|
| 340 | <informalexample>
|
|---|
| 341 | <programlisting>
|
|---|
| 342 | /vis/modeling/trajectories/create/generic
|
|---|
| 343 | </programlisting>
|
|---|
| 344 | </informalexample>
|
|---|
| 345 | </para>
|
|---|
| 346 |
|
|---|
| 347 | <para>
|
|---|
| 348 | #Configure context to colour all trajectories red
|
|---|
| 349 |
|
|---|
| 350 | <informalexample>
|
|---|
| 351 | <programlisting>
|
|---|
| 352 | /vis/modeling/trajectories/generic-0/default/setLineColour red
|
|---|
| 353 | </programlisting>
|
|---|
| 354 | </informalexample>
|
|---|
| 355 | </para>
|
|---|
| 356 |
|
|---|
| 357 | <para>
|
|---|
| 358 | #Create a drawByCharge model named drawCharge-0 by default
|
|---|
| 359 | (Subsequent models will be named drawByCharge-1, drawByCharge-2,
|
|---|
| 360 | etc.)
|
|---|
| 361 |
|
|---|
| 362 | <informalexample>
|
|---|
| 363 | <programlisting>
|
|---|
| 364 | /vis/modeling/trajectories/create/drawByCharge
|
|---|
| 365 | </programlisting>
|
|---|
| 366 | </informalexample>
|
|---|
| 367 | </para>
|
|---|
| 368 |
|
|---|
| 369 | <para>
|
|---|
| 370 | #Create a drawByCharge model named testChargeModel
|
|---|
| 371 |
|
|---|
| 372 | <informalexample>
|
|---|
| 373 | <programlisting>
|
|---|
| 374 | /vis/modeling/trajectories/create/drawByCharge testChargeModel
|
|---|
| 375 | </programlisting>
|
|---|
| 376 | </informalexample>
|
|---|
| 377 | </para>
|
|---|
| 378 |
|
|---|
| 379 | <para>
|
|---|
| 380 | #Configure drawByCharge-0 model
|
|---|
| 381 |
|
|---|
| 382 | <informalexample>
|
|---|
| 383 | <programlisting>
|
|---|
| 384 | /vis/modeling/trajectories/drawByCharge-0/set 1 red
|
|---|
| 385 | /vis/modeling/trajectories/drawByCharge-0/set -1 red
|
|---|
| 386 | /vis/modeling/trajectories/drawByCharge-0/set 0 white
|
|---|
| 387 | </programlisting>
|
|---|
| 388 | </informalexample>
|
|---|
| 389 | </para>
|
|---|
| 390 |
|
|---|
| 391 | <para>
|
|---|
| 392 | #Configure testCharge model through G4Colour components
|
|---|
| 393 |
|
|---|
| 394 | <informalexample>
|
|---|
| 395 | <programlisting>
|
|---|
| 396 | /vis/modeling/trajectories/testChargeModel/setRGBA 1 0 1 1 1
|
|---|
| 397 | /vis/modeling/trajectories/testChargeModel/setRGBA -1 0.5 0.5 0.5 1
|
|---|
| 398 | /vis/modeling/trajectories/testChargeModel/setRGBA 0 1 1 0 1
|
|---|
| 399 | </programlisting>
|
|---|
| 400 | </informalexample>
|
|---|
| 401 | </para>
|
|---|
| 402 |
|
|---|
| 403 | <para>
|
|---|
| 404 | #Create a drawByParticleID model named drawByParticleID-0
|
|---|
| 405 |
|
|---|
| 406 | <informalexample>
|
|---|
| 407 | <programlisting>
|
|---|
| 408 | /vis/modeling/trajectories/create/drawByParticleID
|
|---|
| 409 | </programlisting>
|
|---|
| 410 | </informalexample>
|
|---|
| 411 | </para>
|
|---|
| 412 |
|
|---|
| 413 | <para>
|
|---|
| 414 | #Configure drawByParticleID-0 model
|
|---|
| 415 |
|
|---|
| 416 | <informalexample>
|
|---|
| 417 | <programlisting>
|
|---|
| 418 | /vis/modeling/trajectories/drawByParticleID-0/set gamma red
|
|---|
| 419 | /vis/modeling/trajectories/drawByParticleID-0/setRGBA e+ 1 0 1 1
|
|---|
| 420 | </programlisting>
|
|---|
| 421 | </informalexample>
|
|---|
| 422 | </para>
|
|---|
| 423 |
|
|---|
| 424 | <para>
|
|---|
| 425 | #List available models
|
|---|
| 426 |
|
|---|
| 427 | <informalexample>
|
|---|
| 428 | <programlisting>
|
|---|
| 429 | /vis/modeling/trajectories/list
|
|---|
| 430 | </programlisting>
|
|---|
| 431 | </informalexample>
|
|---|
| 432 | </para>
|
|---|
| 433 |
|
|---|
| 434 | <para>
|
|---|
| 435 | #select drawByParticleID-0 to be current
|
|---|
| 436 |
|
|---|
| 437 | <informalexample>
|
|---|
| 438 | <programlisting>
|
|---|
| 439 | /vis/modeling/trajectories/select drawByParticleID-0
|
|---|
| 440 | </programlisting>
|
|---|
| 441 | </informalexample>
|
|---|
| 442 | </para>
|
|---|
| 443 |
|
|---|
| 444 | <para>
|
|---|
| 445 | #Create a drawByAttribute model named drawByAttribute-0
|
|---|
| 446 |
|
|---|
| 447 | <informalexample>
|
|---|
| 448 | <programlisting>
|
|---|
| 449 | /vis/modeling/trajectories/create/drawByAttribute
|
|---|
| 450 | </programlisting>
|
|---|
| 451 | </informalexample>
|
|---|
| 452 | </para>
|
|---|
| 453 |
|
|---|
| 454 | <para>
|
|---|
| 455 | #Configure drawByAttribute-0 model
|
|---|
| 456 |
|
|---|
| 457 | <informalexample>
|
|---|
| 458 | <programlisting>
|
|---|
| 459 | /vis/modeling/trajectories/drawByAttribute-0/verbose true
|
|---|
| 460 | </programlisting>
|
|---|
| 461 | </informalexample>
|
|---|
| 462 | </para>
|
|---|
| 463 |
|
|---|
| 464 | <para>
|
|---|
| 465 | #Select attribute "CPN"
|
|---|
| 466 |
|
|---|
| 467 | <informalexample>
|
|---|
| 468 | <programlisting>
|
|---|
| 469 | /vis/modeling/trajectories/drawByAttribute-0/setAttribute CPN
|
|---|
| 470 | </programlisting>
|
|---|
| 471 | </informalexample>
|
|---|
| 472 | </para>
|
|---|
| 473 |
|
|---|
| 474 | <para>
|
|---|
| 475 | #Configure single value data
|
|---|
| 476 |
|
|---|
| 477 | <informalexample>
|
|---|
| 478 | <programlisting>
|
|---|
| 479 | /vis/modeling/trajectories/drawByAttribute-0/addValue brem_key eBrem
|
|---|
| 480 | /vis/modeling/trajectories/drawByAttribute-0/addValue annihil_key annihil
|
|---|
| 481 | /vis/modeling/trajectories/drawByAttribute-0/addValue decay_key Decay
|
|---|
| 482 | /vis/modeling/trajectories/drawByAttribute-0/addValue muIon_key muIoni
|
|---|
| 483 | /vis/modeling/trajectories/drawByAttribute-0/addValue eIon_key eIoni
|
|---|
| 484 |
|
|---|
| 485 | /vis/modeling/trajectories/drawByAttribute-0/brem_key/setLineColour red
|
|---|
| 486 | /vis/modeling/trajectories/drawByAttribute-0/annihil_key/setLineColour green
|
|---|
| 487 | /vis/modeling/trajectories/drawByAttribute-0/decay_key/setLineColour cyan
|
|---|
| 488 | /vis/modeling/trajectories/drawByAttribute-0/eIon_key/setLineColour yellow
|
|---|
| 489 | /vis/modeling/trajectories/drawByAttribute-0/muIon_key/setLineColour magenta
|
|---|
| 490 | </programlisting>
|
|---|
| 491 | </informalexample>
|
|---|
| 492 | </para>
|
|---|
| 493 |
|
|---|
| 494 | <para>
|
|---|
| 495 | #Create a drawByAttribute model named drawByAttribute-1
|
|---|
| 496 |
|
|---|
| 497 | <informalexample>
|
|---|
| 498 | <programlisting>
|
|---|
| 499 | /vis/modeling/trajectories/create/drawByAttribute
|
|---|
| 500 | </programlisting>
|
|---|
| 501 | </informalexample>
|
|---|
| 502 | </para>
|
|---|
| 503 |
|
|---|
| 504 | <para>
|
|---|
| 505 | #Select "IMag" attribute
|
|---|
| 506 |
|
|---|
| 507 | <informalexample>
|
|---|
| 508 | <programlisting>
|
|---|
| 509 | /vis/modeling/trajectories/drawByAttribute-1/setAttribute IMag
|
|---|
| 510 | </programlisting>
|
|---|
| 511 | </informalexample>
|
|---|
| 512 | </para>
|
|---|
| 513 |
|
|---|
| 514 | <para>
|
|---|
| 515 | #Configure interval data
|
|---|
| 516 |
|
|---|
| 517 | <informalexample>
|
|---|
| 518 | <programlisting>
|
|---|
| 519 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval1 0.0 keV 2.5MeV
|
|---|
| 520 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval2 2.5 MeV 5 MeV
|
|---|
| 521 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval3 5 MeV 7.5 MeV
|
|---|
| 522 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval4 7.5 MeV 10 MeV
|
|---|
| 523 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval5 10 MeV 12.5 MeV
|
|---|
| 524 | /vis/modeling/trajectories/drawByAttribute-1/addInterval interval6 12.5 MeV 10000 MeV
|
|---|
| 525 |
|
|---|
| 526 | /vis/modeling/trajectories/drawByAttribute-1/interval1/setLineColourRGBA 0.8 0 0.8 1
|
|---|
| 527 | /vis/modeling/trajectories/drawByAttribute-1/interval2/setLineColourRGBA 0.23 0.41 1 1
|
|---|
| 528 | /vis/modeling/trajectories/drawByAttribute-1/interval3/setLineColourRGBA 0 1 0 1
|
|---|
| 529 | /vis/modeling/trajectories/drawByAttribute-1/interval4/setLineColourRGBA 1 1 0 1
|
|---|
| 530 | /vis/modeling/trajectories/drawByAttribute-1/interval5/setLineColourRGBA 1 0.3 0 1
|
|---|
| 531 | /vis/modeling/trajectories/drawByAttribute-1/interval6/setLineColourRGBA 1 0 0 1
|
|---|
| 532 | </programlisting>
|
|---|
| 533 | </informalexample>
|
|---|
| 534 | </para>
|
|---|
| 535 |
|
|---|
| 536 | </sect3>
|
|---|
| 537 | </sect2>
|
|---|
| 538 |
|
|---|
| 539 |
|
|---|
| 540 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 541 | <sect2 id="sect.VisEnhTrj.CntlCmpl">
|
|---|
| 542 | <title>
|
|---|
| 543 | Controlling from Compiled Code
|
|---|
| 544 | </title>
|
|---|
| 545 |
|
|---|
| 546 | <para>
|
|---|
| 547 | It is possible to use the enhanced trajectory drawing functionality
|
|---|
| 548 | in compiled code as well as from commands. Multiple trajectory
|
|---|
| 549 | models can be instantiated, configured and registered with
|
|---|
| 550 | G4VisManager. Only one model may be current. For example:
|
|---|
| 551 |
|
|---|
| 552 | <informalexample>
|
|---|
| 553 | <programlisting>
|
|---|
| 554 | G4VisManager* visManager = new G4VisExecutive;
|
|---|
| 555 | visManager->Initialize();
|
|---|
| 556 |
|
|---|
| 557 | G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID;
|
|---|
| 558 | G4TrajectoryDrawByParticleID* model2 = new G4TrajectoryDrawByParticleID("test");
|
|---|
| 559 |
|
|---|
| 560 | model->SetDefault("cyan");
|
|---|
| 561 | model->Set("gamma", "green");
|
|---|
| 562 | model->Set("e+", "magenta");
|
|---|
| 563 | model->Set("e-", G4Colour(0.3, 0.3, 0.3));
|
|---|
| 564 |
|
|---|
| 565 | visManager->RegisterModel(model);
|
|---|
| 566 | visManager->RegisterModel(model2);
|
|---|
| 567 |
|
|---|
| 568 | visManager->SelectTrajectoryModel(model->Name());
|
|---|
| 569 | </programlisting>
|
|---|
| 570 | </informalexample>
|
|---|
| 571 | </para>
|
|---|
| 572 |
|
|---|
| 573 | </sect2>
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 577 | <sect2 id="sect.VisEnhTrj.DrwByTime">
|
|---|
| 578 | <title>
|
|---|
| 579 | Drawing by time
|
|---|
| 580 | </title>
|
|---|
| 581 |
|
|---|
| 582 | <para>
|
|---|
| 583 | To draw by time, you need to use a trajectory that records the
|
|---|
| 584 | track time at the beginning and end of each step. To do this, write
|
|---|
| 585 | a tracking action that sets G4RichTrajectory, for example:
|
|---|
| 586 |
|
|---|
| 587 | <informalexample>
|
|---|
| 588 | <programlisting>
|
|---|
| 589 | #include "G4UserTrackingAction.hh"
|
|---|
| 590 | class G4Track;
|
|---|
| 591 | class MyTrackingAction : public G4UserTrackingAction
|
|---|
| 592 | {
|
|---|
| 593 | public:
|
|---|
| 594 | virtual void PreUserTrackingAction(const G4Track* aTrack);
|
|---|
| 595 | };
|
|---|
| 596 | #include "G4RichTrajectory.hh"
|
|---|
| 597 | #include "G4TrackingManager.hh"
|
|---|
| 598 | #include "G4IdentityTrajectoryFilter.hh"
|
|---|
| 599 | #include "G4TransportationManager.hh"
|
|---|
| 600 | #include "G4PropagatorInField.hh"
|
|---|
| 601 | void MyTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
|---|
| 602 | {
|
|---|
| 603 | // Require rich trajectory...
|
|---|
| 604 | fpTrackingManager->SetTrajectory(new G4RichTrajectory(aTrack));
|
|---|
| 605 |
|
|---|
| 606 | // Activate storing of auxiliary points for smoother trajectory...
|
|---|
| 607 | static G4IdentityTrajectoryFilter curvedFilter;
|
|---|
| 608 | G4TransportationManager::GetTransportationManager()->
|
|---|
| 609 | GetPropagatorInField()->SetTrajectoryFilter(&curvedFilter);
|
|---|
| 610 | }
|
|---|
| 611 | </programlisting>
|
|---|
| 612 | </informalexample>
|
|---|
| 613 |
|
|---|
| 614 | and register an instance of this with the run manager (this can be
|
|---|
| 615 | done once and for all as soon as the run manager is instantiated,
|
|---|
| 616 | probably in your main program):
|
|---|
| 617 |
|
|---|
| 618 | <informalexample>
|
|---|
| 619 | <programlisting>
|
|---|
| 620 | #include "MyTrackingAction.hh"
|
|---|
| 621 | ...
|
|---|
| 622 | runManager -> SetUserAction (new MyTrackingAction);
|
|---|
| 623 | </programlisting>
|
|---|
| 624 | </informalexample>
|
|---|
| 625 | </para>
|
|---|
| 626 |
|
|---|
| 627 | <para>
|
|---|
| 628 | When you run, you need to create a trajectory model and set the
|
|---|
| 629 | time slice interval (remembering that paticles are often
|
|---|
| 630 | relativistic and travel 30 cm/ns):
|
|---|
| 631 |
|
|---|
| 632 | <informalexample>
|
|---|
| 633 | <programlisting>
|
|---|
| 634 | /vis/modeling/trajectories/create/drawByCharge
|
|---|
| 635 | /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
|
|---|
| 636 | /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 5
|
|---|
| 637 | /vis/modeling/trajectories/drawByCharge-0/default/setDrawAuxPts true
|
|---|
| 638 | /vis/modeling/trajectories/drawByCharge-0/default/setAuxPtsSize 5
|
|---|
| 639 | /vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.1 ns
|
|---|
| 640 | /vis/modeling/trajectories/list
|
|---|
| 641 | </programlisting>
|
|---|
| 642 | </informalexample>
|
|---|
| 643 |
|
|---|
| 644 | and use a graphics driver that can display by time:
|
|---|
| 645 |
|
|---|
| 646 | <informalexample>
|
|---|
| 647 | <programlisting>
|
|---|
| 648 | /vis/open OGLSX
|
|---|
| 649 | /vis/drawVolume
|
|---|
| 650 | /vis/scene/add/trajectories
|
|---|
| 651 | /vis/ogl/set/startTime 0.5 ns
|
|---|
| 652 | /vis/ogl/set/endTime 0.8 ns
|
|---|
| 653 | /run/beamOn
|
|---|
| 654 | /vis/viewer/refresh
|
|---|
| 655 | </programlisting>
|
|---|
| 656 | </informalexample>
|
|---|
| 657 | </para>
|
|---|
| 658 |
|
|---|
| 659 | <para>
|
|---|
| 660 | A good way to see the particles moving through the detector is:
|
|---|
| 661 |
|
|---|
| 662 | <informalexample>
|
|---|
| 663 | <programlisting>
|
|---|
| 664 | /vis/ogl/set/fade 1
|
|---|
| 665 | /vis/ogl/set/displayHeadTime true
|
|---|
| 666 | /control/alias timeRange 1
|
|---|
| 667 | /control/loop movie.loop -{timeRange} 40 0.1
|
|---|
| 668 | </programlisting>
|
|---|
| 669 | </informalexample>
|
|---|
| 670 |
|
|---|
| 671 | where <literal>fade</literal> gives a vapour-trail effect,
|
|---|
| 672 | <literal>displayHeadTime</literal> displays the time of the leading edge as
|
|---|
| 673 | 2D text, and <literal>movie.loop</literal> is a macro file:
|
|---|
| 674 |
|
|---|
| 675 | <informalexample>
|
|---|
| 676 | <programlisting>
|
|---|
| 677 | /vis/ogl/set/startTime {startTime} ns {timeRange} ns
|
|---|
| 678 | </programlisting>
|
|---|
| 679 | </informalexample>
|
|---|
| 680 | </para>
|
|---|
| 681 |
|
|---|
| 682 | <para>
|
|---|
| 683 | From there, it's straightforward to <xref linkend="sect.MkMovie" />
|
|---|
| 684 | make a movie.
|
|---|
| 685 | </para>
|
|---|
| 686 |
|
|---|
| 687 |
|
|---|
| 688 | </sect2>
|
|---|
| 689 | </sect1>
|
|---|
| 690 |
|
|---|