12 May 2007 Geant4 Advanced Visualization J. Perl 1 DAWN OpenGL How to Control the Drawing Style and Filtering of Detector Geometry and Trajectories Geant4.

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

Working with Profiles in IX1D v 3 – A Tutorial © 2006 Interpex Limited All rights reserved Version 1.0.
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
July 2010 D2.1 Upgrading strategy Javier Soto Catalog Release 3. Communities.
11 January 2011 Geant4 Visualization Commands J. Perl 1 DAWN OpenGL Geant4 Visualization Commands Basic Visualization Commands Makoto Asai (SLAC) slides.
Advanced Microsoft Word Hosted by Jared Hoffman Topics Keyboard Shortcuts Customizing Toolbars and Menus Auto Format & Auto Correct Tabs Inserting Pictures.
Introduction to Geant4 Visualization
Road Map Introduction to object oriented programming. Classes
12 Dec 2006 J. Perl Recent Developments in Geant4 Vis 1 HepRep/WIRED DAWN OpenGL Recent Developments in Geant4 Visualization Geant4 Lecture Course Tsukuba,
Automating Tasks With Macros
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
April 2007 J. Perl Geant4 Review 2007: Visualization 1 HepRep/HepRApp DAWN OpenGL Geant4 Review 2007: Visualization Geant4 Review April at CERN.
12 January 2011 Geant4 Advanced Visualization J. Perl 1 DAWN OpenGL How to Control the Drawing Style and Filtering of Detector Geometry and Trajectories,
15 Sept 2007 J. Perl Overview of Geant4 Visualization 1 HepRep/HepRApp DAWN OpenGL Overview of Geant4 Visualization Geant4 Mini-Tutorial Hebden Bridge.
Interfaces. In this class, we will cover: What an interface is Why you would use an interface Creating an interface Using an interface Cloning an object.
14 User Documents and Examples I SLAC Geant4 Tutorial 3 November 2009 Dennis Wright Geant4 V9.2.p02.
12 May 2007 J. Perl Future Plans for Geant4 Visualization 1 HepRep/HepRApp DAWN OpenGL Future Plans for Geant4 Visualization What’s Planned for the Next.
18th September 2007New Features in G4 Visualisation Hebden Bridge 1 Visualisation New or improved features 2007 Smooth trajectories Event keeping Picking.
Geant4 Visualization Review
11 May 2007 J. Perl How to Make a Movie 1 Geant4 Visualization Special Topic: How to Make a Movie Joseph Perl SLAC.
Highlights of latest developments ESA/ESTEC Makoto Asai (SLAC)
12 May 2007 Geant4 Visualization Commands J. Perl 1 DAWN OpenGL Geant4 Visualization Commands Basic Visualization Commands Joseph Perl, SLAC HepRep/HepRApp.
4 November 2009 Geant4 Advanced Visualization J. Perl 1 DAWN OpenGL How to Control the Drawing Style and Filtering of Detector Geometry and Trajectories.
Abstraction: Polymorphism, pt. 1 Abstracting Objects.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Creating a MagicInfo Pro Screen Template
EnSight analyze, visualize, communicate EnSight 6.x Advanced Training Part 1 Instructors: Mike Krogh, Anders Grimsrud.
- Circle markers produced by TAsimage: They do not match was is produced on screen. The line width is too thick. Some other markers need to be tune a bit.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Visualisation and (G)UI Authors: Hajime Yoshida and Satoshi Tanaka.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
User Documents and Examples I Sébastien Incerti Slides thanks to Dennis Wrigth, SLAC.
Installing and Using Active Directory Written by Marc Zacharko.
Chapter 8 iComponents and Parameters. After completing this chapter, you will be able to perform the following: –Create iMates –Change the display of.
Interface parallel session report Hajime Yoshida.
Physics I: Physics Lists Geant4 Tutorial at Jefferson Lab 10 July 2012 Dennis Wright (SLAC) Geant4 9.6 beta.
S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January Brachytherapy exercise.
Maria Grazia Pia Detector Response Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
Geant4 Visualization 1 OpenGL DAWN VRML. Visualization Visualization Seeing what one does usually helps One can visualize geometry, hits, trajectories.
Views Revit® Architecture CHAPTER OBJECTIVES Understand and use Floor Plan and Reflected Ceiling Plan (RFC) views. Learn how to create Elevation.
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
7 June 2005 Visualization & GGE Demo J. Perl 1 HepRep/WIRED DAWN OpenGL Geant4 Visualization & GGE Demo Joseph Perl, SLAC.
12 October 2006 G4Vis: Status, New Features and Issues 1 HepRep/WIRED DAWN OpenGL G4Vis: Status, New Features and Issues Geant4 Collaboration Workshop.
Maria Grazia Pia INFN Genova Salamanca, July 2002
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Visualization of Geant4 Data: Exploiting Component Architecture through AIDA, HepRep, JAS and WIRED Geant4 Workshop, CERN - 2 October 2002 Joseph Perl.
May 20, 2005Wah-kai Ngai1 Basic Visualization Tutorial Using Geant4.
Parallel Session Report of P2 on October 1, 2002 Interactivity & External Frameworks: Picking Satoshi Tanaka Ritsumeikan University (Rits)
EDT Chapter 41 Using Layers Chapter 4 Sacramento City College EDT 310.
Geant4 examples Sébastien Incerti On behalf of the Geant4 collaboration with special thanks to Luciano Pandola, INFN.
Makoto Asai (SLAC) Getting Started MGP: added class diagram of basic user application.
© 2010 Delmar, Cengage Learning Chapter 11 Creating and Using Templates.
Visualisation, (G)UI and Analysis The full set of lecture notes of this Geant4 Course is available at
June 4-8, G4 Paris Visualization II P. Gueye/J. Perl 1 DAWN OpenGL Geant4 Visualization Commands Basic Visualization Commands Paul Guèye, HU Courtesy:
© Execview Ltd 2015: all rights reserved Execview Scorecard Training/Reference Guide 2013 Key functions guide for Scorecard administrators.
Trajectory and Hit Visualisation Jane Tinslay, SLAC October 2006.
CCS Engineering Tools The tools are used help development and debugging of VLT SW control applications This presentation will provide a general view of.
Visualisation and (G)UI
Basics of a user application
Geant4 Visualization Commands
Geant4 Advanced Visualization
Physics I: Physics Lists
Geant4 Workshop, CERN - 1 October 2002 Joseph Perl
Visualization Status/Development
Presentation transcript:

12 May 2007 Geant4 Advanced Visualization J. Perl 1 DAWN OpenGL How to Control the Drawing Style and Filtering of Detector Geometry and Trajectories Geant4 Advanced Visualization Joseph Perl, SLAC HepRep/HepRApp

12 May Geant4 Advanced Visualization J. PerlContents Visualization Attributes Visualization Attributes Trajectory Modeling Trajectory Modeling Advanced Trajectory Modeling Advanced Trajectory Modeling Trajectory and Hit Filtering Trajectory and Hit Filtering Smooth and Rich Trajectories Smooth and Rich Trajectories

12 May Geant4 Advanced Visualization J. Perl How this Document Fits with Other Tutorial Materials This presentation can be used on its own, but gives the most comprehensive introduction to Geant4 visualization when used as part of the following full set of documents: This presentation can be used on its own, but gives the most comprehensive introduction to Geant4 visualization when used as part of the following full set of documents: Introduction to Geant4 Visualization Introduction to Geant4 Visualization Introduction to Geant4 Visualization Introduction to Geant4 Visualization Geant4 Installation Guides Geant4 Installation Guides Geant4 Installation Guides Geant4 Installation Guides Geant4 Visualization Tutorial using the HepRApp HepRep Browser Geant4 Visualization Tutorial using the HepRApp HepRep Browser Geant4 Visualization Tutorial using the HepRApp HepRep Browser Geant4 Visualization Tutorial using the HepRApp HepRep Browser Geant4 Visualization Tutorial using the DAWN Event Display Geant4 Visualization Tutorial using the DAWN Event Display Geant4 Visualization Tutorial using the DAWN Event Display Geant4 Visualization Tutorial using the DAWN Event Display Geant4 Visualization Tutorial using the OpenGL Event Display Geant4 Visualization Tutorial using the OpenGL Event Display Geant4 Visualization Tutorial using the OpenGL Event Display Geant4 Visualization Tutorial using the OpenGL Event Display Geant4 Visualization Commands Geant4 Visualization Commands Geant4 Visualization Commands Geant4 Visualization Commands Geant4 Advanced Visualization Geant4 Advanced Visualization Geant4 Advanced Visualization Geant4 Advanced Visualization See the URLS at the end of this presentation See the URLS at the end of this presentation This presentation discusses seven visualization drivers: This presentation discusses seven visualization drivers: OpenGL OpenGL OpenInventor OpenInventor HepRep HepRep DAWN DAWN VRML VRML RayTracer RayTracer ASCIITree ASCIITree

12 May Geant4 Advanced Visualization J. Perl Visualization Attributes

12 May Geant4 Advanced Visualization J. Perl Two Kinds of Visualization Attributes G4VisAttributes - carry standard drawing information: G4VisAttributes - carry standard drawing information: Color Color Visible/Invisible Visible/Invisible Wireframe/Solid Wireframe/Solid etc. etc. HepRep-Style Attributes - carry arbitrary, user-defined information: HepRep-Style Attributes - carry arbitrary, user-defined information: for trajectories: for trajectories: momentum momentum particle type particle type etc. etc. for hits: for hits: energy energy electronics channel number electronics channel number etc. etc. for geometry volumes: for geometry volumes: logical volume name logical volume name material material etc. etc.

12 May Geant4 Advanced Visualization J. Perl G4VisAttributes G4VisAttributes - carry standard drawing information: G4VisAttributes - carry standard drawing information: Color Color Visible/Invisible Visible/Invisible Wireframe/Solid Wireframe/Solid etc. etc. Up until a few years ago, these were the only kind of Visualization Attributes in Geant4 Up until a few years ago, these were the only kind of Visualization Attributes in Geant4

12 May Geant4 Advanced Visualization J. Perl LineStyle: WireFrame or Solid WireFrame Solid

12 May Geant4 Advanced Visualization J. Perl Setting Vis Attributes from C++ Create a G4VisAttributes object and assign it to a volume: Create a G4VisAttributes object and assign it to a volume: experimentalHall_logical -> SetVisAttributes (G4VisAttributes::Invisible) experimentalHall_logical -> SetVisAttributes (G4VisAttributes::Invisible)

12 May Geant4 Advanced Visualization J. Perl Setting Vis Attributes from Commands From the command prompt: /vis/viewer/set/style wireframe Watch out for fact that interactive commands do not override C++ commands that have the “force” prefix, such as: experimentalHallVisAtt->SetForceWireframe(true)

12 May Geant4 Advanced Visualization J. Perl HepRep-Style Attributes HepRep-Style Attributes - carry arbitrary, user-defined information: HepRep-Style Attributes - carry arbitrary, user-defined information: for trajectories: for trajectories: momentum momentum particle type particle type etc. etc. for hits: for hits: energy energy electronics channel number electronics channel number etc. etc. for geometry volumes: for geometry volumes: logical volume name logical volume name material material etc. etc. These attributes were added to Geant4 over the last few years to support advanced features in the HepRep browsers (HepRApp, Wired4 and FRED). These attributes were added to Geant4 over the last few years to support advanced features in the HepRep browsers (HepRApp, Wired4 and FRED). display the HepRep attributes when you click on the relevant graphics object. display the HepRep attributes when you click on the relevant graphics object. perform cuts on these values perform cuts on these values label objects by these values label objects by these values

12 May Geant4 Advanced Visualization J. Perl 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.

12 May 2007 Geant4 Advanced Visualization J. Perl 12 HepRApp: Labeling by Any Attribute

12 May 2007 Geant4 Advanced Visualization J. Perl 13 HepRApp: Cut by Any Attribute

12 May Geant4 Advanced Visualization J. Perl HepRep Attributes beyond the HepRep Browsers Other visualization drivers can also use the HepRep-style attributes: Open Inventor will show the attributes when you click on the relevant object. OpenGL will have this ability soon. Advanced visualization features described later in this presentation also use HepRep attributes and work for all Geant4 visualization drivers: Trajectory Modeling Trajectory and Hit Filtering

12 May Geant4 Advanced Visualization J. Perl Defining Your Own HepRep Attributes While a useful set of attributes is already defined by default in the standard Geant4 trajectory, you are also free to define your own attributes: While a useful set of attributes is already defined by default in the standard Geant4 trajectory, you are also free to define your own attributes: std::map * store = G4AttDefStore::GetInstance("G4Trajectory",isNew); std::map * store = G4AttDefStore::GetInstance("G4Trajectory",isNew); G4String PN("PN"); G4String PN("PN"); (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String"); (*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String"); G4String IMom("IMom"); G4String IMom("IMom"); (*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory", "Physics","","G4ThreeVector"); (*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory", "Physics","","G4ThreeVector"); Then fill the attributes with lines such as: Then fill the attributes with lines such as: std::vector * values = new std::vector ; std::vector * values = new std::vector ; values->push_back(G4AttValue("PN",ParticleName,"")); values->push_back(G4AttValue("PN",ParticleName,"")); s.seekp(std::ios::beg); s.seekp(std::ios::beg); s << G4BestUnit(initialMomentum,"Energy") << std::ends; s << G4BestUnit(initialMomentum,"Energy") << std::ends; values->push_back(G4AttValue("IMom",c,"")); values->push_back(G4AttValue("IMom",c,"")); See geant4/source/tracking/src/G4Trajectory.cc for a good example. See geant4/source/tracking/src/G4Trajectory.cc for a good example.

12 May Geant4 Advanced Visualization J. Perl Trajectory Modeling

12 May Geant4 Advanced Visualization J. Perl Enhanced Trajectory Drawing Ability to change trajectory drawing model through interactive commands Ability to change trajectory drawing model through interactive commands Lets you, for example, Lets you, for example, declare that trajectories should be color-coded by charge, declare that trajectories should be color-coded by charge, then change to have them color-coded by particle type then change to have them color-coded by particle type Eliminates the most common reason users had to code their own trajectory classes Eliminates the most common reason users had to code their own trajectory classes Project Lead: Jane Tinslay Project Lead: Jane Tinslay

12 May Geant4 Advanced Visualization J. Perl Creator Process — muIoni — Decay — annihil — eIoni — brem Momentum (MeV) — 0-1 — 1-10 — — — — 50+ Charge — +1 — 0 — -1 Example A01, five events, drawBy various models

12 May Geant4 Advanced Visualization J. Perl Models Supplied with Geant4 Four models are supplied since release Geant4 v8.1 Four models are supplied since release Geant4 v8.1  More are being developed for future releases drawByCharge drawByCharge  Default model  Colors trajectories according to charge drawByParticleID drawByParticleID  Colors trajectories according to particle type  All trajectories are colored grey by default  Configure to highlight chosen particle types with chosen colors  No limit on the number of particle types that can be highlighted drawByOriginVolume drawByOriginVolume  Colors trajectories according to volume in which they originated  for example, to highlight all particles that backscattered from a particular collimator generic generic  Draws all trajectories the same control over more than just color, including: control over more than just color, including:  Whether to show trajectory as line, step points or both  width of trajectory lines, type of marker to use for points, point size, etc. +1BlueRed 0Green

12 May Geant4 Advanced Visualization J. Perl Model Configuration You can create and configure multiple models through either You can create and configure multiple models through either  Interactive commands  Compiled code Interactive commands Interactive commands Located in /vis/modeling/trajectories directory Located in /vis/modeling/trajectories directory Possible to have multiple instances of given model type Possible to have multiple instances of given model type e.g., toggle between two different ways of coloring by charge e.g., toggle between two different ways of coloring by charge List and select instantiated models with commands: List and select instantiated models with commands:  /vis/modeling/trajectories/list  /vis/modeling/trajectories/select  /vis/modeling/trajectories/select Note that detailed help for a given model is not shown in the help system until you have created an instance of that model Note that detailed help for a given model is not shown in the help system until you have created an instance of that model e.g., only after you do your first: e.g., only after you do your first: /vis/modeling/trajectories/create/drawByCharge /vis/modeling/trajectories/create/drawByCharge will the help system will include details on drawByCharge will the help system will include details on drawByCharge

12 May Geant4 Advanced Visualization J. Perl Trajectory Modeling Examples Example macro #Standard setup /vis/scene/create /vis/open OGLIX /vis/scene/add/volume /vis/scene/add/trajectories /vis/scene/add/hits /vis/viewer/set/lightsThetaPhi /vis/viewer/set/viewpointThetaPhi /vis/viewer/set/style surface /vis/viewer/set/hiddenEdge true #Create drawByParticleID model, highlighting photons /vis/modeling/trajectories/create/drawByParticleID /vis/modeling/trajectories/drawByParticleID-0/set gamma red /run/beamOn 1 … #Create drawByCharge model, coloring neutrals white /vis/modeling/trajectories/create/drawByCharge /vis/modeling/trajectories/drawByCharge-0/set 1 blue /vis/modeling/trajectories/drawByCharge-0/set -1 red /vis/modeling/trajectories/drawByCharge-0/set 0 white /run/beamOn 1a

12 May Geant4 Advanced Visualization J. Perl More Sample Commands: drawByParticleID model # Create a drawByParticleID model named drawByParticleID-0 /vis/modeling/trajectories/create/drawByParticleID # Configure drawByParticleID-0 model /vis/modeling/trajectories/drawByParticleID-0/set gamma red /vis/modeling/trajectories/drawByParticleID-0/set proton yellow /vis/modeling/trajectories/drawByParticleID-0/setRGBA e

12 May Geant4 Advanced Visualization J. Perl More Sample Commands: drawByCharge Model and Toggling Between Two Models # Create a drawByCharge model (will get default name of drawCharge-0) /vis/modeling/trajectories/create/drawByCharge # Create another drawByCharge model with an explicit name of testChargeModel /vis/modeling/trajectories/create/drawByCharge testChargeModel # We can now go on to configure these two different drawByCharge models and then # can choose to visualize using either one of them at any time # Configure drawByCharge-0 model /vis/modeling/trajectories/drawByCharge-0/set 1 red /vis/modeling/trajectories/drawByCharge-0/set -1 red /vis/modeling/trajectories/drawByCharge-0/set 0 white # Configure testCharge model through G4Colour components /vis/modeling/trajectories/testChargeModel/setRGBA /vis/modeling/trajectories/testChargeModel/setRGBA /vis/modeling/trajectories/testChargeModel/setRGBA # List available models /vis/modeling/trajectories/list # select drawByCharge-0 to be current /vis/modeling/trajectories/select drawByCharge-0

12 May Geant4 Advanced Visualization J. Perl Trajectory Modeling by HepRep-Style Attributes /vis/modeling/trajectories/create/drawByAttribute /vis/modeling/trajectories/drawByCharge-0/verbose true /vis/modeling/trajectories/drawByCharge-0/setAttribute CPN /vis/modeling/trajectories/drawByAttribute-0/addValue brem_key eBrem /vis/modeling/trajectories/drawByAttribute-0/addValue annihil_key annihil /vis/modeling/trajectories/drawByAttribute-0/addValue decay_key Decay /vis/modeling/trajectories/drawByAttribute-0/addValue muIon_key muIoni /vis/modeling/trajectories/drawByAttribute-0/addValue eIon_key eIoni /vis/modeling/trajectories/drawByAttribute-0/brem_key/setLineColour red /vis/modeling/trajectories/drawByAttribute-0/annihil_key/setLineColour green /vis/modeling/trajectories/drawByAttribute-0/decay_key/setLineColour cyan /vis/modeling/trajectories/drawByAttribute-0/eIon_key/setLineColour yellow /vis/modeling/trajectories/drawByAttribute-0/muIon_key/setLineColour magenta Draw by the attribute called CPN Configure visualisation parameters Select relevant attribute values For even greater flexibility, you can model the trajectory based on any of the HepRep-style attributes, whether it is one of the default ones or an attribute that you have defined for yourself. For even greater flexibility, you can model the trajectory based on any of the HepRep-style attributes, whether it is one of the default ones or an attribute that you have defined for yourself. E.g., set color based the value of the attribute CPN (for “creator process name”) E.g., set color based the value of the attribute CPN (for “creator process name”)

12 May Geant4 Advanced Visualization J. Perl Creator Process — muIoni — Decay — annihil — eIoni — brem Momentum (MeV) — 0-1 — 1-10 — — — — 50+ Example A01, five events, drawByAttribute models

12 May Geant4 Advanced Visualization J. Perl Modeling Trajectory as Line, Step Points or Both In the discussion of models up to now, we’ve only shown you how to set the color, but a model can include many more options including whether to show the trajectory as a line, a set of step points or both: setDrawLine * Set draw line command setDrawLine * Set draw line command setLineVisible * Set line visibility command setLineVisible * Set line visibility command setLineColour * Set colour through a string setLineColour * Set colour through a string setLineColourRGBA * Set colour through red, green, blue and alpha components setLineColourRGBA * Set colour through red, green, blue and alpha components setDrawStepPts * Set draw step points command setDrawStepPts * Set draw step points command setStepPtsVisible * Set step points colour command setStepPtsVisible * Set step points colour command setStepPtsColour * Set colour through a string setStepPtsColour * Set colour through a string setStepPtsColourRGBA * Set colour through red, green, blue and alpha components setStepPtsColourRGBA * Set colour through red, green, blue and alpha components setStepPtsSize * Set step points colour command setStepPtsSize * Set step points colour command setStepPtsType * Set step points type. setStepPtsType * Set step points type. setStepPtsFillStyle * Set step fill style type. setStepPtsFillStyle * Set step fill style type. (the following items relate to special kind of points discussed later under “smooth trajectory”) (the following items relate to special kind of points discussed later under “smooth trajectory”) setDrawAuxPts * Set draw auxiliary points command setDrawAuxPts * Set draw auxiliary points command setAuxPtsVisible * Set auxiliary points visibility command setAuxPtsVisible * Set auxiliary points visibility command setAuxPtsColour * Set colour through a string setAuxPtsColour * Set colour through a string setAuxPtsColourRGBA * Set colour through red, green, blue and alpha components setAuxPtsColourRGBA * Set colour through red, green, blue and alpha components setAuxPtsSize * Set auxiliary points size command setAuxPtsSize * Set auxiliary points size command setAuxPtsType * Set auxiliary points type. setAuxPtsType * Set auxiliary points type. setAuxPtsFillStyle * Set auxiliary fill style. setAuxPtsFillStyle * Set auxiliary fill style.

12 May Geant4 Advanced Visualization J. Perl Sample Commands: generic trajectory model # Create a generic model (will get default name of generic-0) # From here we can set overall defaults for things like line color, # whether to show step points or just the trajectory line, etc. /vis/modeling/trajectories/create/generic # Configure the generic model to colour all trajectories cyan and to show step points /vis/modeling/trajectories/generic-0/default/setDrawStepPts true /vis/modeling/trajectories/generic-0/default/setStepPtsSize 16 /vis/modeling/trajectories/generic-0/default/setLineColour cyan /vis/modeling/trajectories/generic-0/default/setStepPtsColour red

12 May Geant4 Advanced Visualization J. Perl Enhanced Trajectory Drawing: Releases Since Release 8.0: Since Release 8.0: Color by Charge Color by Charge Color by Particle Type Color by Particle Type Since Release 8.1 Since Release 8.1 Color by Origin Volume Color by Origin Volume Control over more than just color, including Control over more than just color, including whether to show just trajectory line, or just trajectory points, or both whether to show just trajectory line, or just trajectory points, or both width of trajectory lines, type of marker to use for points, point size, etc. width of trajectory lines, type of marker to use for points, point size, etc. Since Release 8.2 Since Release 8.2 Color by Any of the HepRep-Style Attributes, such as: Color by Any of the HepRep-Style Attributes, such as: Initial volume name Initial volume name Magnitude of momentum Magnitude of momentum Number of trajectory points Number of trajectory points User defined attributes User defined attributes Creator process name & type (if using Rich Trajectory) Creator process name & type (if using Rich Trajectory) Next volume name (if using Rich Trajectory) Next volume name (if using Rich Trajectory)

12 May Geant4 Advanced Visualization J. Perl Advanced Trajectory Modeling

12 May Geant4 Advanced Visualization J. Perl Controlling Model from Compiled Code Instantiate model Instantiate model Configure model Configure model Register with visualization manager Register with visualization manager main.cc // Create and initialise visualization manager G4VisManager* visManager = new G4VisExecutive; visManager->Initialize(); // Create new drawByParticleID model G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID; // Configure model model->SetDefault("cyan"); model->Set("gamma", "green"); model->Set("e+", "magenta"); model->Set("e-", G4Color(0.3, 0.3, 0.3)); //Register model with visualization manager visManager->RegisterModel(model);

12 May Geant4 Advanced Visualization J. Perl Defining Your Own Model New trajectory models must inherit from G4VTrajectoryModel and implement these pure virtual methods: New trajectory models must inherit from G4VTrajectoryModel and implement these pure virtual methods: virtual void Draw(const G4VTrajectory&, G4int i_mode = 0) const = 0; virtual void Draw(const G4VTrajectory&, G4int i_mode = 0) const = 0; virtual void Print(std::ostream& ostr) const = 0; virtual void Print(std::ostream& ostr) const = 0; New models can be used directly in compiled code New models can be used directly in compiled code  Need to be registered with visualization manager main.cc // Create custom model MyCustomTrajectoryModel* myModel = new MyCustomTrajectoryModel("custom"); // Configure it if necessary and then register with G4VisManager... visManager->RegisterModel(myModel)

12 May Geant4 Advanced Visualization J. Perl To Make User Defined Model Available from Interactive Commands You will need to write Messenger classes You will need to write Messenger classes Messengers to configure the model should inherit from G4VModelCommand. The concrete trajectory model type should be used for the template parameter Messengers to configure the model should inherit from G4VModelCommand. The concrete trajectory model type should be used for the template parameter and a Factory class and a Factory class A factory class responsible for the model and associated messenger creation must also be written. The factory should inherit from G4VModelFactory. The abstract model type should be used for the template parameter, e.g.: A factory class responsible for the model and associated messenger creation must also be written. The factory should inherit from G4VModelFactory. The abstract model type should be used for the template parameter, e.g.: G4ModelCommandDrawByParticleIDSet.cc class G4ModelCommandDrawByParticleIDSet : public : G4VModelCommand {... }; G4TrajectoryDrawByChargeFactory.cc class G4TrajectoryDrawByChargeFactory : public G4VModelFactory {... };

12 May Geant4 Advanced Visualization J. Perl Construct the Model and Associated Messengers G4TrajectoryDrawByParticleIDFactory.cc ModelAndMessengers G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4String& name) { // Create model with given name G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name); // Create associated messengers with commands in ``placement'’ command directory. Messengers messengers; messengers.push_back(new G4ModelCommandDrawByParticleIDSet(model, placement));... return ModelAndMessengers(model, messengers); } G4VisExecutive.cc G4VisExecutive::RegisterModelFactories() {... RegisterModelFactory(new G4TrajectoryDrawByParticleIDFactory()); }

12 May Geant4 Advanced Visualization J. Perl Trajectory and Hit Filtering

12 May Geant4 Advanced Visualization J. Perl Trajectory and Hit Filtering Display user-defined subset of trajectories Display user-defined subset of trajectories Solves problems with overly busy graphics or excessively large graphics files Solves problems with overly busy graphics or excessively large graphics files Similar structure to enhanced trajectory drawing Similar structure to enhanced trajectory drawing Set of simple filter models Set of simple filter models Similar Interactive creation/configuration structure Similar Interactive creation/configuration structure chargeFilter chargeFilter  Filters trajectories according to charge particleFilter particleFilter  Filters trajectories according to particle type originVolumeFilter originVolumeFilter  Filters trajectories according to volume in which they originated Project Lead: Jane Tinslay Project Lead: Jane Tinslay

12 May Geant4 Advanced Visualization J. Perl Momentum (MeV) — — — — — — HandsOn5, McGill tutorial, 1000 events, Attribute Filter IMag > 2.5 MeV IMag > 2.5 MeV, particle = gamma

12 May Geant4 Advanced Visualization J. Perl Trajectory Filtering Simplest example: Simplest example: /vis/filtering/trajectories/create/particleFilter /vis/filtering/trajectories/particleFilter-0/add e- will cause everything except electrons to be filtered out You can chain multiple filters You can chain multiple filters e.g., filter out gammas e.g., filter out gammas and filter out particles with momentum less than 100 MeV and filter out particles with momentum less than 100 MeV Two modes of filtering: Two modes of filtering: Important issue when working with those visualization drivers that allow you to turn visibility on and off from the vis application (HepRApp or OpenInventor) Important issue when working with those visualization drivers that allow you to turn visibility on and off from the vis application (HepRApp or OpenInventor) One mode has rejected trajectories marked invisible but still sent to vis app One mode has rejected trajectories marked invisible but still sent to vis app user can toggle them back to visible from within the vis app user can toggle them back to visible from within the vis app but if there is a very large number of these invisible trajectories, application may be slowed down and files may be very large but if there is a very large number of these invisible trajectories, application may be slowed down and files may be very large Other mode has rejected trajectories entirely omitted Other mode has rejected trajectories entirely omitted user cannot toggle them back to visible from within the vis app user cannot toggle them back to visible from within the vis app but application stays fast and files stay small but application stays fast and files stay small

12 May Geant4 Advanced Visualization J. Perl Filtering Example /vis/modeling/trajectories/drawByAttribute-0/setAttribute IMag /vis/modeling/trajectories/drawByAttribute-0/addInterval interval1 0.0 keV 2.5MeV /vis/modeling/trajectories/drawByAttribute-0/addInterval interval2 2.5 MeV 5 MeV /vis/modeling/trajectories/drawByAttribute-0/addInterval interval3 5 MeV 7.5 MeV /vis/modeling/trajectories/drawByAttribute-0/addInterval interval4 7.5 MeV 10 MeV /vis/modeling/trajectories/drawByAttribute-0/addInterval interval5 10 MeV 12.5 MeV /vis/modeling/trajectories/drawByAttribute-0/addInterval interval MeV MeV /vis/modeling/trajectories/drawByAttribute-0/interval1/setLineColourRGBA /vis/modeling/trajectories/drawByAttribute-0/interval2/setLineColourRGBA /vis/modeling/trajectories/drawByAttribute-0/interval3/setLineColourRGBA /vis/modeling/trajectories/drawByAttribute-0/interval4/setLineColourRGBA /vis/modeling/trajectories/drawByAttribute-0/interval5/setLineColourRGBA /vis/modeling/trajectories/drawByAttribute-0/interval6/setLineColourRGBA /vis/filtering/trajectories/create/attributeFilter /vis/filtering/trajectories/attributeFilter-0/setAttribute IMag /vis/filtering/trajectories/attributeFilter-0/addInterval 2.5 MeV 1000 MeV /vis/filtering/trajectories/create/particleFilter /vis/filtering/trajectories/particleFilter-0/add gamma Momentum interval based colour scale Momentum filter Gamma filter Configure visualisation properties Momentum filter

12 May Geant4 Advanced Visualization J. Perl Hit Filtering The Attribute-Based filtering discussed above for Trajectories was implemented generically so that it can a pply to any class which implements the Geant4 generic attributes method: The Attribute-Based filtering discussed above for Trajectories was implemented generically so that it can a pply to any class which implements the Geant4 generic attributes method: Whatever your Hit class, you can basically get interactive hit filtering for free Whatever your Hit class, you can basically get interactive hit filtering for free To activate, add a filter call to G4VVisManager in Draw method of hit class To activate, add a filter call to G4VVisManager in Draw method of hit class const std::map * GetAttDefs() const; std::vector * CreateAttValues() const; const std::map * GetAttDefs() const; std::vector * CreateAttValues() const; void MyHit::Draw() { … if (! pVVisManager->FilterHit(*this)) return; … void MyHit::Draw() { … if (! pVVisManager->FilterHit(*this)) return; …

12 May Geant4 Advanced Visualization J. Perl Trajectory and Hit Filtering: Releases Since Release 8.1 Since Release 8.1 Filter by Charge Filter by Charge Filter by Particle Type Filter by Particle Type Filter by Origin Volume Filter by Origin Volume Since Release 8.2 Since Release 8.2 Filter by Any of the HepRep-Style Attributes, such as: Filter by Any of the HepRep-Style Attributes, such as: Initial volume name Initial volume name Magnitude of momentum Magnitude of momentum Number of trajectory points Number of trajectory points User defined attributes User defined attributes Creator process name & type (if using Rich Trajectory) Creator process name & type (if using Rich Trajectory) Next volume name (if using Rich Trajectory) Next volume name (if using Rich Trajectory) Future Releases Future Releases Filter by creation time of particle Filter by creation time of particle more more

12 May Geant4 Advanced Visualization J. Perl Smooth and Rich Trajectories

12 May Geant4 Advanced Visualization J. Perl G4SmoothTrajectory and G4RichTrajectory Most users use the standard G4Trajectory. A point is generated each position that something physical happens Interaction, Decay, Boundary Crossing, Step But two other trajectory classes are available Smooth Trajectory adds auxiliary points to allow smoother line in visualization (not Geant4 Steps, no physics at auxiliary points) useful when trajectories are highly curved due to magnetic fields Rich Trajectory encodes additional information at every step point (which you can then see when you click on the step in HepRApp) Total energy deposited at this point Position (x,y,z) Why was this point generated (Interaction, Decay, Boundary Crossing or Step) Project Lead: John Allison, Joseph Perl

12 May Geant4 Advanced Visualization J. Perl Regular versus Smooth Trajectory Regular Trajectory is a polyline made up of only the actual steps used by Geant4 Smooth Trajectory includes additional points to make the polyline appear smoother. These additional points are not Geant4 steps. They are only used by visualization.

12 May Geant4 Advanced Visualization J. Perl Smooth Trajectory Makes Big Difference for Trajectories that Loop in a Magnetic Field Yellow dots are the actual step points used by Geant4 Magenta dots are auxiliary points added just for purposes of visualization

12 May Geant4 Advanced Visualization J. Perl Rich Trajectory Has Details on Every Step Point

12 May Geant4 Advanced Visualization J. Perl Smooth and Rich Trajectories Now Easier to Use Up to Release 8.1, users who wanted to use these trajectories have had to write their own tracking action and explicitly instantiate one of these special kinds of trajectory Release 8.2 made this possible from an interactive command: /vis/scene/add/trajectories /vis/scene/add/trajectories smooth /vis/scene/add/trajectories rich /vis/scene/add/trajectories smooth rich Note that default trajectory modeling draws trajectories only as a line. Step points are not drawn. To draw the points, you need to include modeling commands such as: /vis/modeling/trajectories/create/generic /vis/modeling/trajectories/generic-0/default/setDrawStepPts true /vis/modeling/trajectories/generic-0/default/setStepPtsSize 16 /vis/modeling/trajectories/generic-0/default/setStepPtsColour red

12 May Geant4 Advanced Visualization J. Perl Geant4 Visualization Resources Geant4 Installation Guides  Hands on HepRApp Tutorial  Hands on DAWN Tutorial  Hands on OpenGL Tutorial  Geant4 Visualization Commands  (and.pdf) Geant4 Advanced Visualization  (and.pdf) How to Make a Movie  (and.pdf) Visualization Chapter of the Geant4 User’s Guide for Application Developers  List of Visualization Commands:  AllResources/Control/UIcommands/_vis_.html For Questions or Comments: Geant4 Visualization Online Forum: 