Import Geant4 10.4.2 source tree

This commit is contained in:
Gabriele Cosmo
2018-05-25 16:18:53 +02:00
parent fe04dcb406
commit fe81a77428
233 changed files with 44301 additions and 105671 deletions
@@ -674,7 +674,7 @@ void G4Navigator::SetSavedState()
fSaveState.sEntering = fEntering;
fSaveState.spBlockedPhysicalVolume = fBlockedPhysicalVolume;
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo,
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo;
fSaveState.sLastStepWasZero = fLastStepWasZero;
@@ -704,7 +704,7 @@ void G4Navigator::RestoreSavedState()
fEntering = fSaveState.sEntering;
fBlockedPhysicalVolume = fSaveState.spBlockedPhysicalVolume;
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo,
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo;
fLastStepWasZero = fSaveState.sLastStepWasZero;
@@ -1394,7 +1394,9 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
// Entering the solid ==> opposite
//
ExitNormal = -nextSolidExitNormal;
// First flip ( ExitNormal = -nextSolidExitNormal; )
// and then rotate the the normal to the frame of the mother (current volume)
ExitNormal = MotherToDaughterTransform.Inverse().TransformAxis( -nextSolidExitNormal );
fCalculatedExitNormal= true;
}
else
+13 -14
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PathFinder.cc 108664 2018-02-27 07:20:25Z gcosmo $
// $Id: G4PathFinder.cc 110067 2018-05-15 09:20:12Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4PathFinder Implementation
@@ -79,7 +79,7 @@ G4PathFinder* G4PathFinder::GetInstanceIfExist()
G4PathFinder::G4PathFinder()
: fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.),
fFieldExertedForce(false),
fRelocatedPoint(true),
fRelocatedPoint(false),
fLastStepNo(-1), fCurrentStepNo(-1),
fVerboseLevel(0)
{
@@ -256,6 +256,7 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
//--------------
}
fLastStepNo= stepNo;
fRelocatedPoint= false;
#ifdef G4DEBUG_PATHFINDER
if ( (fNoGeometriesLimiting < 0)
@@ -335,7 +336,6 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
pNewSafety = fCurrentPreStepSafety[ navigatorNo ];
limitedStep = fLimitedStep[ navigatorNo ];
fRelocatedPoint= false;
possibleStep= std::min(proposedStepLength, fCurrentStepSize[ navigatorNo ]);
EndState = fEndState; // now corrected for smaller step, if needed
@@ -488,10 +488,11 @@ G4PathFinder::Locate( const G4ThreeVector& position,
std::vector<G4Navigator*>::iterator pNavIter=
fpTransportManager->GetActiveNavigatorsIterator();
G4ThreeVector lastEndPosition= fEndState.GetPosition();
G4ThreeVector moveVec = (position - lastEndPosition );
G4ThreeVector lastEndPosition= fRelocatedPoint ?
fLastLocatedPosition : fEndState.GetPosition();
G4ThreeVector moveVec = ( position - lastEndPosition );
G4double moveLenSq= moveVec.mag2();
if( (!fNewTrack) && (!fRelocatedPoint) && ( moveLenSq > movLenTol ) )
if( (!fNewTrack) && ( moveLenSq > movLenTol ) )
{
ReportMove( lastEndPosition, position,
" (End) Position / G4PathFinder::Locate" );
@@ -739,7 +740,7 @@ void G4PathFinder::ReLocate( const G4ThreeVector& position )
}
fLastLocatedPosition= position;
fRelocatedPoint= false;
fRelocatedPoint= true;
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 2 )
@@ -826,8 +827,8 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
{
std::vector<G4Navigator*>::iterator pNavigatorIter;
G4double safety= 0.0, step=0.0;
G4double minSafety= kInfinity, minStep;
G4double minSafety= kInfinity, minStep= kInfinity;
const G4int IdTransport= 0; // Id of Mass Navigator !!
G4int num=0;
@@ -933,9 +934,9 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
step= (*pNavigatorIter)->ComputeStep( initialPosition,
initialDirection,
proposedStepLength,
safety );
// minStep = std::min( step, minStep); // OLD ==> can be 'logical' value, ie. kInfinity
safety );
minStep = std::min( step, minStep); // OLD ==> can be 'logical' value, ie. kInfinity
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 0)
{
@@ -951,8 +952,6 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
}
fCurrentStepSize[num] = step; // Raw value - can be kInfinity
step = std::min( step, proposedStepLength ); // Now a physical value (not kInf)
minStep = std::min( step, minStep); // Minimum of physical values !!
// TODO: consider whether/how to reduce the proposed step
// to the latest minStep value - to reduce calculations.
// ( If so, much change 1st minimum above. )
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4SafetyHelper.cc 81060 2014-05-20 09:12:39Z gcosmo $
// $Id: G4SafetyHelper.cc 110067 2018-05-15 09:20:12Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4SafetyHelper Implementation
@@ -114,7 +114,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector &position,
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double maxLength )
{
G4double newSafety;
// Only recompute (calling Navigator/PathFinder) if 'position'
// is *not* the safety location and has moved 'significantly'
//
@@ -125,19 +125,23 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double
{
// Safety for mass geometry
newSafety = fpMassNavigator->ComputeSafety(position, maxLength, true);
// Only store a 'true' safety - one that was not restricted by maxLength
if( newSafety < maxLength )
{
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
}
else
{
// Safety for all geometries
newSafety = fpPathFinder->ComputeSafety(position);
newSafety = fpPathFinder->ComputeSafety(position);
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
// We can only store a 'true' safety - one that was not restricted by maxLength
if( newSafety < maxLength )
{
fLastSafety= newSafety;
fLastSafetyPosition = position;
}
}
else
{
@@ -146,26 +150,28 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position, G4double
// G4double moveLength = 0;
// if( moveLengthSq > 0.0 ) { moveLength= std::sqrt(moveLengthSq); }
newSafety = fLastSafety; // -moveLength;
}
}
return newSafety;
}
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector &newPosition )
{
// G4cout << " G4SafetyHelper::ReLocateWithinVolume called at " << newPosition << G4endl;
#ifdef G4VERBOSE
if( fVerbose > 0 ) {
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 << " Safety Sphere: Radius = " << fLastSafety;
ed << " Center = " << fLastSafetyPosition << G4endl;
ed << " New Location : Move = " << moveVec.mag2();
ed << " New Location : Move = " << moveVec.mag();
ed << " Position = " << newPosition << G4endl;
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning,
"Unsafe Move> Asked to relocate beyond 'Safety sphere'.");
G4Exception("G4SafetyHelper::ReLocateWithinVolume", "GeomNav999", JustWarning, ed);
}
}
#endif