Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -23,12 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// GEANT4 tag $ Name: $
//
// class G4SafetyHelper Implementation
//
// Original author: John Apostolakis, 2006
//
// --------------------------------------------------------------------
#include "G4SafetyHelper.hh"
@@ -39,25 +36,13 @@
#include "globals.hh"
G4SafetyHelper::G4SafetyHelper()
: fUseParallelGeometries(false), // By default, one geometry only
fFirstCall(true),
fVerbose(0),
fLastSafetyPosition(0.0,0.0,0.0),
fLastSafety(0.0)
// fRecomputeFactor(0.0)
: fLastSafetyPosition(0.0,0.0,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()
//
fpMassNavigator= 0;
fMassNavigatorId= -1;
}
void G4SafetyHelper::InitialiseNavigator()
{
fpPathFinder= G4PathFinder::GetInstance();
fpPathFinder = G4PathFinder::GetInstance();
G4TransportationManager* pTransportMgr=
G4TransportationManager::GetTransportationManager();
@@ -67,10 +52,10 @@ void G4SafetyHelper::InitialiseNavigator()
// Check
//
G4VPhysicalVolume* worldPV = fpMassNavigator->GetWorldVolume();
if( worldPV == 0 )
if( worldPV == nullptr )
{
G4Exception("G4SafetyHelper::InitialiseNavigator",
"InvalidNavigatorWorld", FatalException,
"GeomNav0003", FatalException,
"Found that existing tracking Navigator has NULL world");
}
@@ -90,8 +75,8 @@ G4SafetyHelper::~G4SafetyHelper()
}
G4double
G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
const G4ThreeVector &direction,
G4SafetyHelper::CheckNextStep(const G4ThreeVector& position,
const G4ThreeVector& direction,
const G4double currentMaxStep,
G4double& newSafety )
{
@@ -110,7 +95,8 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
return linstep;
}
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double maxLength )
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position,
G4double maxLength )
{
G4double newSafety;
@@ -154,23 +140,26 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double
return newSafety;
}
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector& newPosition )
{
// G4cout << " G4SafetyHelper::ReLocateWithinVolume called at " << newPosition << G4endl;
#ifdef G4VERBOSE
if( fVerbose > 0 ) {
// There is an opportunity - and need - to check whether the proposed move is safe
G4ThreeVector moveVec= newPosition - fLastSafetyPosition;
if( fVerbose > 0 )
{
// There is an opportunity - and need - to check whether
// the proposed move is safe
G4ThreeVector moveVec = newPosition - fLastSafetyPosition;
if( moveVec.mag2() > sqr(fLastSafety) )
{
// A problem exists - we are proposing to move outside 'Safety Sphere'
G4ExceptionDescription ed;
ed << "Unsafe Move> Asked to relocate beyond 'Safety sphere'. Details: " << G4endl;
ed << "Unsafe Move> Asked to relocate beyond 'Safety sphere'. Details: "
<< G4endl;
ed << " Safety Sphere: Radius = " << fLastSafety;
ed << " Center = " << fLastSafetyPosition << G4endl;
ed << " New Location : Move = " << moveVec.mag();
ed << " Position = " << newPosition << G4endl;
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning, ed);
G4Exception("G4SafetyHelper::ReLocateWithinVolume",
"GeomNav1001", JustWarning, ed);
}
}
#endif
@@ -188,7 +177,7 @@ void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
void G4SafetyHelper::Locate( const G4ThreeVector& newPosition,
const G4ThreeVector& newDirection)
{
if( !fUseParallelGeometries)
if( !fUseParallelGeometries )
{
fpMassNavigator->LocateGlobalPointAndSetup(newPosition, &newDirection,
true, false);
@@ -200,33 +189,28 @@ void G4SafetyHelper::Locate( const G4ThreeVector& newPosition,
}
G4bool G4SafetyHelper::RecheckDistanceToCurrentBoundary(
const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pDirection,
const G4ThreeVector& pGlobalPoint,
const G4ThreeVector& pDirection,
const G4double aProposedMove,
G4double *prDistance,
G4double *prNewSafety) const
G4double* prDistance,
G4double* prNewSafety) const
{
G4bool retval;
if( !fUseParallelGeometries)
if( !fUseParallelGeometries )
{
retval= fpMassNavigator->RecheckDistanceToCurrentBoundary(
pGlobalPoint,
pDirection,
aProposedMove,
prDistance,
prNewSafety);
retval = fpMassNavigator->RecheckDistanceToCurrentBoundary(pGlobalPoint,
pDirection,
aProposedMove,
prDistance,
prNewSafety);
}
else
{
//G4Exception("G4Navigator::RecheckDistanceToCurrentBoundary()", "GeomNav0001",
// JustWarning, "Method NOT Available (yet) in case of Multiple Geometries (where PathFinder is involved.).");
retval= fpPathFinder->RecheckDistanceToCurrentBoundary(
pGlobalPoint,
pDirection,
aProposedMove,
prDistance,
prNewSafety);
retval = fpPathFinder->RecheckDistanceToCurrentBoundary(pGlobalPoint,
pDirection,
aProposedMove,
prDistance,
prNewSafety);
}
return retval;
}