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