introduction to geant4 visualization - slac · 2014-11-13 · introduction to geant4 visualization...

40
Introduction to Geant4 Visualization 1 DAWN OpenGL So many options, it needs three title pages Introduction to Geant4 Visualization Makoto Asai (SLAC) Slides created by Joseph Perl (SLAC) HepRep/HepRApp Geant4 v10.0.p3

Upload: others

Post on 07-May-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Geant4 Visualization 1

DAWN

OpenGL

So many options, it needs three title pages

Introduction to Geant4 Visualization

Makoto Asai (SLAC) Slides created by Joseph Perl (SLAC)

HepRep/HepRApp

Geant4 v10.0.p3

Introduction to Geant4 Visualization 2

DAWN HepRep/FRED

OpenInventor

Introduction to Geant4 Visualization RayTracer

Introduction to Geant4 Visualization 3

DAWN

Qt

Introduction to Geant4 Visualization

gMocren

Introduction to Geant4 Visualization 4

Tutorials

5 Introduction to Geant4 Visualization

What Can be Visualized

n  Simulation data can be visualized: n  Geometrical components n  Particle trajectories and tracking steps n  Hits of particles in the geometry n  Scored energy, dose, etc.

n  Other user defined objects can be visualized: n  Polylines

n  such as coordinate axes n  3D Markers

n  such as eye guides n  Text

n  descriptive character strings n  comments or titles

6 Introduction to Geant4 Visualization

Controlling Visualization n  Your Geant4 code stays basically the same no matter which driver you use n  Visualization is performed either with commands or from C++ code

n  For the present tutorial, we confine ourselves to command-driven visualization. n  Some visualization drivers work directly from Geant4

n  OpenGL n  OpenInventor n  RayTracer n  ASCIITree

n  For other visualization drivers, you first have Geant4 produce a file, and then you have that file rendered by another application (which may have GUI control) n  HepRepFile n  DAWNFILE n  VRML2FILE n  gMocrenFile

n  You can open more than one driver at a time. n  For example, do a quick check in OpenGL,

then save the same event for a beautiful DAWN plot

7 Introduction to Geant4 Visualization

Controlling Which Drivers are Available n  Six of the visualization drivers are always included by default

(since they require no external libraries): n  HepRepFile n  DAWNFILE n  VRMLFILE n  RayTracer n  gMocrenFile n  ASCIITree

n  Other visualization drivers are included only if you request them in your cmake options.

n  You can also add your own visualization driver. n  Geant4's visualization system is modular. By creating just three new classes,

you can direct Geant4 information to your own visualization system.

8 Introduction to Geant4 Visualization

Details on the Eight Visualization Drivers

n  OpenGL n  OpenInventor n  HepRep n  DAWN n  VRML n  RayTracer n  gMocren n  ASCIITree

9 Introduction to Geant4 Visualization

OpenGL

n  /vis/open OGL

n  Features n  Control directly from Geant4 n  Uses GL libraries that are already

included on most Linux and Windows systems

n  Rendered, photorealistic image with some interactive features

n  zoom, rotate, translate n  Fast response (can usually exploit

full potential of graphics hardware) n  Save as pixel graphics or vector

EPS n  Live movies

n  Supported by John Allison, Laurent Garnier and Guy Barrand

10 Introduction to Geant4 Visualization

OpenGL with Qt Control n  New visualization driver and user interface

n  requires that you install Qt and link against this in your Geant4 ./Configure n  you can customize the interface to control any Geant4 command

Supported by Laurent Garnier

11 Introduction to Geant4 Visualization

OpenGL with Motif Control n  Somewhat obsolete now that Qt can take over this functionality

n  but still supported n  requires that you have Motif and link against this in your Geant4 ./Configure

12 Introduction to Geant4 Visualization

Movies: Time Development of the Event n  New features since release 8.2 allow you to do a new kind of Geant4 movie.

You can make movies that show Time Development of an event n  I.e., a shower in slow motion

n  Based on technique of “time-slicing”, breaking trajectories into individual slices, each with a time attribute. n  requires newer visualization features, rich trajectory and some extensions to the

OpenGL driver n  you can run these animations Directly from Geant4, does NOT involve stitching

together a movie by hand

n  A collection of example movies has been prepared by John Allison: http://www.hep.man.ac.uk/u/johna/pub/Geant4/Movies/

n  How-To Presentation: http://geant4.slac.stanford.edu/Presentations/vis/HowToMakeAMovie.ppt http://geant4.slac.stanford.edu/Presentations/vis/HowToMakeAMovie.pdf

13 Introduction to Geant4 Visualization

50 MeV electron into lead-liqAr calorimeter electron: red���positron: blue���photon: green Yellow circles are step points -- geometrical boundaries or physical processes

http://www.hep.man.ac.uk/u/johna/pub/Geant4/Movies/Single50MeV.mpg

14 Introduction to Geant4 Visualization

10 GeV pion

3 ns

Mpeg4 encoding with QuickTime Pro

http://www.hep.man.ac.uk/u/johna/pub/Geant4/Movies/pi-10Gevpi+neutronSideView.mp4

15 Introduction to Geant4 Visualization

Movies: Live from Geant4 OpenGL

16 Introduction to Geant4 Visualization

What was in the Previous Movie

n  http://www.hep.man.ac.uk/u/johna/pub/Geant4/Movies/ pi-10Gevpi+neutronZoom.mp4

n  10 GeV/c pi- on lead (in a lead-liquid-argon calorimeter, exampleN03 with QGSP physics) n  A large number of slow pions, protons and neutrons n  Three fast pi- and one fast pi+ that subsequently interacts again n  Neutrons (yellow) hang around for several ns

n  Green circle is the light front n  Careful viewer will notice that near the end of the event, some particles

appear to cross the light front. This was a bug in the way the light front sphere was rendered in perspective view, fixed in release 8.2

17 Introduction to Geant4 Visualization

OpenInventor

n  /vis/open OIX or /vis/open IOWin32

n  Features n  Control from the OpenInventor GUI n  Requires addition of OpenInventor libraries (freely available for most

Linux systems and Windows). n  Rendered, photorealistic image n  Many interactive features

n  zoom, rotate, translate n  click to “see inside” opaque volumes n  click to show attributes (momentum, etc., dumps to standard

output) n  Fast response (can usually exploit full potential of graphics hardware) n  Expanded printing ability (vector and pixel graphics)

n  Supported by Guy Barrand

18 Introduction to Geant4 Visualization

OpenInventor: Start from Geant4 n  With OpenInventor, start from Geant4, but then some control from

OpenInventor GUI

19 Introduction to Geant4 Visualization

OpenInventor: More GUI Control n  You can also choose to control the Geant4 run from OpenInventor.

20 Introduction to Geant4 Visualization

HepRep n  /vis/open HepRepFile

n  Features n  Create a file to view in the

n  HepRApp HepRep Browser n  WIRED4 JAS Plugin n  or FRED Event Display

n  Requires one of the above browsers (freely available for all systems) n  Wireframe or simple area fills (not photorealistic) n  Many interactive features

n  zoom, rotate, translate n  click to show attributes (momentum, etc.) n  special projections (FishEye, etc.) n  control visibility from hierarchical (tree) view of data

n  Hierarchical view of the geometry n  HepRApp and WIRED4 can export to many vector graphic formats

(PostScript, PDF, etc.)

n  Supported by Joseph Perl

21 Introduction to Geant4 Visualization

HepRApp: Shows Geometry Hierarchy Turn visibility on and off from hierarchical control

22 Introduction to Geant4 Visualization

HepRApp: Pick to Show Physics Attributes

Picked on this volume to show • Material • Density • Radlen • etc

Picked on this trajectory to show • Particle ID • Charge • Momentum • etc.

Introduction to Geant4 Visualization 23

HepRApp: Labeling by Any Attribute

Introduction to Geant4 Visualization 24

HepRApp: Cut by Any Attribute

25 Introduction to Geant4 Visualization

DAWN

n  /vis/open DAWNFILE

n  Features n  Create a .prim file n  Requires DAWN, available for all Linux and Windows systems n  DAWN creates a rendered, photorealistic PostScript image n  No interactive features once at PostScript stage n  Highest quality technical rendering - vector PostScript n  View or print from your favorite PostScript application

n  Supported by Satoshi Tanaka

26 Introduction to Geant4 Visualization

Origins of DAWN

Fukui Renderer DAWN (Drawer for Academic WritiNgs). n  A vectorized 3D PostScript processor with analytical hidden line/

surface removal intended for precise technical drawing of complicated objects.

n  Specifically designed for Geant4. n  Primitives set is same as Geant4 primitives set. n  Produces device-independent vectorized graphics for high quality

technical applications.

27 Introduction to Geant4 Visualization

DAWN Examples n  From a repository of beautiful images at

n  http://geant4.kek.jp/~tanaka/GEANT4/ATLAS_G4_GIFFIG/

28 Introduction to Geant4 Visualization

DAWN Examples

29 Introduction to Geant4 Visualization

DAWN makes True Vector PostScript n  So when you zoom in with your PostScript browser, the images

retain high resolution

30 Introduction to Geant4 Visualization

DAWNCUT and DAVID n  A standalone program, DAWNCUT, can perform a planar cut

on a DAWN image. n  DAWNCUT takes as input a .prim file and some cut parameters.

Its output is a new .prim file to which the cut has been applied.

n  Another standalone program, DAVID, can show you any volume overlap errors in your geometry. n  DAVID takes as input a .prim file and

outputs a new .prim file in which overlapping volumes have been highlighted.

n  Details at http://geant4.kek.jp/~tanaka/

31 Introduction to Geant4 Visualization

VRML

n  /vis/open VRML1FILE or /vis/open VRML2FILE

n  Features n  Create a file to view in any VRML browser (some as web browser

plug-ins). n  Requires VRML browser (many different choices for different

operating systems). n  Rendered, photorealistic image with some interactive features

n  zoom, rotate, translate n  Limited printing ability (pixel graphics, not vector graphics)

n  Supported by Satoshi Tanaka

32 Introduction to Geant4 Visualization

VRML n  Geant4 creates VRML File

n  /vis/open VRML1FILE or /vis/open VRML2FILE n  View file in a VRML Browser

n  Many free options, for example, here is one from octaga.com

33 Introduction to Geant4 Visualization

RayTracer n  /vis/open RayTracer

n  Features n  Create a jpeg file

(and with RayTracerX option, also draws to x window) n  Forms image by using Geant4's own tracking to follow photons

through the detector n  Can show geometry but not trajectories n  Can render any geometry that Geant4 can handle (such as Boolean

solids) - no other Vis driver can handle every case n  Supports shadows, transparency and mirrored surfaces

n  Supported by Makoto Asai and John Allison

34 Introduction to Geant4 Visualization

RayTracer n  RayTracer works by using Geant4's own tracking to shoot photons through the

detector onto a sensitive plane. The resulting image is presented as a jpeg file. n  /vis/open RayTracer

n  Some pieces of geometries may fail to show up in other visualization drivers (due to algorithms those drivers use to compute visualizable shapes and polygons), but RayTracer can handle any geometry that the Geant4 navigator can handle.

n  RayTracer can not be used to visualize Trajectories. n  Commands:

n  1) trace * Start the ray tracing. n  2) column * Define the number of horizontal pixels. n  3) row * Define the number of vertical pixels. n  4) target * Define the center position of the target. n  5) eyePosition * Define the eye position. n  6) lightDirection * Define the direction of illumination light. n  7) span * Define the angle per 100 pixels. n  8) headAngle * Define the head direction. n  9) attenuation * Define the attenuation length for transparent material. n  10) distortion * Distortion effect of the fish eye lens. n  11) ignoreTransparency * Ignore transparency even if the alpha of G4Colour < 1 n  12) backgroundColour * Set background colour: red green blue: range 0.->1.

35 Introduction to Geant4 Visualization

RayTracer Shows Shadows

36 Introduction to Geant4 Visualization

RayTracer Supports Transparency

37 Introduction to Geant4 Visualization

RayTracer Handles Mirrored Surfaces

Mirrored Surfaces

38 Introduction to Geant4 Visualization

RayTracer Handles Boolean Solids

39 Introduction to Geant4 Visualization

RayTracerX n  New since Geant4.8.0 n  In addition to

n  /vis/open RayTracer n  You have the option of

n  /vis/open RayTracerX

n  Builds same jpeg file as RayTracer, but simultaneously renders to screen so you can watch as rendering grows progressively smoother.

n  Means you can abort and retry the rendering with different view parameters without having to wait for the complete refinement of the image.

Introduction to Geant4 Visualization 40

gMocren Great tool available for volume visualization

•  From JST/CREST project (Japan) to improve Geant4 for medical physics

•  Able to visualize: –  Volume data

(including overlay of more than one set)

–  Trajectories

–  Geometry

•  Runs on: –  Windows and Linux

–  Mac will likely happen soon

–  Based on a commercial package but offered freely to all Geant4 users

–  http://geant4.kek.jp/gMocren

–  Installation is straightforward, follow the Download link on the above page •  First run gMocren's one-click installer

•  Then, inside C:\Program Files\gMocren\gtk, you will find the one-click installer for gtk