Open tbaudier opened 2 years ago
To complete, I found that the pointer in Geant4 "fpTopPV" is initialized in Gate and deleted and created again in Gate when you execute "/gate/run/initialize" here without be updated in Geant4.
A workaroud is to write the visualization part after "/gate/run/initialize" in the macro. For example: main.mac:
## verbose
/control/verbose 0
/run/verbose 0
/event/verbose 0
/tracking/verbose 0
/gate/application/verbose 0
/gate/generator/verbose 0
/gate/source/verbose 0
/gate/random/verbose 0
/gate/output/verbose 0
/gate/verbose Physic 0
/gate/verbose Cuts 1
/gate/verbose SD 0
/gate/verbose Actions 0
/gate/verbose Actor 0
/gate/verbose Step 0
/gate/verbose Error 0
/gate/verbose Warning 0
/gate/verbose Output 0
/gate/verbose Beam 1
/gate/verbose Volume 1
/gate/verbose Image 0
/gate/verbose Geometry 1
/gate/verbose Core 1
## world
/gate/geometry/setMaterialDatabase GateMaterials.db
/gate/world/geometry/setXLength 2 m
/gate/world/geometry/setYLength 2 m
/gate/world/geometry/setZLength 2 m
/gate/world/vis/setColor white
/gate/world/vis/forceWireframe
/gate/world/setMaterial Air
## initialize
/gate/run/initialize
## visu
/vis/open OGLI
/vis/drawVolume
/vis/viewer/flush
/tracking/storeTrajectory 1
/vis/scene/add/trajectories
/vis/scene/endOfEventAction accumulate
/vis/scene/add/axes 0 0 0 500 mm
/vis/scene/add/text 10 0 0 cm 20 0 0 X
/vis/scene/add/text 0 10 0 cm 20 0 0 Y
/vis/scene/add/text 0 0 10 cm 20 0 0 Z
Visu must be after initialize
The bug still exist with CT image. But with visu before initialize and without the axis:
#/vis/scene/add/axes 0 0 0 500 mm
#/vis/scene/add/text 10 0 0 cm 20 0 0 X
#/vis/scene/add/text 0 10 0 cm 20 0 0 Y
#/vis/scene/add/text 0 0 10 cm 20 0 0 Z
Everything works
Describe the bug With Geant4 v11, the visualisation is not correct: eg: the world wireframes are not display
Desktop (please complete the following information):
Minimal example main.mac:
Expected behavior With Geant4 10.7, we can see the world wireframe:
With Geant4 v11.0, we cannot see the wireframe anymore:
Moreover with Geant4 v11.0, we can see a warning:
Additional context It seems the bug come from that function in Geant4: https://github.com/Geant4/geant4/blob/master/source/visualization/modeling/src/G4PhysicalVolumeModel.cc#L835
With Geant4 v11, this part of the code is new https://github.com/Geant4/geant4/blob/v11.0.0/source/visualization/modeling/src/G4PhysicalVolumeModel.cc#L837-L854 Before, with Geant4 v10.7, it was that part of the code that was used: https://github.com/Geant4/geant4/blob/v10.7.3/source/visualization/modeling/src/G4PhysicalVolumeModel.cc#L792-L841
Maybe the world is not added to G4PhysicalVolumeStore