Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BrentLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
// $Id: G4BrentLocator.cc 105904 2017-08-28 07:36:13Z gcosmo $
//
// Class G4BrentLocator implementation
//
@@ -624,7 +624,7 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
G4double Sub_len = (all_len-did_len)/(2.);
G4FieldTrack start = CurrentA_PointVelocity;
G4MagInt_Driver* integrDriver =
auto integrDriver =
GetChordFinderFor()->GetIntegrationDriver();
integrDriver->AccurateAdvance(start, Sub_len, GetEpsilonStepFor());
*ptrInterMedFT[depth] = start;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MultiLevelLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
// $Id: G4MultiLevelLocator.cc 107606 2017-11-27 09:39:04Z gcosmo $
//
// Class G4MultiLevelLocator implementation
//
@@ -560,7 +560,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
G4double Sub_len = (all_len-did_len)/(2.);
G4FieldTrack midPoint = CurrentA_PointVelocity;
G4MagInt_Driver* integrDriver
auto integrDriver
= GetChordFinderFor()->GetIntegrationDriver();
G4bool fullAdvance=
integrDriver->AccurateAdvance(midPoint, Sub_len, fiEpsilonStep);
@@ -593,8 +593,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
<< " at end (midpoint)= " << midPoint << G4endl;
G4cout << " Particle mass = " << midPoint.GetRestMass() << G4endl;
G4EquationOfMotion *equation
= integrDriver->GetStepper()->GetEquationOfMotion();
G4EquationOfMotion *equation = integrDriver->GetEquationOfMotion();
ReportFieldValue( CurrentA_PointVelocity, "start", equation );
ReportFieldValue( midPoint, "midPoint", equation );
G4cout << " Original Start = "
+11 -4
View File
@@ -45,6 +45,12 @@
#include "G4VoxelSafety.hh"
// Constant determining how precise normals should be (how close to unit
// vectors). If exceeded, warnings will be issued.
// Can be CLHEP::perMillion (its old default) for geometry checking.
//
static const G4double kToleranceNormalCheck = CLHEP::perThousand;
// ********************************************************************
// Constructor
// ********************************************************************
@@ -1332,6 +1338,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
G4ThreeVector ExitNormal(0.,0.,0.);
G4VSolid *currentSolid=0;
G4LogicalVolume *candidateLogical;
if ( fLastTriedStepComputation )
{
// use fLastLocatedPointLocal and next candidate volume
@@ -1447,7 +1454,7 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
G4VSolid* daughterSolid =fHistory.GetTopVolume()->GetLogicalVolume()
->GetSolid();
ExitNormal= -(daughterSolid->SurfaceNormal(fLastLocatedPointLocal));
if( std::fabs(ExitNormal.mag2()-1.0 ) > CLHEP::perMillion )
if( std::fabs(ExitNormal.mag2()-1.0 ) > kToleranceNormalCheck )
{
G4ExceptionDescription desc;
desc << " Parameters of solid: " << *daughterSolid
@@ -1593,7 +1600,7 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
//
globalNormal = fExitNormalGlobalFrame;
G4double normMag2 = globalNormal.mag2();
if( std::fabs ( normMag2 - 1.0 ) < perMillion ) // Value is good
if( std::fabs ( normMag2 - 1.0 ) < perThousand ) // was perMillion ) // Value is good
{
*pNormalCalculated = true; // ComputeStep always computes it if Exiting
// (fExiting==true)
@@ -1669,7 +1676,7 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
#endif
G4double localMag2= localNormal.mag2();
if( validNormal && (std::fabs(localMag2-1.0)) > CLHEP::perMillion )
if( validNormal && (std::fabs(localMag2-1.0)) > kToleranceNormalCheck )
{
G4ExceptionDescription edN;
edN.precision(10);
@@ -1713,7 +1720,7 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
// Check the value computed against fExitNormalGlobalFrame
G4ThreeVector diffNorm = globalNormAgn - fExitNormalGlobalFrame;
if( diffNorm.mag2() > perMillion*CLHEP::perMillion)
if( diffNorm.mag2() > kToleranceNormalCheck )
{
G4ExceptionDescription edDfn;
edDfn << "Found difference in normals in case of exiting mother "
+21 -17
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PathFinder.cc 103219 2017-03-22 11:30:15Z gcosmo $
// $Id: G4PathFinder.cc 107606 2017-11-27 09:39:04Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4PathFinder Implementation
@@ -274,7 +274,7 @@ G4PathFinder::ComputeStep( const G4FieldTrack &InitialFieldTrack,
else
{
const G4double checkTolerance = 1.0e-9;
if( proposedStepLength < fTrueMinStep * ( 1.0 + checkTolerance) ) // For 2nd+ geometry
if( proposedStepLength < fTrueMinStep * ( 1.0 - checkTolerance) ) // For 2nd+ geometry
{
std::ostringstream message;
message.precision( 12 );
@@ -462,19 +462,18 @@ void G4PathFinder::ReportMove( const G4ThreeVector& OldVector,
{
G4ThreeVector moveVec = ( NewVector - OldVector );
G4int prc= G4cerr.precision(12);
std::ostringstream message;
message.precision(16);
message << "Endpoint moved between value returned by ComputeStep()"
<< " and call to Locate(). " << G4endl
<< " Change of " << Quantity << " is "
<< moveVec.mag() / mm << " mm long" << G4endl
<< " and its vector is "
<< (1.0/mm) * moveVec << " mm " << G4endl
<< " Endpoint of ComputeStep() was " << OldVector << G4endl
<< " Endpoint of ComputeStep() was " << OldVector << G4endl
<< " and current position to locate is " << NewVector;
G4Exception("G4PathFinder::ReportMove()", "GeomNav1002",
JustWarning, message);
G4cerr.precision(prc);
}
void
@@ -484,16 +483,18 @@ G4PathFinder::Locate( const G4ThreeVector& position,
{
// Locate the point in each geometry
static const G4double movLenTol = 10*kCarTolerance*kCarTolerance;
std::vector<G4Navigator*>::iterator pNavIter=
fpTransportManager->GetActiveNavigatorsIterator();
G4ThreeVector lastEndPosition= fEndState.GetPosition();
G4ThreeVector moveVec = (position - lastEndPosition );
G4double moveLenSq= moveVec.mag2();
if( (!fNewTrack) && (!fRelocatedPoint)
&& ( moveLenSq> 10*kCarTolerance*kCarTolerance ) )
if( (!fNewTrack) && (!fRelocatedPoint) && ( moveLenSq > movLenTol ) )
{
ReportMove( position, lastEndPosition, "Position" );
ReportMove( lastEndPosition, position,
" (End) Position / G4PathFinder::Locate" );
}
fLastLocatedPosition= position;
@@ -670,8 +671,8 @@ void G4PathFinder::ReLocate( const G4ThreeVector& position )
if ( longMoveEnd && longMoveSaf
&& longMoveRevisedEnd && (moveMinusSafety>0.0) )
{
G4int oldPrec= G4cout.precision(9);
std::ostringstream message;
message.precision(9);
message << "ReLocation is further than end-safety value." << G4endl
<< " Moved from last endpoint by " << moveLenEndPosition
<< " compared to end safety (from preStep point) = "
@@ -703,7 +704,6 @@ void G4PathFinder::ReLocate( const G4ThreeVector& position )
ReportMove( lastEndPosition, position, "Position" );
G4Exception("G4PathFinder::ReLocate", "GeomNav0003",
FatalException, message);
G4cout.precision(oldPrec);
}
}
@@ -934,10 +934,7 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
initialDirection,
proposedStepLength,
safety );
minStep = std::min( step, minStep);
// TODO: consider whether/how to reduce the proposed step
// to the latest minStep value - to reduce calculations
// minStep = std::min( step, minStep); // OLD ==> can be 'logical' value, ie. kInfinity
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 0)
@@ -952,8 +949,14 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
}
#endif
}
fCurrentStepSize[num] = step;
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. )
// Save safety value, must be done for all geometries "together"
// (even if not recomputed using call to ComputeStep)
// since they share the fPreSafetyLocation
@@ -1002,9 +1005,11 @@ G4PathFinder::DoNextLinearStep( const G4FieldTrack &initialState,
#ifdef G4DEBUG_PATHFINDER
if( fVerboseLevel > 1 )
{
G4int oldPrec= G4cout.precision(14);
G4cout << "G4PathFinder::DoNextLinearStep : "
<< " initialPosition = " << initialPosition
<< " and endPosition = " << endPosition<< G4endl;
G4cout.precision(oldPrec);
}
#endif
@@ -1169,8 +1174,7 @@ G4PathFinder::DoNextCurvedStep( const G4FieldTrack &initialState,
G4EquationOfMotion* equationOfMotion =
(fpFieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetStepper())
->GetEquationOfMotion();
fpFieldPropagator->GetCurrentEquationOfMotion();
equationOfMotion->SetChargeMomentumMass( *(initialState.GetChargeState()),
initialState.GetMomentum().mag2(),
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.cc 99915 2016-10-11 09:24:43Z gcosmo $
// $Id: G4PropagatorInField.cc 105904 2017-08-28 07:36:13Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4PropagatorInField Implementation
@@ -726,7 +726,7 @@ G4int G4PropagatorInField::SetVerboseLevel( G4int level )
// Forward the verbose level 'reduced' to ChordFinder,
// MagIntegratorDriver ... ?
//
G4MagInt_Driver* integrDriver= GetChordFinder()->GetIntegrationDriver();
auto integrDriver= GetChordFinder()->GetIntegrationDriver();
integrDriver->SetVerboseLevel( fVerboseLevel - 2 );
G4cout << "Set Driver verbosity to " << fVerboseLevel - 2 << G4endl;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VIntersectionLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
// $Id: G4VIntersectionLocator.cc 105904 2017-08-28 07:36:13Z gcosmo $
//
// Class G4VIntersectionLocator implementation
//
@@ -195,7 +195,7 @@ ReEstimateEndpoint( const G4FieldTrack& CurrentStateA,
G4double ) // curveDist ) // NOT used
{
G4FieldTrack newEndPoint( CurrentStateA );
G4MagInt_Driver* integrDriver = GetChordFinderFor()->GetIntegrationDriver();
auto integrDriver = GetChordFinderFor()->GetIntegrationDriver();
G4FieldTrack retEndPoint( CurrentStateA );
G4bool goodAdvance;