Visualisation GUI and Analysis http cern chgeant 4

  • Slides: 77
Download presentation
Visualisation, (G)UI and Analysis http: //cern. ch/geant 4 The full set of lecture notes

Visualisation, (G)UI and Analysis http: //cern. ch/geant 4 The full set of lecture notes of this Geant 4 Course is available at http: //geant 4. web. cern. ch/geant 4/meetings/school 2005/ Visualisation & (G)UI Geant 4 Course

Contents (1) n Part 1: How to perform visualisation n n Introduction Visualisable Objects

Contents (1) n Part 1: How to perform visualisation n n Introduction Visualisable Objects Visualisation Attributes Polyline and Marker Visualisation Drivers main() Function Visualisation Commands How to Visualise from C++ Codes Exercises Information Visualisation & (G)UI - Geant 4 Course 2

Contents (2) n Part 2: Geant 4 GUI n n n Select (G)UI Environmental

Contents (2) n Part 2: Geant 4 GUI n n n Select (G)UI Environmental variables Useful GUI Tools Released by Geant 4 Developers Visualisation & (G)UI - Geant 4 Course 3

Contents (3) n Part 3: DAVID and DTREE n n Graphically detecting overlaps in

Contents (3) n Part 3: DAVID and DTREE n n Graphically detecting overlaps in geometry Display of the detector geometry tree Visualisation & (G)UI - Geant 4 Course 4

Contents (4) n Part 4: AIDA and binding to analysis n n AIDA abstract

Contents (4) n Part 4: AIDA and binding to analysis n n AIDA abstract interfaces Geant 4 setup and analysis tools Visualisation & (G)UI - Geant 4 Course 5

PART 1 Geant 4 Visualisation & (G)UI Geant 4 Course

PART 1 Geant 4 Visualisation & (G)UI Geant 4 Course

1. Introduction n Geant 4 Visualisation must respond to varieties of user requirements n

1. Introduction n Geant 4 Visualisation must respond to varieties of user requirements n n n n Quick response to survey successive events Impressive special effects for demonstration High-quality output to prepare journal papers Flexible camera control for debugging geometry Highlighting overlapping of physical volumes Interactive picking of visualised objects … Visualisation & (G)UI - Geant 4 Course 7

2. Visualisable Objects (1) n Simulation data can be visualised such as: n n

2. Visualisable Objects (1) n Simulation data can be visualised such as: n n n Detector components A hierarchical structure of physical volumes A piece of physical volume, logical volume, and solid Particle trajectories and tracking steps Hits of particles in detector components Visualisation is performed either with commands or by writing C++ source codes of user-action classes Visualisation & (G)UI - Geant 4 Course 8

2. Visualisable Objects (2) n You can also visualise other user defined objects such

2. Visualisable Objects (2) n You can also visualise other user defined objects such as: A polyline, that is, a set of successive line segments (example: coordinate axes) n A marker which marks an arbitrary 3 D position (example: eye guides) n Texts n • character strings for description • comments or titles … Visualisation & (G)UI - Geant 4 Course 9

2. Visualisable Objects (3) n n n A typical application is the Draw. Trajectory

2. Visualisable Objects (3) n n n A typical application is the Draw. Trajectory and Draw. Hit methods The default G 4 VTrajectory: : Draw. Trajectory(G 4 int imode) draws positive/negative/neutral particle trajectories blue/red/green with yellow markers. The user must write Draw. Hit (see later) Visualisation & (G)UI - Geant 4 Course 10

3. Visualisation Attributes n n Control the appearance of visualisable objects n Colour, visibility,

3. Visualisation Attributes n n Control the appearance of visualisable objects n Colour, visibility, forced-wireframe style, etc n A set of visualisation attributes is held by the class G 4 Vis. Attributes A G 4 Vis. Attributes object is assigned to a visualisable object with its method Set. Vis. Attributes() : n experimental. Hall_logical -> Set. Vis. Attributes (G 4 Vis. Attributes: : Invisible) Visualisation & (G)UI - Geant 4 Course 11

3. 1 Constructors of G 4 Vis. Attributes The following constructors are supported by

3. 1 Constructors of G 4 Vis. Attributes The following constructors are supported by class G 4 Vis. Attributes: n n G 4 Vis. Attributes () (G 4 bool visibility) (const G 4 Colour& colour) (G 4 bool visibility, const G 4 Colour& colour) or use Set methods… Visualisation & (G)UI - Geant 4 Course 12

3. 2 Visibility A boolean flag (G 4 bool) to control the visibility of

3. 2 Visibility A boolean flag (G 4 bool) to control the visibility of objects n Access function n n G 4 Vis. Attributes: : Set. Visibility (G 4 bool visibility) If false is given as argument, objects are culled (not shown) if culling is on. n The default value of visibility is true. n The default is culling of invisible objects. n Visualisation & (G)UI - Geant 4 Course 13

3. 3 Colour (1) n Class G 4 Vis. Attributes holds its colour entry

3. 3 Colour (1) n Class G 4 Vis. Attributes holds its colour entry as an instance of class G 4 Colour n n An equivalent class name, G 4 Color, is also available G 4 Colour is instantiated by giving RGB components and opacity(alpha): G 4 Colour: : G 4 Colour(G 4 double red = 1. 0, G 4 double green = 1. 0, G 4 double blue = 1. 0, G 4 double alpha = 1. 0) n n The default arguments define a white object that will be opaque when drawn in solid mode (opacity does not affect wireframe mode) Visualisation & (G)UI - Geant 4 Course 14

3. 3 Colour (2) n Access functions of G 4 Vis. Attributes to set

3. 3 Colour (2) n Access functions of G 4 Vis. Attributes to set G 4 Colour n Set. Colour(const G 4 Colour& colour) n Set. Colour( G 4 double red, G 4 double green, G 4 double blue, G 4 double alpha = 1. ) n (or Set. Color) Visualisation & (G)UI - Geant 4 Course 15

3. 4 Assigning G 4 Vis. Attributes to a logical volume Class G 4

3. 4 Assigning G 4 Vis. Attributes to a logical volume Class G 4 Logical. Volume holds a pointer of G 4 Vis. Attributes n Access functions of G 4 Logical. Volume n n n Set. Vis. Attributes ( const G 4 Vis. Attributes* pva ) Remember, G 4 Vis. Attributes are held by a pointer; it must have a life as least as long as the holder… Visualisation & (G)UI - Geant 4 Course 16

Sample C++ Code: //----- C++ source codes: Assigning G 4 Vis. Attributes to a

Sample C++ Code: //----- C++ source codes: Assigning G 4 Vis. Attributes to a logical volume // Instantiation of a logical volume my. Target. Log = new G 4 Logical. Volume( my. Target. Tube, BGO, "TLog", 0, 0, 0); // Instantiation of a set of visualization // attributes with cyan colour G 4 Vis. Attributes * cal. Tube. Vis. Att = new G 4 Vis. Attributes(G 4 Colour(0. , 1. )); // Set the forced wireframe style cal. Tube. Vis. Att->Set. Force. Wireframe(true); // Assignment of the visualization attributes // to the logical volume my. Target. Log->Set. Vis. Attributes(cal. Tube. Vis. Att); Visualisation & (G)UI - Geant 4 Course 17

4. Polyline and Marker n Polyline and marker are defined in the graphics_reps category

4. Polyline and Marker n Polyline and marker are defined in the graphics_reps category n They are available to model 3 D scenes for visualisation Visualisation & (G)UI - Geant 4 Course 18

4. 1 Polyline A set of successive line segments n Defined with a class

4. 1 Polyline A set of successive line segments n Defined with a class G 4 Polyline n Used to visualise tracking steps, particle trajectories, coordinate axes, etc (but note availability of commands: /vis/scene/add/trajectories etc. ) n G 4 Polyline is defined as a list of G 4 Point 3 D objects. n Visualisation & (G)UI - Geant 4 Course 19

Sample C++ Code: //-- C++ source code: An example of defining a line segment

Sample C++ Code: //-- C++ source code: An example of defining a line segment // Instantiation G 4 Polyline x_axis; // Vertex positions x_axis. append ( G 4 Point 3 D ( 0. , 0. ) ); x_axis. append ( G 4 Point 3 D ( 5. * cm, 0. ) ); // Color G 4 Colour red ( 1. 0, 0. 0 ); // color for x-axis G 4 Vis. Attributes att ( red ); x_axis. Set. Vis. Attributes( att ); //-- end of C++ source code Visualisation & (G)UI - Geant 4 Course 20

4. 2 Marker (1) n n n Set a mark to an arbitrary 3

4. 2 Marker (1) n n n Set a mark to an arbitrary 3 D position Usually used to visualise hits of particles Designed as a 2 -dimensional primitive with shape (square, circle, etc), color, and special properties of n n (a) always facing the camera and (b) having the possibility of its size (diameter) defined either in real 3 D or 2 D screen units (pixels) Visualisation & (G)UI - Geant 4 Course 21

4. 2 Marker (2) n Kinds of markers Square : G 4 Square n

4. 2 Marker (2) n Kinds of markers Square : G 4 Square n Circle : G 4 Circle n Text : G 4 Text n n Constructors n n n G 4 Circle (const G 4 Point 3 D& pos) G 4 Square (const G 4 Point 3 D& pos) G 4 Text (const G 4 String& text, const G 4 Point 3 D& pos) Visualisation & (G)UI - Geant 4 Course 22

4. 2 Marker (3) n Each marker class inherits class n All access functions

4. 2 Marker (3) n Each marker class inherits class n All access functions of G 4 VMarker are available. For example, G 4 VMarker n Set. Position( const G 4 Point 3 D& ) Set. World. Size( G 4 double real_3 d_size ) n Set. Screen. Size( G 4 double 2 d_size_pixel ) n Set. Screen. Radius( G 4 double r ) n etc. n Visualisation & (G)UI - Geant 4 Course 23

Sample C++ Code: Definition of a small red circle as a marker : G

Sample C++ Code: Definition of a small red circle as a marker : G 4 Circle circle(position); // Instantiate a circle with its 3 D position. The // argument "position" is defined as G 4 Point 3 D instance circle. Set. Screen. Diameter (1. 0); circle. Set. Fill. Style (G 4 Circle: : filled); // Make it a filled circle G 4 Colour colour(1. , 0. ); // Define red color G 4 Vis. Attributes attribs(colour); // Define a red visualization attribute circle. Set. Vis. Attributes(attribs); // Assign the red attribute to the circle //-- end of C++ source code Visualisation & (G)UI - Geant 4 Course 24

4. 3 Draw methods of G 4 VVis. Manager n G 4 VVis. Manager

4. 3 Draw methods of G 4 VVis. Manager n G 4 VVis. Manager is the user interface to the concrete vis manager. It resides in the intercoms category. n Always protect your code by obtaining a pointer to the concrete instance through G 4 VVis. Manager : : Get. Concrete. Instance (it also ensures a valid view is available) Visualisation & (G)UI - Geant 4 Course 25

4. 3 Draw methods of G 4 VVis. Manager (2) n The Draw methods

4. 3 Draw methods of G 4 VVis. Manager (2) n The Draw methods are available for: n n n G 4 Circle G 4 NURBS G 4 Polyhedron G 4 Polyline G 4 Polymarker G 4 Scale G 4 Square G 4 Text G 4 Logical. Volume G 4 Physical. Volume G 4 Solid Also G 4 VHit and G 4 VTrajectory for convenience, but use commands, such as /vis/scene/add/trajectories. Visualisation & (G)UI - Geant 4 Course 26

A typical Draw. Hit method void Ex. N 02 Tracker. Hit: : Draw() {

A typical Draw. Hit method void Ex. N 02 Tracker. Hit: : Draw() { G 4 VVis. Manager* p. VVis. Manager = G 4 VVis. Manager: : Get. Concrete. Instance(); if(p. VVis. Manager) { G 4 Circle circle(pos); circle. Set. Screen. Size(2. ); circle. Set. Fill. Style(G 4 Circle: : filled); G 4 Colour colour(1. , 0. ); G 4 Vis. Attributes attribs(colour); circle. Set. Vis. Attributes(attribs); p. VVis. Manager->Draw(circle); } } Visualisation & (G)UI - Geant 4 Course 27

5. Visualisation Drivers n n Visualisation drivers are interfaces to 3 D graphics software

5. Visualisation Drivers n n Visualisation drivers are interfaces to 3 D graphics software You can select your favorite one(s) depending on your purposes such as n n n Seeing detector and events Preparing precise figures for journal papers Publication of results on Web Debugging geometry Demonstration Etc Visualisation & (G)UI - Geant 4 Course 28

5. 1 Available Graphics Software n Geant 4 provides visualisation drivers: DAWN : Technical

5. 1 Available Graphics Software n Geant 4 provides visualisation drivers: DAWN : Technical High-quality Post. Script output n Open. GL: Quick and flexible visualisation n Open. Inventor: Interactivity, virtual reality, etc n Ray. Tracer : Photo-realistic rendering n VRML: Interactivity, 3 D graphics on Web n Hep. Rep: connection to variety of viewers n Visualisation & (G)UI - Geant 4 Course 29

5. 2 Available Visualisation Drivers n n n n DAWN(FILE) Fukui Renderer DAWN OPENGLX(m)

5. 2 Available Visualisation Drivers n n n n DAWN(FILE) Fukui Renderer DAWN OPENGLX(m) Open. GL with Xlib (Xm) Hep. Rep viewers OIX Open. Inventor with Xlib Ray. Tracer JPEG files VRML 1. 0/2. 0 A/GAGTree geometry hierarchy Etc (see “help /vis/open”) Visualisation & (G)UI - Geant 4 Course 30

5. 3 How to Use Visualisation Drivers n Users can install visualisation driver(s) by

5. 3 How to Use Visualisation Drivers n Users can install visualisation driver(s) by setting G 4 VIS_BUILD… environment variables before building Geant 4 libraries (use Configure) Similarly, G 4 VIS_USE… environment variables before compiling user code. For example, Configure produces: n setenv G 4 VIS_USE_DAWN 1 n setenv G 4 VIS_USE_OPENGLX 1 n setenv G 4 VIS_USE_VRML 1 Note: force a rebuild/recompile if you change environment n n n Visualisation & (G)UI - Geant 4 Course 31

6. main() Function (1) n n Instantiate a visualisation manager, e. g. , G

6. main() Function (1) n n Instantiate a visualisation manager, e. g. , G 4 Vis. Executive (but you may write your own). Near the start of your program, e. g. , in main(): n n Include the header file of the chosen visualisation manager Instantiate and initialise the visualisation manager. The Initialise() method instantiates the chosen visualisation driver “factories” Delete the visualisation manager at the end You can use the C macro “G 4 VIS_USE”, which is automatically set if you incorporate a visualisation driver in compilation Visualisation & (G)UI - Geant 4 Course 32

6. main() Function (2) n From a typical main() function : // Include the

6. main() Function (2) n From a typical main() function : // Include the header file of your vis manager #ifdef G 4 VIS_USE #include “G 4 Vis. Executive. hh” #endif … // Instantiate and initialize the vis manager #ifdef G 4 VIS_USE G 4 Vis. Manager* vis. Manager = new G 4 Vis. Executive; vis. Manager->Initialize(); #endif … // Delete the visualisation manager #ifdef G 4 VIS_USE delete vis. Manager; #endif Visualisation & (G)UI - Geant 4 Course 33

7. Visualisation commands n n Here, we introduce some frequently-used built-in visualisation commands See

7. Visualisation commands n n Here, we introduce some frequently-used built-in visualisation commands See command web page http: //geant 4. web. cern. ch/geant 4/G 4 Users. Documents/Users. Guides/For. Appli cation. Developer/html/Control/commands. html n For simplicity, we assume that the Geant 4 executable is compiled, incorporating DAWN, OPENGLX, and VRMLFILE drivers n setenv G 4 VIS_USE_DAWN 1 n setenv G 4 VIS_USE_OPENGLX 1 n setenv G 4 VIS_USE_VRMLFILE 1 Visualisation & (G)UI - Geant 4 Course 34

7. 1 Scene, Scene Hander, Viewer n n n n In order to use

7. 1 Scene, Scene Hander, Viewer n n n n In order to use visualisation commands, you need to understand the concepts of “scene”, “scene handler”, and “viewer”. Scene: A set of visualisable 3 D objects Scene handler: Interprets the scene for a particular graphics system Viewer: Image generator Each scene handler is assigned to a scene Each viewer is assigned to a scene handler “visualisation driver” = “scene handler” + “viewer” Visualisation & (G)UI - Geant 4 Course 35

7. 1(2) Scene Objects • Physical volume, which is assumed to include descendants to

7. 1(2) Scene Objects • Physical volume, which is assumed to include descendants to unlimited or specified depth • Logical volume, showing daughters, Boolean components, voxels and readout geometry • Ghost volume • Trajectories, drawn at end of event • Hits, drawn at end of event • Axes • Logo • Scale • Text • User action Visualisation & (G)UI - Geant 4 Course 36

7. 1(3) Standard View The scene computes its “bounding sphere” n The viewer computes

7. 1(3) Standard View The scene computes its “bounding sphere” n The viewer computes the “standard view” that shows the whole scene n Pan, dolly and zoom from there n /vis/viewer/reset restores the standard view n Visualisation & (G)UI - Geant 4 Course 37

7. 1(4) Culling Policy n There exists a primitive culling (elimination) mechanism n /vis/viewer/set/culling

7. 1(4) Culling Policy n There exists a primitive culling (elimination) mechanism n /vis/viewer/set/culling n n n global (T), enables all other culling options invisible (T) covered daughters (F) density (F) (lower than given density) Defaults in brackets (T = true, F = false) Visualisation & (G)UI - Geant 4 Course 38

7. 2 Steps of Visualisation Step n 1: 2: 3: 4: Create a scene

7. 2 Steps of Visualisation Step n 1: 2: 3: 4: Create a scene handler and a viewer Create an empty scene Add objects to the created scene Attach the current scene handler to the current scene n Step 5: Set camera parameters, drawing style (wireframe/surface), etc n Step 6: “Execute” the visualisation n Step 7: Declare the end of visualisation Visualisation & (G)UI - Geant 4 Course 39

7. 3 An Example of Visualising Detector # Invoke the OGLIX driver: # Create

7. 3 An Example of Visualising Detector # Invoke the OGLIX driver: # Create a scene handler and a viewer. /vis/open OGLIX # Set camera and drawing style /vis/viewer/reset /vis/viewer/viewpoint. Theta. Phi 70 20 /vis/viewer/set/style wireframe # # Visualize of the whole detector geometry The “/vis/draw. Volume” creates a scene, adds the world volume to it, and makes viewer render visualisation. /vis/draw. Volume # Declare the end of visualisation /vis/viewer/update Visualisation & (G)UI - Geant 4 Course 40

7. 4 An Example of Visualizing Events # Store particle trajactories for visualisation /tracking/store.

7. 4 An Example of Visualizing Events # Store particle trajactories for visualisation /tracking/store. Trajectory # Invoke the DAWN driver: Create a scene # handler and a viewer. /vis/open DAWN # Camera setting, and drawing style selection, # if necessary … # Create a new empty scene /vis/scene/create # Add the world volume and trajectories to the # current scene /vis/scene/add/volume /vis/scene/add/trajectories # Let the viewer visualise the scene, and declare # the end of visualisation /run/beam. On 10 Visualisation & (G)UI - Geant 4 Course 41

7. 5 /vis/open Command n Idle> /vis/open <driver_tag_name> n The “driver_tag_name” is a name

7. 5 /vis/open Command n Idle> /vis/open <driver_tag_name> n The “driver_tag_name” is a name which shows “driver name” + “mode” Action: Create a visualisation driver n In other words, create a scene hander and a viewer Example: Creating the OPENGLX driver in the immediate mode: n Idle> /vis/open OGLIX How to list available driver_tag_name n Idle> help /vis/open or Idle> help /vis/scene. Handler/create Visualisation & (G)UI - Geant 4 Course 42

7. 6 /vis/viewer/… commands n Commands n Viewpoint setting: Idle> /vis/viewer/viewpoint. Theta. Phi <theta_deg>

7. 6 /vis/viewer/… commands n Commands n Viewpoint setting: Idle> /vis/viewer/viewpoint. Theta. Phi <theta_deg> <phi_deg> n Zooming Idle> /vis/viewer/zoom <scale_factor> n Initialization of camera parameters: Idle> /vis/viewer/reset Visualisation & (G)UI - Geant 4 Course 43

7. 7 /vis/viewer/set/… commands n /vis/viewer/set/style <style_name> n n The “style_name” can be “wireframe”

7. 7 /vis/viewer/set/… commands n /vis/viewer/set/style <style_name> n n The “style_name” can be “wireframe” or “surface” /vis/viewer/set/all <viewer-name> n The viewer name is the short name, e. g. , viewer-0. (Use /vis/viewer/list to see. ) n n This copies all the view parameters from named viewer to current viewer. E. g: Find a good view with Open. GL, render to high quality with DAWN. Visualisation & (G)UI - Geant 4 Course 44

7. 8 /vis/draw. Volume /vis/viewer/update n and Commands: n Idle> /vis/draw. Volume <physical-volume-name> (Default:

7. 8 /vis/draw. Volume /vis/viewer/update n and Commands: n Idle> /vis/draw. Volume <physical-volume-name> (Default: world) Idle> /vis/viewer/update Note that /vis/viewer/update should be executed to declare end of visualisation. You can add visualisation commands of, say, coordinate axes between the two commands. For example, n n Idle> /vis/draw. Volume Idle> /vis/scene/add/axes <Ox> <Oy> <Oz> <length> <unit> Idle> /vis/viewer/update Visualisation & (G)UI - Geant 4 Course 45

7. 9 Commands to Visualize Events n Commands n n Idle> /tracking/store. Trajectory 1

7. 9 Commands to Visualize Events n Commands n n Idle> /tracking/store. Trajectory 1 Idle> /vis/scene/add/trajectories Idle> /run/beam. On <number_of_events> Action: n Automatic visualisation of events Visualisation & (G)UI - Geant 4 Course 46

Sample Visualisation (1) Slide 2 Visualisation & (G)UI - Geant 4 Course 47

Sample Visualisation (1) Slide 2 Visualisation & (G)UI - Geant 4 Course 47

From Introduction to Geant 4 Visualization by Joseph Perl, SLAC Hep. Rep/WIRED DAWN Open.

From Introduction to Geant 4 Visualization by Joseph Perl, SLAC Hep. Rep/WIRED DAWN Open. GL Visualisation & (G)UI Geant 4 Course

From Introduction to Geant 4 Visualization by Joseph Perl, SLAC Open. Inventor DAWN Hep.

From Introduction to Geant 4 Visualization by Joseph Perl, SLAC Open. Inventor DAWN Hep. Rep/FRED Visualisation & (G)UI Geant 4 Course

Visualisation & (G)UI - Geant 4 Course 50

Visualisation & (G)UI - Geant 4 Course 50

Visualisation & (G)UI - Geant 4 Course 51

Visualisation & (G)UI - Geant 4 Course 51

Visualisation & (G)UI - Geant 4 Course 52

Visualisation & (G)UI - Geant 4 Course 52

Visualisation & (G)UI - Geant 4 Course 53

Visualisation & (G)UI - Geant 4 Course 53

8. Visualisation from C++ codes n n It is also possible to perform visualisation

8. Visualisation from C++ codes n n It is also possible to perform visualisation from the C++ code You can describe the visualisation commands in C++ codes via the Apply. Command() method of the UI manager, as for any other command: n n p. UI->Apply. Command(“/vis/…”); Or you can use Draw() methods of visualizable classes Visualisation & (G)UI - Geant 4 Course 54

9. Exercises n Read and execute sample visualisation macros for examples/novice/N 03 The macro

9. Exercises n Read and execute sample visualisation macros for examples/novice/N 03 The macro files are “ex. N 03 Vis. X. mac”, where X=0, 1, 2, … n Explanation of macros is all described in the macro files as comment lines n Visualisation & (G)UI - Geant 4 Course 55

10. Information n Geant 4 User Guide (and source codes) n On-line documentation on

10. Information n Geant 4 User Guide (and source codes) n On-line documentation on Geant 4 visualisation n n For commands n n http: //cern. ch/geant 4/G 4 Users. Documents/Users. Guides/ For. Application. Developer/html/Visualization http: //geant 4. web. cern. ch/geant 4/G 4 Users. Documents/ Users. Guides/For. Application. Developer/html/Control/com mands. html SLAC tutorial n http: //geant 4. slac. stanford. edu/SLACTutorial 04/ Visualisation & (G)UI - Geant 4 Course 56

PART 2 Geant 4 GUI Visualisation & (G)UI Geant 4 Course

PART 2 Geant 4 GUI Visualisation & (G)UI Geant 4 Course

1. Select (G)UI (1) n In the main(), according to the computer environments, construct

1. Select (G)UI (1) n In the main(), according to the computer environments, construct a G 4 UIsession concrete class provided by Geant 4 and invoke its session. Start() method. n Example: n G 4 UIsession* session=0; if (argc==1) // Define UI session for interactive mode. { // G 4 UIterminal is a (dumb) terminal session = new G 4 UIterminal; } Visualisation & (G)UI - Geant 4 Course 58

1. Select (G)UI (2) n Geant 4 provides the following interfaces for various (G)UI:

1. Select (G)UI (2) n Geant 4 provides the following interfaces for various (G)UI: n n n G 4 UIterminal: C-shell like character terminal G 4 UItcsh: tcsh-like character terminal with command completion, history, etc G 4 UIGAG: Java based GUI G 4 UIXm: Motif-based GUI, command completion, etc Note for G 4 UItcsh: n Use G 4 UIterminal with argument G 4 UItcsh* : session = new G 4 UIterminal (new G 4 UItcsh); Visualisation & (G)UI - Geant 4 Course 59

2. Environmental Variables n Users should use Configure to select and plug in (G)UI

2. Environmental Variables n Users should use Configure to select and plug in (G)UI (or by setting environmental variables) • setenv G 4 UI_USE_GUINAME n Example: • setenv G 4 UI_USE_TERMINAL • setenv G 4 UI_USE_GAG • setenv G 4 UI_USE_XM n 1 1 1 Note that Geant 4 library should be installed with setting the corresponding G 4 UI_BUILD_GUINAME_SESSION Visualisation & (G)UI - Geant 4 Course 60

3. Useful GUI Tools Released by Geant 4 Developers n GGE: Geometry editor based

3. Useful GUI Tools Released by Geant 4 Developers n GGE: Geometry editor based on Java GUI n n GPE: Physics editor based on Java GUI n n http: //erpc 1. naruto-u. ac. jp/~geant 4 Open. Scientist: Interactive environment n http: //www. lal. in 2 p 3. fr/Open. Scientist Visualisation & (G)UI - Geant 4 Course 61

PART 3 Geant 4 DAVID & DTREE Visualisation & (G)UI Geant 4 Course

PART 3 Geant 4 DAVID & DTREE Visualisation & (G)UI Geant 4 Course

1. Volume-Overlapping Detection with DAVID (1) n DAVID (DAWN-based Visual Volume Intersection Debugger) n

1. Volume-Overlapping Detection with DAVID (1) n DAVID (DAWN-based Visual Volume Intersection Debugger) n n n Automatically detects and highlights overlapping volumes • Precise visualization with DAWN • Interactive visualisation with VRML DAVID also generates log files describing detailed information on the detected overlaps Info & source: • http: //geant 4. kek. jp/~tanaka Visualisation & (G)UI - Geant 4 Course 63

1. Volume-Overlapping Detection with DAVID (2) n Usage of DAVID n Switch the viewer

1. Volume-Overlapping Detection with DAVID (2) n Usage of DAVID n Switch the viewer of the DAWNFILE driver from renderer DAWN (default) to DAVID. • setenv G 4 DAWNFILE_VIEWER david n Then visualize volumes as usual with the DAWNFILE driver Overlapping volumes (if any) are visualized • The view is stored in files g 4 david. prim (DAWN format) and g 4 david. eps (Post. Script format) • Log file: g 4 david. log n Visualisation & (G)UI - Geant 4 Course 64

1. Volume-Overlapping Detection with DAVID (3) n Sample visualisation with overlapping volumes highlighted Visualisation

1. Volume-Overlapping Detection with DAVID (3) n Sample visualisation with overlapping volumes highlighted Visualisation & (G)UI - Geant 4 Course 65

1. Volume-Overlapping Detection with DAVID (4) n n Log file format n Phys. Vol.

1. Volume-Overlapping Detection with DAVID (4) n n Log file format n Phys. Vol. Name. Copy. No Shape line_num n The “line_num” is the line number of the overlapping volume in the DAWN-fomat file “g 4. prim file” generated by Geant 4 Sample log file : . . . !!! INTERSECTED VOLUMES !!! calo. Phys. 0: Tubs: line 17 calo. Phys. 1: Tubs: line 25. . . Visualisation & (G)UI - Geant 4 Course 66

1. Volume-Overlapping Dection with DAVID (5) n If no overlaps are detected, DAVID displays

1. Volume-Overlapping Dection with DAVID (5) n If no overlaps are detected, DAVID displays the following message: --------------------------!!! Number of intersected volumes : 0 !!! Congratulations ! (^o^)/ !!! --------------------------Visualisation & (G)UI - Geant 4 Course 67

2. Visualising the Detector Geometry Tree (DTREE) (1) n Selection of outputs: n n

2. Visualising the Detector Geometry Tree (DTREE) (1) n Selection of outputs: n n How to display a tree: n n ASCII-text format GAG-window XML file Idle> /vis/draw. Tree ! XXXTree (XXXTree = ATree, GAGTree, XMLTree, etc) (Default is Atree) Detail level is controlled with the “verbose” command: n /vis/XXXTree/verbose n Visualisation & (G)UI - Geant 4 Course 68

2. DTREE: Visualising Detector Geometry Tree (3 -1) n ASCII Tree (ATree) : verbose

2. DTREE: Visualising Detector Geometry Tree (3 -1) n ASCII Tree (ATree) : verbose level 0 (default) Format: PV_name + copy_number World "Calorimeter", copy no. 0 "Layer", copy no. -1 (10 replicas) "Absorber", copy no. 0 "Gap", copy no. 0 Visualisation & (G)UI - Geant 4 Course 69

2. DTREE: Visualising Detector Geometry Tree (3 -2) n ASCII Tree (ATree) n n

2. DTREE: Visualising Detector Geometry Tree (3 -2) n ASCII Tree (ATree) n n For other outputs, see guidance (help /vis/ASCIITree/verbose) or header of output Possibilities — with or without repetition • • Physical volume and corresponding logical volume & solid Volume Mass of tree to specified depth Mass of all descendants "the. Pit": 0 / "the. Pit" / "a. Box"(G 4 Box), 8000 m 3 , 0. 1 mg/cm 3 "the. Mother 1": 0 / "a. Test 1" / "a. Box"(G 4 Box), 1000 m 3 , 0. 1 mg/cm 3 Calculating mass(es). . . Overall volume of "the. Pit": 0, is 8000 m 3 Mass of tree, ignoring daughters at depth 1 and below, is 800 kg Visualisation & (G)UI - Geant 4 Course 70

2. DTREE: Visualising Detector Geometry Tree (4) n GAG Tree Visualisation & (G)UI -

2. DTREE: Visualising Detector Geometry Tree (4) n GAG Tree Visualisation & (G)UI - Geant 4 Course 71

2. DTREE: Visualising Detector Geometry Tree (5 -1) n XML Tree Visualisation & (G)UI

2. DTREE: Visualising Detector Geometry Tree (5 -1) n XML Tree Visualisation & (G)UI - Geant 4 Course 72

2. DTREE: Visualising Detector Geometry Tree (5 -2) n XML Tree (find) Visualisation &

2. DTREE: Visualising Detector Geometry Tree (5 -2) n XML Tree (find) Visualisation & (G)UI - Geant 4 Course 73

PART 4 Geant 4 AIDA & analysis Visualisation & (G)UI Geant 4 Course

PART 4 Geant 4 AIDA & analysis Visualisation & (G)UI Geant 4 Course

1. Interface to AIDA Through abstract interfaces AIDA No dependence Minimize coupling of components

1. Interface to AIDA Through abstract interfaces AIDA No dependence Minimize coupling of components AIDA & Analysis Tools PI Java Analysis Studio Visualisation & (G)UI - Geant 4 Course 75

2. Interfacing to Geant 4 n AIDA (Abstract Interfaces for Data Analysis) can be

2. Interfacing to Geant 4 n AIDA (Abstract Interfaces for Data Analysis) can be used in Geant 4 by selecting the environmental variable G 4 ANALYSIS_USE n n n Requires AIDA headers installed in the system Requires an AIDA compliant tool for analysis Tools for analysis compliant with AIDA interfaces currently are: n n n PI (Physicist Interfaces for AIDA Analysis) JAS (Java Analysis Studio) Open Scientist Lab & (G)UI - Geant 4 Course Visualisation 76

3. References … n AIDA n n PI n n http: //cern. ch/PI/ JAS

3. References … n AIDA n n PI n n http: //cern. ch/PI/ JAS (Java Analysis Studio) n n http: //aida. freehep. org http: //jas. freehep. org Open Scientist Lab n http: //www. lal. in 2 p 3. fr/Open. Scientist Visualisation & (G)UI - Geant 4 Course 77