Problem 2130 - Clipping box behaviour with scene handler seems strange
Summary: Clipping box behaviour with scene handler seems strange
Status: ASSIGNED
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization (show other problems)
Version: 10.5
Hardware: All All
: P4 minor
Assignee: Laurent Garnier
URL:
Depends on:
Blocks:
 
Reported: 2019-02-11 21:17 CET by Michael Kelsey
Modified: 2020-11-24 20:50 CET (History)
1 user (show)

See Also:


Attachments
complete detector disk with mask pattern, zoomed x3 (2.63 MB, application/postscript)
2019-02-11 21:17 CET, Michael Kelsey
Details
clipped (1 x 1 x .27 cm) section of mask and detector, zoomed x3 (142.58 KB, application/postscript)
2019-02-11 21:20 CET, Michael Kelsey
Details

Note You need to log in before you can comment on or make changes to this problem.
Description Michael Kelsey 2019-02-11 21:17:11 CET
Created attachment 541 [details]
complete detector disk with mask pattern, zoomed x3

I am trying to get a magnified (not "zoomTo") view of a portion of my geometry, including some detailed field vectors.  Because of the way the field visualization is done, I need to have a Vis scene with a limited extent.  

I cannot do this with the /vis/scene/add/extent command, because the world volume being drawn will take precedence when computing the overall extent.

I have tried using /vis/scene/add/volume, with a clipping box.  The clipping box "should" produce a limited extent and visualize the limited piece of my geometry properly, but it doesn't seem to do so.

My geometry consists of a 10 x 10 x 3.3 cm disk, with a pattern of rectangles on the top surface (generated using G4PVParameterised), which is a daughter of the overall "Detector" volume.  The "full_mask" drawing attached shows 

  /vis/drawVolume Detector
  /vis/viewer/zoomTo 3
  /vis/viewer/panTo -1 3 cm
  /vis/viewer/flush

My goal is to cut out a small rectangle from the upper surface of the disk, so I can see the details of the electric field in that region only.  I used the commands

  /vis/scene/create
  /vis/scene/add/volume Detector ! ! *box cm -2 -1 1 2 1.4 2.0
  /vis/sceneHandler/attach
  /vis/viewer/zoomTo 3
  /vis/viewer/panTo -1 3 cm
  /vis/viewer/flush

which are shown in the "clip-mask" drawing.

1) With the same zoomTo factor, the two pictures are not at the same scale (the clipped version is magnified more).

2) The parameterized pattern is kind of weird inside the clipping region: some rectangles are clipped off as I'd expect, while others along the edge are missing entirely.

3) Some of the parameterized pattern is drawing outside the clipping region, but not the whole disk.

Not shown here, but when I try to do the field visualization, the clipping box is _not_ used as the scene extent.  Instead, the full Detector volume is used, which means I don't get the field sampled inside the clipping box the way I want it to be.

I am not sure that the volume clipping is being propagated to the scene extent values the way that I'd expect.
Comment 1 Michael Kelsey 2019-02-11 21:20:53 CET
Created attachment 542 [details]
clipped (1 x 1 x .27 cm) section of mask and detector, zoomed x3
Comment 2 John.Allison 2020-11-18 10:29:14 CET
Hi Mike

My attention has been drawn to this old bug report. You and I have been working on improving visualisation of fields - does it help solve the problems?

John
Comment 3 John.Allison 2020-11-22 15:28:57 CET
Sorry. That last message was meant for another bug report.
Comment 4 John.Allison 2020-11-22 15:56:34 CET
Sorry again. No it *was* meant for you, Mike.

May I close this report now?

John
Comment 5 Michael Kelsey 2020-11-24 00:29:01 CET
I'm not able to reproduce either the problem or success using G4 10.6.  With the "clipping" macro fragment, I'm getting errors:

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : visman0202
      issued by : G4Scene::CalculateExtent
Scene has no extent.  Please activate or add something.
The camera needs to have something to point at!
Add a volume. (You may need "/run/initialize".)
Or use "/vis/scene/add/extent".
"/vis/scene/list" to see list of models.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------


-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : visman0106
      issued by : G4VSceneHandler::ProcessScene
The scene has no extent.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

I have tried using both the PV name and the LV name for the detector, both give the same message as above.  Have the visualization commands really changed?
Comment 6 Michael Kelsey 2020-11-24 18:41:23 CET
Some more focussed information:  The visman0202 G4Scene::CalculateExtent() error happens immediately after the line

   /vis/scene/add/volume Detector ! ! *box cm -2 -1 1 2 1.4 2.0

in my macro.  The is the same line which worked fine in G4 10.5 (which I used to create the "clipped section" attachment).  The same visman0202 error occurs if I have no configuration arguments, and just try to add the full volume.

It seems like something has changed between 10.5 and 10.6, such that I not only cannot verify that the original problem is fixed, but even the basic volume drawing now fails.

I can say that the basic "wrapper" command, /vis/drawVolume, works fine.
Comment 7 Michael Kelsey 2020-11-24 20:50:06 CET
This behaviour makes no sense.  I just found and read G4VisCommandDrawVolume::SetNewValue() (in G4VisCommandsCompound.cc).  The /vis/drawVolume command is exactly identical with the three primitive commands I quoted above.  Why does the compound command work where the individual commands, in exactly the same session, do not?