1 / 12

Basic Visualization Tutorial

Basic Visualization Tutorial. Using Geant4. Why visualize?. Debugging geometry Demonstration purpose Interactive picking of visualized objects For fun………. What can you visualize?. Detector components Physical volumes Particle trajectories Hits of particles in detector components.

Download Presentation

Basic Visualization Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Visualization Tutorial Using Geant4 Wah-kai Ngai

  2. Why visualize? • Debugging geometry • Demonstration purpose • Interactive picking of visualized objects • For fun……… Wah-kai Ngai

  3. What can you visualize? • Detector components • Physical volumes • Particle trajectories • Hits of particles in detector components Wah-kai Ngai

  4. Things you need to do • Choose a visualization driver • OpenGL, HepRepFile, DAWN • They have different limitations and advantages. I use OpenGL personally because of its speed • No matter which one you use, the following procedures are the same Wah-kai Ngai

  5. Things you need to do • Register the drivers, see novice examples N02, • ../examples/novice/N02/include/ExN02VisManager.hh • ../examples/novice/N02/src/ExN02VisManager.cc • Basically, just copy the code and change some words to make it run Wah-kai Ngai

  6. Things you need to do • Add attributes to the detector components you want to visualize • Visualization attributes are a set of information associated with objects which can be visualized Wah-kai Ngai

  7. Color • G4VisAttributes holds its color entry as an object of the class G4Colour • A G4Colour object is created by giving the red, blue and green components of the color G4Color( G4double red=1.0,G4double green=1.0,G4double blue=1.0, G4double a=1.0); • The default value of each component is 1, which means white Wah-kai Ngai

  8. Color G4Colour white () ; // white G4Colour white (1.,1.,1.) ; // white G4Colour gray (.5,.5,.5) ; // gray G4Colour black (0.,0.,0.) ; // black G4Colour red (1.,0.,0.) ; // red G4Colour green (0.,1.,0.) ; // green G4Colour blue (0.,0.,1.) ; // blue G4Colour cyan (0.,1.,1.) ; // cyan G4Colour magenta (1.,0.,1.) ; // magenta G4Colour yellow (1.,1.,0.) ; // yellow Wah-kai Ngai

  9. Color • One can set the RGBA components directly into G4VisAttributes void G4VisAttributes::SetColour (G4double red, G4double green, G4double blue, G4double alpha=1.0); • The following G4VisAttributes constructor is also supported G4VisAttributes::G4VisAttributes(const G4Colour& color); Wah-kai Ngai

  10. Forced wireframe and forced solid styles • one can select to visualize detector components in “wireframe” or with “surfaces”. • The forced wireframe and forced solid styles make it possible to mix wireframe and solid visualization. For instance, one can make the mother volume transparent and still look inside when in “solid” mode • Forced wireframe and forced solid are available via: void G4VisAttributes::SetForceWireframe(G4bool force); void G4VisAttributes::SetForceSolid(G4bool force); Wah-kai Ngai

  11. How to assign G4VisAttributes to a volume? • In constructing the detector components, one may assign a set of visualization attributes to each LOGICAL VOLUME in order to visualize it later • G4LogicalVolume holds a pointer to a G4VisAttributes. • void G4LogicalVolume::SetVisAttributes(const G4VisAttributes* pVa); • ExpHall_log=new G4LogicalVolume(ExpHall_box,Air,”exp_hall”); • G4VisAttributes *expHallVisAtt=new G4VisAttributes(G4Colour(0.,1.,1.)); • expHallVisAtt->SetForceWireframe(true); • ExpHall_log->SetVisAttributes(expHallVisAtt); Wah-kai Ngai

  12. Things you need to do • Recompile the program! • Need some built-in command to order geant4 for visualization • Check out ../examples/novice/N02/vis.mac Wah-kai Ngai

More Related