Presentation is loading. Please wait.

Presentation is loading. Please wait.

May 20, 2005Wah-kai Ngai1 Basic Visualization Tutorial Using Geant4.

Similar presentations


Presentation on theme: "May 20, 2005Wah-kai Ngai1 Basic Visualization Tutorial Using Geant4."— Presentation transcript:

1 May 20, 2005Wah-kai Ngai1 Basic Visualization Tutorial Using Geant4

2 May 20, 2005Wah-kai Ngai2 Why visualize? Debugging geometry Demonstration purpose Interactive picking of visualized objects For fun………

3 May 20, 2005Wah-kai Ngai3 What can you visualize? Detector components Physical volumes Particle trajectories Hits of particles in detector components

4 May 20, 2005Wah-kai Ngai4 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

5 May 20, 2005Wah-kai Ngai5 Things you need to do Register the drivers, see novice examples N02, –../examples/novice/N02/include/ExN02VisManage r.hh –../examples/novice/N02/src/ExN02VisManager.cc Basically, just copy the code and change some words to make it run

6 May 20, 2005Wah-kai Ngai6 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

7 May 20, 2005Wah-kai Ngai7 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

8 May 20, 2005Wah-kai Ngai8 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

9 May 20, 2005Wah-kai Ngai9 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);

10 May 20, 2005Wah-kai Ngai10 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);

11 May 20, 2005Wah-kai Ngai11 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);

12 May 20, 2005Wah-kai Ngai12 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


Download ppt "May 20, 2005Wah-kai Ngai1 Basic Visualization Tutorial Using Geant4."

Similar presentations


Ads by Google