Closed carlu closed 11 years ago
Hmmmm. This is weird. I use VRMLs and use a program called DeepView. I can rotate, zoom, scroll etc with the mouse, remove and add volumes, take cross-sections, and even measure distances. I can get a scene-tree too, and mine seems to be fine. Clicking on and off volumes works. Maybe a Qt specific problem?
I've used Qt before, but not on this Geant4 code, only in the Geant4 examples. It worked then. Not sure why you are having this issue.
Thanks for the heads up.
@carlu, I'm trying to use Qt as well and I am able to get it to work with the same example that you show above, but I am having a hard time getting it to work with the detectorSimulations code. I am running into a problem because there is no gui.mac file. Is this something that I need to create myself? I don't see one anywhere in the repo, but it is called specifically in detectionSystems.cc.
Hi @tballast, I hacked one together from the one provided with the G4 examples. I'll paste it below for you to have a look at. Just put it in your build directory and then run the program with no macro file specified. It will open the Qt viewer and you can issue /run/beamOn from there. I was planning to add this to the repo but I wanted to get it to work properly first. Lets see how you get on :-)
/control/verbose 2 /run/verbose 2
/DetSys/det/addGriffinForward 2
/vis/drawVolume /vis/open OGLIQt
/vis/scene/add/trajectories smooth /vis/modeling/trajectories/create/drawByCharge /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
/vis/scene/add/hits
/vis/scene/endOfEventAction accumulate
/vis/set/textColour green /vis/set/textLayout right /vis/scene/add/text2D 0.9 -.9 24 ! ! detectiorSimulations
/vis/set/textLayout # Revert to normal (left adjusted) layout /vis/set/textColour # Revert to default text colour (blue)
/vis/scene/add/scale # Simple scale line /vis/scene/add/axes # Simple axes: x=red, y=green, z=blue. /vis/scene/add/eventID # Drawn at end of event
/vis/set/colour red /vis/set/lineWidth 2 /vis/scene/add/frame # Simple frame around the view /vis/set/colour # Revert to default colour (white) /vis/set/lineWidth # Revert to default line width (1.)
/vis/scene/endOfEventAction refresh /vis/viewer/set/autoRefresh True
/DetSys/gun/particle gamma /DetSys/gun/energy 661.657 keV
EDIT: Github seems to interpret # at the begining of the line as a formatting command for a title, so all the comment lines now start #/.
@carlu, awesome, thank you. I got it working and I got the scene tree to work as well. I just made a small modification to your gui.mac.
Replace
/vis/drawVolume /vis/open OGLIQt
with
/vis/open OGL /vis/drawVolume
And It should work.
Awesome, thanks @tballast!
No problem, @carlu. I was having one other issue as well that you don't seem to be having based on your screenshot. I always get the error:
ERROR: G4VSceneHandler::RequestPrimitives Polyhedron not available for extension_suppressor_shell_with_cavity. This means it cannot be visualized on most systems. Contact the Visualization Coordinator.
When I run the simulation, and my detectors appear as a wire frame instead of a full surface.
I know you just closed the issue but this seems like a reasonable place to ask about it. Any idea?
Hi @tballast, sorry for the late reply. I'm not getting that error, but it does sound vaguely familiar.
As to the solid/wireframe thing, I see a wireframe with the gui.mac I posted, but if I add "/vis/viewer/set/style surface" then they show as solids. See if that works for you, and I'll see if any more information on that error emerges from the mists of my memory....
Perfect, yea the command worked. I don't really know what to do about the error but the visualization seems to be working well otherwise.
hello, some geant4 ex have some extra commands added on the top of the viewer that can be an easier way to run a beam or.. they are listed as: File Run Gun Vis Viewer my problem is that i was working on a CADm
esh ex and they didn't appear, i will attach 2 photos for both ex with and without. anyone know's how to add these commands and the location where they should be added. Thanks!
Hi folks. So of all the visualisation options, I think the Qt one is the best for quick debugging issues. Mainly just because you can rotate, zoom, scroll etc with the mouse, and change run options from the gui without needing to re-write a run macro.
When I use this visualisation on the GEANT4 examples I get a nice "scene-tree" containing a list of all the physical volumes which I can switch on and off. In our code however I can't see this list. I've been trying to figure out why but I've so far failed. Let me know if you have any ideas, otherwise I'll update this issue when I manage to fix it. For now I'm going to look at something else....
(See screenshots below....)