Problem 973 - Segmentation Fault when using LocateGlobalPointAndSetup(myPoint) if point is inside a volume that contains a parameterized volume
Summary: Segmentation Fault when using LocateGlobalPointAndSetup(myPoint) if point is ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/navigation (show other problems)
Version: 9.0
Hardware: PC Linux
: P5 normal
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2007-09-24 17:21 CEST by Ioannis Sechopoulos
Modified: 2007-09-26 15:12 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Ioannis Sechopoulos 2007-09-24 17:21:57 CEST
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.
Comment 1 Gabriele Cosmo 2007-09-25 16:22:55 CEST
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) ?
Comment 2 Ioannis Sechopoulos 2007-09-25 16:30:20 CEST
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.
Comment 3 Gabriele Cosmo 2007-09-25 17:33:21 CEST
Thanks. The problem is under investigation.
Comment 4 Gabriele Cosmo 2007-09-26 15:12:42 CEST
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.