HOWTO visually inspect the simulation geometry
From GlueXWiki
This page shows how to use geant++ and root to check if the detector geometry has been done right.
Using hdgeant++
- hdgeant++ is based on GEANT3 and uses also paw. So being familiar with kumac is usefull. To check if some modification in an xml file has been done correctly you do the followoing:
1) generate the geometry fortran file in the hdds directory by "make hddsGeant3.F" 2) copy hddsGeant3.F into the HDGeant directory and recompile hdgeant++ by "make clean; make" important link option needed "-Wl,-export-dynamic" to link hdgeant++! (see Makefile.orig): this is necessary to use wc#pick to compile with motif define CERNLIB_MOTIF in gxint.F: this is necessary if you want to use paw++ style in Makefile.orig add "-lxerces-c" to the GLIBS definition and compile as "make -f Makefile.orig hdgeant++" 3) make sure you have "wc.kumac" and "wc.f" in your working directory 4) start "hdgeant++" in your working directory
- wc#modules in hdgeant++: in the command window of hdgeant++ you can type in paw and geant commands or execute a kumac script.
1) exec wc#setorigin x y z : this will set the point x,y,z to be in the center of the display window. 2) exec wc#dcut cdc z 0 10 10 1 1 : this will plot the "cdc" geometry with a cut at showing the x-y plane at z=0 with the viewpoint horizontal 10 and vertical 10 and horizontal and vertical scale 1 1 3) exec wc#dcut site x 0 2 10 0.4 0.4: example using volume "site" 4) exec wc#pick : show a cross-hair in the window. using left mouse-button to pick volumes (can be use more than once) after the last pick us the right mouse-button to finish. At this point all picked coordinate are printed together with the corresponding volume information.
Using root
- The program hdds-root in the hdds directory generates hddsroot.C by typing "make hddsroot.C" this file represents an implementation of the geometry unsing the root TGeo package.
- after generating hddsroot.C start root
- .L hddsroot.C : loads the hddsroot.C module
- hddsroot(); : execute the module hddsroot. A graphics window will pup.
- select in menu "View" and "View with" OpenGL
- use the Help menu to learn more.
- on the root command prompt you can use any root command. Look in the description of the TGeoVolume class what useful functions there are.
- use TGeoVolume::CheckGeometry() to test if volumes are seen by geant tracks.
- Or alternatively: use hddsroot.h instead of hddsroot.C
- .L hddsroot.h; // load the code
- TGeoManager *Geom = hddsroot(); // generate the geometry
- Geom->GetVolume("VolumeName")->Raytrace(); // this will draw the volume "VolumeName" like CDC, FCAL,
- TObjArray *Array = Geom->GetListOfVolumes(); // get a list of all volume names
- Array->GetEntries(); // this gets the number of elements in the array e.q. volumes
- Array->At(5)->GetName(); // this gets the name of Volume number 5