Problem 481

Summary: G4RunManager::ResetNavigator() and G4GeometryMessenger::ResetNavigator() may be unsafe in G4.5.0
Product: Geant4 Reporter: Daniel.Strul
Component: geometry/managementAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: other   
Hardware: All   
OS: All   

Description Daniel.Strul 2003-04-25 07:23:22 CEST
The new command G4RunManager::ResetNavigator() is available only in Idle state.
Similarly, the already existing command "/geometry/navigator/reset" is now
available only in the Idle state. However, in this state, the geometry is not
closed yet. Consequently, if this command is used between two runs where the
geometry has changed, the navigation is done for the new run's geometry, but
still uses the voxellisation of the previous run. As a result, the resetting is
incorrect and may lead to errors or crashes: I've observed such crashes when a
geometry using replicas is modified between runs. Making this commands available
only in the "geometry-closed" may be safer.
BTW, I work around this problem by resetting the geometry at the beginning of
each run using a customised run-manager:
void MyRunManager::RunInitialization()
{
  G4RunManager::RunInitialization();
  G4ThreeVector center(0,0,0);
  G4TransportationManager::GetTransportationManager()
      ->GetNavigatorForTracking()
      ->LocateGlobalPointAndSetup(center,0,false);
}

This insures that the navigator is reset at the proper time, with the proper
voxellisation. Integrating this operation at the end of RunInitialisation() in
this manner may solve the problem for all Geant4 users with detectors moving
between runs.


Best regards,
Daniel Strul (OpenGATE collaboration)
Comment 1 Gabriele Cosmo 2003-04-25 10:39:59 CEST
This behavior was fixed in the patch issued to release 5.0 in February, now
the command itself checks for the geometry to be closed and in case will close
it. You can find on the Hypernews/Geometry forum a couple of items discussing
this issue, examples are also provided in the toolkit on how to modify the
geometry between runs...
We anyhow plan to better simplify this ability in a future version by
enhancing the run-manager. Thanks for your report anyhow.