GRIFFINCollaboration / detectorSimulations

GEANT4 simulation code for the GRIFFIN array and it's suite of ancillary detection systems.
7 stars 13 forks source link

Issue with Qt visualisation #24

Closed carlu closed 11 years ago

carlu commented 11 years ago

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....)

temp temp1

evan012345 commented 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.

image

tballast commented 11 years ago

@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.

carlu commented 11 years ago

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 :-)

/ Set verbosity high

/control/verbose 2 /run/verbose 2

/ Add detectors

/DetSys/det/addGriffinBack 1

/DetSys/det/addGriffinForward 2

/ Prepare visualisation

/vis/drawVolume /vis/open OGLIQt

/ Draw smooth trajectories at end of event, showing trajectory points

/ as markers 2 pixels wide:

/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

/ (if too many tracks cause core dump => /tracking/storeTrajectory 0)

/ Draw hits at end of event:

/vis/scene/add/hits

/ To draw only gammas:

/vis/filtering/trajectories/create/particleFilter

/vis/filtering/trajectories/particleFilter-0/add gamma

/ To invert the above, drawing all particles except gammas,

/ keep the above two lines but also add:

/vis/filtering/trajectories/particleFilter-0/invert true

/ To superimpose all of the events from a given run:

/vis/scene/endOfEventAction accumulate

/ Decorations

/ Name

/vis/set/textColour green /vis/set/textLayout right /vis/scene/add/text2D 0.9 -.9 24 ! ! detectiorSimulations

/ or, if your system does not support right-adjustment

/vis/scene/add/text2D 0 -.9 24 ! ! exampleB1

/vis/set/textLayout # Revert to normal (left adjusted) layout /vis/set/textColour # Revert to default text colour (blue)

/ Axes, scale, etc.

/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/scene/add/date # Date stamp

/vis/scene/add/logo2D # Simple logo

/vis/scene/add/logo # 3D logo

/ Frame

/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.)

/ refresh display

/vis/scene/endOfEventAction refresh /vis/viewer/set/autoRefresh True

/ To enable output

/DetSys/run/enableLM

/ Set up source

/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 #/.

tballast commented 11 years ago

@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.

carlu commented 11 years ago

Awesome, thanks @tballast!

tballast commented 11 years ago

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. detec

I know you just closed the issue but this seems like a reasonable place to ask about it. Any idea?

carlu commented 11 years ago

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....

tballast commented 11 years ago

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.

jacquesdoumani commented 7 years ago

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 screenshot from 2017-07-21 11-14-01 screenshot from 2017-07-21 11-14-18

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!