Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+12
View File
@@ -16,6 +16,18 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
October 15, 2020 - G.Cosmo (geomnav-V10-06-08)
--------------------------
- G4ReplicaNavigation: relaxed condition for step correction in ComputeStep().
October 13, 2020 - E.Tcherniaev (geomnav-V10-06-07)
-------------------------------
- Added G4GeomTestVolume::TestOverlapInTree().
September 8, 2020 - G.Cosmo (geomnav-V10-06-06)
---------------------------
- Fixed Coverity defects in G4RegularNavigation for uninitialised data.
June 15, 2020 - G.Cosmo (geomnav-V10-06-05)
-----------------------
- Fixed Coverity defects in G4LocatorChangeRecord and some code cleanup.
@@ -64,6 +64,10 @@ class G4GeomTestVolume
void SetErrorsThreshold(G4int max);
// Get/Set maximum number of errors to report (default set to 1)
void TestOverlapInTree() const;
// Check overlaps in the volume tree without
// dublication in identical logical volumes
void TestRecursiveOverlap( G4int sLevel=0, G4int depth=-1 );
// Activate overlaps check, propagating recursively to the daughters,
// with possibility of specifying the initial level in the volume tree
@@ -124,18 +124,16 @@ class G4RegularNavigation
G4double kCarTolerance;
G4double fMinStep;
G4bool fLastStepWasZero;
G4bool fLastStepWasZero = false;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4int fNumberZeroSteps;
G4int fNumberZeroSteps = 0;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4int fActionThreshold_NoZeroSteps;
G4int fActionThreshold_NoZeroSteps = 2;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps;
G4int fAbandonThreshold_NoZeroSteps = 25;
// After this many failed/zero steps, abandon track
G4int fNoStepsAllowed;
G4int fNoStepsAllowed = 10000;
// Maximum number of steps a track can travel skipping voxels (if there are more, track is assumed to be stuck and it is killed)
G4bool fWarnPush;
// Send warning message that a stuck particle has been pushed
};
#endif
@@ -28,6 +28,7 @@
// Author: G.Cosmo, CERN
// --------------------------------------------------------------------
#include <queue>
#include <set>
#include "G4GeomTestVolume.hh"
@@ -116,6 +117,55 @@ void G4GeomTestVolume::SetErrorsThreshold(G4int max)
maxErr = max;
}
//
// Test overlap in tree
//
void G4GeomTestVolume::TestOverlapInTree() const
{
std::queue<G4VPhysicalVolume*> volumes;
std::set<G4LogicalVolume*> checked;
volumes.push(target);
while (!volumes.empty())
{
G4VPhysicalVolume* current = volumes.front();
volumes.pop();
// check overlaps for daughters
G4LogicalVolume* logical = current->GetLogicalVolume();
G4int ndaughters = logical->GetNoDaughters();
for (G4int i=0; i<ndaughters; ++i)
{
G4VPhysicalVolume* daughter = logical->GetDaughter(i);
daughter->CheckOverlaps(resolution, tolerance, verbosity, maxErr);
}
// append the queue of volumes
G4LogicalVolume* previousLogical = nullptr;
for (G4int i=0; i<ndaughters; ++i)
{
G4VPhysicalVolume* daughter = logical->GetDaughter(i);
G4LogicalVolume* daughterLogical = daughter->GetLogicalVolume();
if (daughterLogical->GetNoDaughters() == 0) continue;
G4bool found = (daughterLogical == previousLogical);
if (!found) found = (checked.find(daughterLogical) != checked.cend());
if (!found)
{
checked.emplace(daughterLogical);
previousLogical = daughterLogical;
volumes.push(daughter);
}
else
{
if (verbosity)
G4cout << "Checking overlaps in tree of volume " << daughter->GetName()
<< " (" << daughterLogical->GetSolid()->GetEntityType() << ")"
<< " is omitted, to avoid duplication" << G4endl;
}
}
}
}
//
// TestRecursiveOverlap
//
@@ -95,7 +95,7 @@ G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
pchkCmd = new G4UIcmdWithABool( "/geometry/navigator/push_notify", this );
pchkCmd->SetGuidance( "Set navigator verbosity push notifications." );
pchkCmd->SetGuidance( "This allows to disable/re-enable verbosity in" );
pchkCmd->SetGuidance( "This allows one to disable/re-enable verbosity in" );
pchkCmd->SetGuidance( "navigation, when tracks may get stuck and require" );
pchkCmd->SetGuidance( "one artificial push along the direction by the" );
pchkCmd->SetGuidance( "navigator. Notification is active by default." );
@@ -43,11 +43,6 @@ G4RegularNavigation::G4RegularNavigation()
{
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fMinStep = 101*kCarTolerance;
fActionThreshold_NoZeroSteps = 2;
fAbandonThreshold_NoZeroSteps = 25;
fNoStepsAllowed = 10000;
fWarnPush = true;
}
@@ -226,7 +221,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
if( fLastStepWasZero )
{
++fNumberZeroSteps;
//#ifdef G4DEBUG_NAVIGATION
#ifdef G4DEBUG_NAVIGATION
if( fNumberZeroSteps > 1 )
{
G4ThreeVector pGlobalpoint = history.GetTransform(ide)
@@ -238,34 +233,29 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
<< ", Step= " << newStep
<< G4endl;
}
//#endif
#endif
if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
{
// Act to recover this stuck track. Pushing it along direction
//
newStep = std::min(101*kCarTolerance*std::pow(10,fNumberZeroSteps-2),0.1);
#ifdef G4VERBOSE
if (fWarnPush)
{
G4ThreeVector pGlobalpoint = history.GetTransform(ide)
G4ThreeVector pGlobalpoint = history.GetTransform(ide)
.InverseTransformPoint(localPoint);
std::ostringstream message;
message.precision(16);
message << "Track stuck or not moving." << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< "- at point " << pGlobalpoint
<< " (local point " << localPoint << ")" << G4endl
<< " local direction: " << localDirection
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << newStep << " mm ...";
G4Exception("G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
"GeomRegNav1002",
JustWarning,
message,
"Potential overlap in geometry!");
}
std::ostringstream message;
message.precision(16);
message << "Track stuck or not moving." << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< "- at point " << pGlobalpoint
<< " (local point " << localPoint << ")" << G4endl
<< " local direction: " << localDirection
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << newStep << " mm ...";
G4Exception("G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
"GeomRegNav1002", JustWarning, message,
"Potential overlap in geometry!");
#endif
}
if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
@@ -923,8 +923,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
// Requires further investigation and eventually reimplementation of
// LevelLocate() to take into account point and direction ...
//
if ( ( (ourStep<fMinStep) && (sampleSafety<halfkCarTolerance) )
&& ( repLogical->GetSolid()->Inside(localPoint)==kSurface ) )
if( ourStep<fMinStep )
{
ourStep = 100*kCarTolerance;
}
@@ -877,7 +877,7 @@ G4VIntersectionLocator::ReportImmediateHit( const char* MethodName,
{
numStill = 0;
}
G4cout << " Occured: " << ++occurredOnTop;
G4cout << " Occurred: " << ++occurredOnTop;
G4cout << " out of total calls= " << numCalls;
G4cout << G4endl;
lastStart = StartPosition;