Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4SafetyHelper.cc,v 1.12 2007/05/09 12:57:31 japost Exp $
|
||||
// $Id: G4SafetyHelper.cc,v 1.15 2007/11/14 10:04:21 gcosmo Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4SafetyHelper Implementation
|
||||
@@ -39,17 +39,18 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
G4SafetyHelper::G4SafetyHelper() :
|
||||
fUseParallelGeometries(false), // By default, one geometry only
|
||||
fFirstCall(true),
|
||||
fLastSafetyPosition(0.0,0.0,0.0),
|
||||
fLastSafety(0.0),
|
||||
fRecomputeFactor(0.2)
|
||||
G4SafetyHelper::G4SafetyHelper()
|
||||
: fUseParallelGeometries(false), // By default, one geometry only
|
||||
fFirstCall(true),
|
||||
fLastSafetyPosition(0.0,0.0,0.0),
|
||||
fLastSafety(0.0),
|
||||
fRecomputeFactor(0.0)
|
||||
{
|
||||
fpPathFinder= 0; // Cannot initialise this yet - a loop results
|
||||
|
||||
// Initialization of the Navigator pointer is postponed, and must
|
||||
// be undertaken by another class calling InitialiseHelper()
|
||||
// be undertaken by another class calling InitialiseHelper()
|
||||
//
|
||||
fpMassNavigator= 0;
|
||||
fMassNavigatorId= -1;
|
||||
}
|
||||
@@ -64,6 +65,7 @@ void G4SafetyHelper::InitialiseNavigator()
|
||||
fpMassNavigator = pTransportMgr->GetNavigatorForTracking();
|
||||
|
||||
// Check
|
||||
//
|
||||
G4VPhysicalVolume* worldPV = fpMassNavigator->GetWorldVolume();
|
||||
if( worldPV == 0 )
|
||||
{
|
||||
@@ -84,7 +86,8 @@ void G4SafetyHelper::InitialiseHelper()
|
||||
}
|
||||
|
||||
G4SafetyHelper::~G4SafetyHelper()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
G4double
|
||||
G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
|
||||
@@ -103,6 +106,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
|
||||
|
||||
// TO-DO: Can replace this with a call to PathFinder
|
||||
// giving id of Mass Geometry --> this avoid doing the work twice
|
||||
|
||||
return linstep;
|
||||
}
|
||||
|
||||
@@ -110,10 +114,13 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
{
|
||||
G4double newSafety;
|
||||
|
||||
// return last value if position is not significantly changed
|
||||
// Only recompute (calling Navigator/PathFinder) if 'position'
|
||||
// is *not* the safety location and has moved 'significantly'
|
||||
//
|
||||
G4double moveLen = (position-fLastSafetyPosition).mag();
|
||||
if(moveLen >= fRecomputeFactor*fLastSafety)
|
||||
G4double moveLengthSq = (position-fLastSafetyPosition).mag2();
|
||||
G4double safeDistance = fRecomputeFactor*fLastSafety;
|
||||
if( (moveLengthSq > 0.0 )
|
||||
&& (moveLengthSq >= safeDistance*safeDistance))
|
||||
{
|
||||
fLastSafetyPosition = position;
|
||||
|
||||
@@ -131,7 +138,14 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position )
|
||||
}
|
||||
else
|
||||
{
|
||||
newSafety = fLastSafety-moveLen;
|
||||
// return last value if position is not significantly changed
|
||||
//
|
||||
G4double moveLength = 0;
|
||||
if( moveLengthSq > 0.0 )
|
||||
{
|
||||
moveLength= std::sqrt(moveLengthSq);
|
||||
}
|
||||
newSafety = fLastSafety-moveLength;
|
||||
}
|
||||
return newSafety;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user