I am using the method described in the #1 Geometry FAQ to find in what volume a specific point is located: #include "G4TransportationManager.hh" #include "G4Navigator.hh" G4ThreeVector myPoint = ....; G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking(); G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint); All works well unless myPoint is inside a volume that contains a parameterized volume, then I get an immediate Segmentation Fault. I want to point out that myPoint is not inside the parameterized volume, but its mother. If I run the program again without the parameterized volume it works fine.
Can you please specify in which conditions you're trying to locate the point ? Are you doing this during tracking time (i.e. while your simulation is going on) ?
I am attempting to do this while the simulation is idle. Before running /run/beamOn, I created a class that is run using a UI command. It scans the geometry at different points to get some information I need, if one of these points falls inside a volume with a parameterized volume it crashes, if not, everything works fine, and the program returns to idle.
Thanks. The problem is under investigation.
In order to have the navigator determine the proper instance of the parameterised volume to locate, it is necessary that the geometry is 'closed' before issueing the actual locate, i.e., the geometry optimisation must be loaded in memory. In your case, you are attemping to locate -before- issueing beamOn, which means that the geometry is still in 'open' state. Try to do either the following: - call "/run/initialize" before issueing the locate or: - add the following line in your code before the locate: G4GeometryManager::GetInstance()->CloseGeometry(); Be aware that, as expressed in the FAQ, it is advisable to adopt an alternative instance of the navigator for operations other than tracking; using the navigator for the tracking for performing explicit locations while tracking will cause the navigator to change its state and therefore invalidate the simulation and/or be exposed to unstable behavior and crashes.