Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BrentLocator.cc 96458 2016-04-15 10:15:24Z gcosmo $
// $Id: G4BrentLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
//
// Class G4BrentLocator implementation
//
@@ -218,14 +218,15 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
//
G4FieldTrack SubStart_PointVelocity = CurveStartPointVelocity;
do
do // Loop checking, 07.10.2016, J.Apostolakis
{
G4int substep_no_p = 0;
G4bool sub_final_section = false; // the same as final_section,
// but for 'sub_section'
SubStart_PointVelocity = CurrentA_PointVelocity;
do // REPEAT param
{
do // Loop checking, 07.10.2016, J.Apostolakis
{ // REPEAT param
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GeomTestVolume.cc 73253 2013-08-22 13:24:02Z gcosmo $
// $Id: G4GeomTestVolume.cc 101727 2016-11-23 08:49:05Z gcosmo $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -156,15 +156,14 @@ void G4GeomTestVolume::TestRecursiveOverlap( G4int slevel, G4int depth )
for( iDaughter=0; iDaughter<nDaughter; ++iDaughter )
{
G4VPhysicalVolume *daughter = logical->GetDaughter(iDaughter);
const G4LogicalVolume *daughterLogical =
daughter->GetLogicalVolume();
//
// Tested already?
//
std::pair<std::set<const G4LogicalVolume *>::iterator, G4bool>
there = tested.insert(daughterLogical);
if (!there.second) continue;
// const G4LogicalVolume *daughterLogical =
// daughter->GetLogicalVolume();
// std::pair<std::set<const G4LogicalVolume *>::iterator, G4bool>
// there = tested.insert(daughterLogical);
// if (!there.second) continue;
//
// Recurse
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MultiLevelLocator.cc 96458 2016-04-15 10:15:24Z gcosmo $
// $Id: G4MultiLevelLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
//
// Class G4MultiLevelLocator implementation
//
@@ -220,14 +220,15 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
//
G4FieldTrack SubStart_PointVelocity = CurveStartPointVelocity;
do
do // Loop checking, 07.10.2016, J.Apostolakis
{
unsigned int substep_no_p = 0;
G4bool sub_final_section = false; // the same as final_section,
// but for 'sub_section'
SubStart_PointVelocity = CurrentA_PointVelocity;
do // REPEAT param
{
SubStart_PointVelocity = CurrentA_PointVelocity;
do // Loop checking, 07.10.2016, J.Apostolakis
{ // REPEAT param
G4ThreeVector Point_A = CurrentA_PointVelocity.GetPosition();
G4ThreeVector Point_B = CurrentB_PointVelocity.GetPosition();
@@ -653,7 +654,7 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
unsigned int levelPops=0;
G4bool unfinished = Second_half;
while ( unfinished && (depth>0) )
while ( unfinished && (depth>0) ) // Loop checking, 07.10.2016, J. Apostolakis
{
// Second part of curve (InterMed[depth],Intermed[depth-1]))
// On the depth-1 level normally we are on the 'second_half'
+29 -10
View File
@@ -286,7 +286,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
// o containing volume found
//
while (notKnownContained)
while (notKnownContained) // Loop checking, 07.10.2016, J.Apostolakis
{
if ( fHistory.GetTopVolumeType()!=kReplica )
{
@@ -538,7 +538,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
}
#endif
}
} while (noResult);
} while (noResult); // Loop checking, 07.10.2016, J.Apostolakis
fLastLocatedPointLocal = localPoint;
@@ -1007,8 +1007,10 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl
<< "- at point " << pGlobalpoint
<< " (local point " << newLocalPoint << ")" << G4endl
<< " direction: " << pDirection
<< " (local direction: " << localDirection << ")." << G4endl
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << Step << " mm ...";
@@ -1031,7 +1033,10 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << ".";
#ifdef G4VERBOSE
motherPhysical->CheckOverlaps(5000, false);
if ( fWarnPush )
{
motherPhysical->CheckOverlaps(5000, false);
}
#endif
G4Exception("G4Navigator::ComputeStep()", "GeomNav0003",
EventMustBeAborted, message);
@@ -1666,16 +1671,26 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
if( validNormal && (std::fabs(localMag2-1.0)) > CLHEP::perMillion )
{
G4ExceptionDescription edN;
edN.precision(10);
edN << "G4Navigator::GetGlobalExitNormal: "
<< " Using Local Normal - from call to GetLocalExitNormalAndCheck. "
<< G4endl
<< " Local Exit Normal : " << " || = " << std::sqrt(localMag2)
<< " vec = " << localNormal << G4endl
<< " Global Exit Normal : " << " || = " << globalNormal.mag()
<< " vec = " << globalNormal << G4endl;
edN << " Calculated It = " << fCalculatedExitNormal << G4endl;
<< " vec = " << globalNormal << G4endl
<< " Global point: " << IntersectPointGlobal << G4endl;
edN << " Calculated It = " << fCalculatedExitNormal << G4endl
<< " Volume: " << fHistory.GetTopVolume()->GetName() << G4endl;
#ifdef G4VERBOSE
G4LogicalVolume* candLog = fHistory.GetTopVolume()->GetLogicalVolume();
if ( candLog )
{
edN << " Solid: " << candLog->GetSolid()->GetName()
<< ", Type: " << candLog->GetSolid()->GetEntityType() << G4endl
<< *candLog->GetSolid();
}
#endif
G4Exception("G4Navigator::GetGlobalExitNormal()",
"GeomNav0003",JustWarning, edN,
"Value obtained from new local *solid* is incorrect.");
@@ -1711,7 +1726,11 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
}
}
#endif
// Synchronise stored global exit normal as possibly re-computed here
//
fExitNormalGlobalFrame = globalNormal;
return globalNormal;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhantomParameterisation.cc 66356 2012-12-18 09:02:32Z gcosmo $
// $Id: G4PhantomParameterisation.cc 101807 2016-11-30 13:42:28Z gunter $
// GEANT4 tag $ Name:$
//
// class G4PhantomParameterisation implementation
@@ -53,7 +53,7 @@ G4PhantomParameterisation::G4PhantomParameterisation()
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
}
//------------------------------------------------------------------
G4PhantomParameterisation::~G4PhantomParameterisation()
{
@@ -156,7 +156,8 @@ GetMaterialIndex( size_t nx, size_t ny, size_t nz ) const
//------------------------------------------------------------------
G4Material* G4PhantomParameterisation::GetMaterial( size_t nx, size_t ny, size_t nz) const
G4Material*
G4PhantomParameterisation::GetMaterial( size_t nx, size_t ny, size_t nz) const
{
return fMaterials[GetMaterialIndex(nx,ny,nz)];
}
@@ -241,7 +242,11 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
<< " - is outside container solid: "
<< fContainerSolid->GetName() << G4endl;
G4Exception("G4PhantomParameterisation::GetReplicaNo()", "GeomNav0003",
FatalErrorInArgument, message);
JustWarning, message);
G4cerr << " DIFFERENCE WITH PHANTOM WALLS X: "
<< std::fabs(localPoint.x()) - fContainerWallX
<< " Y: " << std::fabs(localPoint.y()) - fContainerWallY
<< " Z: " << std::fabs(localPoint.z()) - fContainerWallZ << G4endl;
}
// Check the voxel numbers corresponding to localPoint
@@ -256,23 +261,23 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
// Add +kCarTolerance so that they are first placed on voxel N, and then
// if the direction is negative substract 1
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/(fVoxelHalfX*2.);
G4double fx = (localPoint.x()+fContainerWallX)/(fVoxelHalfX*2.);
G4int nx = G4int(fx);
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/(fVoxelHalfY*2.);
G4double fy = (localPoint.y()+fContainerWallY)/(fVoxelHalfY*2.);
G4int ny = G4int(fy);
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/(fVoxelHalfZ*2.);
G4double fz = (localPoint.z()+fContainerWallZ)/(fVoxelHalfZ*2.);
G4int nz = G4int(fz);
// If it is on the surface side, check the direction: if direction is
// negative place it on the previous voxel (if direction is positive it is
// already in the next voxel...).
// negative place it in the previous voxel (if direction is positive it is
// already in the next voxel).
// Correct also cases where n = -1 or n = fNoVoxel. It is always traced to be
// due to multiple scattering: track is entering a voxel but multiple
// scattering changes the angle towards outside
//
if( fx - nx < kCarTolerance/fVoxelHalfX )
if( fx - nx < kCarTolerance*fContainerWallX )
{
if( localDir.x() < 0 )
{
@@ -289,7 +294,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
}
}
}
if( fy - ny < kCarTolerance/fVoxelHalfY )
if( fy - ny < kCarTolerance*fContainerWallY )
{
if( localDir.y() < 0 )
{
@@ -306,7 +311,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
}
}
}
if( fz - nz < kCarTolerance/fVoxelHalfZ )
if( fz - nz < kCarTolerance*fContainerWallZ )
{
if( localDir.z() < 0 )
{
@@ -377,7 +382,9 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
}
// CheckCopyNo( copyNo ); // not needed, just for debugging code
// G4cout << " COPYNO " << copyNo << " " << nx << " " << ny << " " << nz
// << G4endl; //GDEB
return copyNo;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PropagatorInField.cc 94380 2015-11-13 10:14:39Z gcosmo $
// $Id: G4PropagatorInField.cc 99915 2016-10-11 09:24:43Z gcosmo $
// GEANT4 tag $ Name: $
//
// class G4PropagatorInField Implementation
@@ -200,10 +200,6 @@ G4PropagatorInField::ComputeStep(
// For the next call, the field manager must again be set
fSetFieldMgr= false;
// Values for Intersection Locator has to be updated on each call for the
// case that CurrentFieldManager has changed from the one of previous step
RefreshIntersectionLocator();
G4FieldTrack CurrentState(pFieldTrack);
G4FieldTrack OriginalState = CurrentState;
@@ -225,11 +221,16 @@ G4PropagatorInField::ComputeStep(
epsilon = fCurrentFieldMgr->GetDeltaOneStep() / CurrentProposedStepLength;
// G4double raw_epsilon= epsilon;
G4double epsilonMin= fCurrentFieldMgr->GetMinimumEpsilonStep();
G4double epsilonMax= fCurrentFieldMgr->GetMaximumEpsilonStep();;
G4double epsilonMax= fCurrentFieldMgr->GetMaximumEpsilonStep();
if( epsilon < epsilonMin ) epsilon = epsilonMin;
if( epsilon > epsilonMax ) epsilon = epsilonMax;
SetEpsilonStep( epsilon );
// Values for Intersection Locator has to be updated on each call for the
// case that CurrentFieldManager has changed from the one of previous step
RefreshIntersectionLocator();
// G4cout << "G4PiF: Epsilon of current step - raw= " << raw_epsilon
// << " final= " << epsilon << G4endl;
@@ -297,7 +298,7 @@ G4PropagatorInField::ComputeStep(
fLast_ProposedStepLength = CurrentProposedStepLength;
G4int do_loop_count = 0;
do
do // Loop checking, 07.10.2016, J.Apostolakis
{
G4FieldTrack SubStepStartState = CurrentState;
G4ThreeVector SubStartPoint = CurrentState.GetPosition();
@@ -23,7 +23,7 @@
// ********************************************************************
//
//
// $Id: G4ReplicaNavigation.cc 96458 2016-04-15 10:15:24Z gcosmo $
// $Id: G4ReplicaNavigation.cc 100372 2016-10-19 10:37:52Z gcosmo $
//
//
// class G4ReplicaNavigation Implementation
@@ -355,7 +355,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
compS = -sinSPhi*localDirection.x()+cosSPhi*localDirection.y();
compE = -sinSPhi*localDirection.x()-cosSPhi*localDirection.y();
if ( (pDistS<=0)&&(pDistE<=0) )
if ( (pDistS<=halfkCarTolerance)&&(pDistE<=halfkCarTolerance) )
{
// Inside both phi *full* planes
//
@@ -402,14 +402,14 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
}
}
}
else if ( (pDistS>=0)&&(pDistE>=0) )
else if ( (pDistS>halfkCarTolerance)&&(pDistE>halfkCarTolerance) )
{
// Outside both *full* phi planes
// if towards both >=0 then once inside will remain inside
//
Dist = ((compS>=0)&&(compE>=0)) ? kInfinity : 0;
}
else if ( (pDistS>0)&&(pDistE<0) )
else if ( (pDistS>halfkCarTolerance)&&(pDistE<=halfkCarTolerance) )
{
// Outside full starting plane, inside full ending plane
//
@@ -431,7 +431,7 @@ G4ReplicaNavigation::DistanceToOutPhi(const G4ThreeVector &localPoint,
}
else
{
// Must be (pDistS<0)&&(pDistE>0)
// Must be (pDistS<=halfkCarTolerance)&&(pDistE>halfkCarTolerance)
// Inside full starting plane, outside full ending plane
//
if ( compE>=0 )
@@ -615,24 +615,30 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector &localPoint,
if( sideR != G4ExitNormal::kNull ) // if ((side == kRMax) || (side==kRMin))
{
// Note: returned vector not explicitly normalised
// (divided by fRMax for unit vector)
G4double xi, yi;
xi = localPoint.x() + srd*localDirection.x() ;
yi = localPoint.y() + srd*localDirection.y() ;
G4ThreeVector normalR = G4ThreeVector(xi,yi,0.0);
// Note: returned vector not explicitly normalised
// (divided by fRMax for unit vector)
G4double xi, yi;
xi = localPoint.x() + srd*localDirection.x();
yi = localPoint.y() + srd*localDirection.y();
G4ThreeVector normalR = G4ThreeVector(xi,yi,0.0);
if( sideR == G4ExitNormal::kRMax ){
normalR *= 1.0/rmax;
}else{
normalR *= (-1.0)/rmin;
}
foundNormal.exitNormal= normalR;
foundNormal.calculated= true;
foundNormal.validConvex = (sideR == G4ExitNormal::kRMax);
foundNormal.exitSide = sideR;
}else{
foundNormal.calculated= false;
if( sideR == G4ExitNormal::kRMax )
{
normalR *= 1.0/rmax;
}
else
{
normalR *= (-1.0)/rmin;
}
foundNormal.exitNormal= normalR;
foundNormal.calculated= true;
foundNormal.validConvex = (sideR == G4ExitNormal::kRMax);
foundNormal.exitSide = sideR;
}
else
{
foundNormal.calculated= false;
}
return srd;
@@ -827,9 +833,10 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector &globalPoint,
}
}
const G4int secondDepth= topDepth;
depth = secondDepth;
while ( history.GetVolumeType(depth)==kReplica )
depth = secondDepth;
// Loop checking, 07.10.2016, J.Apostolakis -- Need to add: assert(depth>0)
while ( history.GetVolumeType(depth)==kReplica )
{
const G4AffineTransform& GlobalToLocal= history.GetTransform(depth);
repPoint = GlobalToLocal.TransformPoint(globalPoint);
@@ -1179,8 +1186,10 @@ G4ReplicaNavigation::ComputeSafety(const G4ThreeVector &globalPoint,
}
depth = history.GetDepth()-1;
// Loop checking, 07.10.2016, J.Apostolakis -- need to add: assert(depth>0)
while ( history.GetVolumeType(depth)==kReplica )
{
{
repPoint = history.GetTransform(depth).TransformPoint(globalPoint);
sampleSafety = DistanceToOut(history.GetVolume(depth),
history.GetReplicaNo(depth),
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VIntersectionLocator.cc 93482 2015-10-23 08:25:26Z gcosmo $
// $Id: G4VIntersectionLocator.cc 99915 2016-10-11 09:24:43Z gcosmo $
//
// Class G4VIntersectionLocator implementation
//
@@ -204,7 +204,8 @@ ReEstimateEndpoint( const G4FieldTrack& CurrentStateA,
G4double endCurveLen= EstimatedEndStateB.GetCurveLength();
do
do // Loop checking, 07.10.2016, J.Apostolakis
{
G4double currentCurveLen= newEndPoint.GetCurveLength();
G4double advanceLength= endCurveLen - currentCurveLen ;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.cc 96743 2016-05-03 08:01:33Z gcosmo $
// $Id: G4VoxelNavigation.cc 99915 2016-10-11 09:24:43Z gcosmo $
//
//
// class G4VoxelNavigation Implementation
@@ -450,7 +450,8 @@ G4VoxelNavigation::ComputeVoxelSafety(const G4ThreeVector& localPoint) const
// Compute isotropic safety to boundaries of previous levels
// [NOT to collected boundaries]
//
// Loop checking, 07.10.2016, J.Apostolakis
while ( (localVoxelDepth>0) && (voxelSafety>0) )
{
localVoxelDepth--;