Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
-38
View File
@@ -1,38 +0,0 @@
# --------------------------------------------------------------------
# GNUmakefile for geometry/volumes library. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------------
name := G4navigation
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include
ifdef G4DEBUG_NAVIGATION
CPPFLAGS += -DG4DEBUG_NAVIGATION
endif
ifdef G4DEBUG_FIELD
CPPFLAGS += -DG4DEBUG_FIELD
endif
ifdef G4DEBUG_PATHFINDER
CPPFLAGS += -DG4DEBUG_PATHFINDER
endif
ifdef PATHFINDER_OPTIMISATION
CPPFLAGS += -DPATHFINDER_OPTIMISATION
endif
include $(G4INSTALL)/config/common.gmk
+15 -1
View File
@@ -5,8 +5,22 @@ which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-06-13 Gabriele Cosmo (geomnav-V11-01-01)
- Applied clang-tidy fixes (readability, modernization, performance, ...).
## 2023-01-31 John Apostolakis (geomnav-V11-01-00)
- G4PropagatorInField: Added parameters for big steps.
New parameter 'MaxStepSizeMultiplier' - enables changing
(eg needed to reduce costly unnecessary integration in QSS)
New parameter 'MinBigDistance' used as minimum distance in
case of long steps. Could be adapted to size of world.
Default values also changed:
'LargestAcceptableDistance' = 100 * meter ( from 1000* meter )
'MaxStepSizeMultiplier' = 0.1 ( from 100 ).
## 2022-11-23 John Apostolakis (geomnav-V11-00-09)
- G4MultiLevelLocator: refresh candidate intersection point when needed
- G4MultiLevelLocator: refresh candidate intersection point when needed.
## 2022-11-10 John Apostolakis (geomnav-V11-00-08)
- Improved diagnostic message in G4MultiLevelLocator - they missed to print
@@ -41,7 +41,7 @@ CheckPointOnSurface( const G4VSolid* sampleSolid,
EInside insideSolid = sampleSolid->Inside(localPoint);
if ( insideSolid!=kOutside )
{
G4bool checkDirection = locatedOnEdge && (globalDirection!=0);
G4bool checkDirection = locatedOnEdge && (globalDirection!=nullptr);
if( (insideSolid==kSurface) && checkDirection)
{
// We are probably located on an edge.
@@ -109,7 +109,7 @@ CheckPointExiting( const G4VSolid* sampleSolid,
const G4ThreeVector* globalDirection,
const G4AffineTransform& sampleTransform )
{
if( !globalDirection ) { return false; }
if( globalDirection == nullptr ) { return false; }
G4ThreeVector localDirection, sampleNormal;
G4bool exiting = false;
@@ -50,17 +50,17 @@ class G4BrentLocator : public G4VIntersectionLocator
G4BrentLocator(G4Navigator *theNavigator);
// Constructor
~G4BrentLocator();
~G4BrentLocator() override;
// Default destructor
G4bool EstimateIntersectionPoint(
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin); // In/Out
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin) override; // In/Out
// If such an intersection exists, this function calculates the
// intersection point of the true path of the particle with the surface
// of the current volume (or of one of its daughters).
@@ -46,23 +46,23 @@ class G4ErrorPropagationNavigator : public G4Navigator
public: // with description
G4ErrorPropagationNavigator();
~G4ErrorPropagationNavigator();
~G4ErrorPropagationNavigator() override;
G4double ComputeStep (const G4ThreeVector &pGlobalPoint,
const G4ThreeVector &pDirection,
const G4double pCurrentProposedStepLength,
G4double &pNewSafety);
G4double &pNewSafety) override;
// Calls the navigation in the detector geometry and then checks
// if the distance to surface is smaller than the proposed step
G4double ComputeSafety(const G4ThreeVector &globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = true);
const G4bool keepState = true) override;
// Calls the navigation in the detector geometry and then checks
// if the distance to surface is smaller than the proposed safety
G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point,
G4bool* valid);
G4bool* valid) override;
// Return Exit Surface Normal and validity too. Can only be called if
// the Navigator's last Step has crossed a volume geometrical boundary.
// Normal points out of the volume exited and/or into the volume entered.
@@ -55,20 +55,20 @@ class G4GeometryMessenger : public G4UImessenger
public: // with description
G4GeometryMessenger(G4TransportationManager* tman);
~G4GeometryMessenger();
~G4GeometryMessenger() override;
// Constructor and destructor
void SetNewValue( G4UIcommand* command, G4String newValues );
G4String GetCurrentValue( G4UIcommand* command );
void SetNewValue( G4UIcommand* command, G4String newValues ) override;
G4String GetCurrentValue( G4UIcommand* command ) override;
private:
void Init();
void CheckGeometry();
void ResetNavigator();
void SetVerbosity(G4String newValue);
void SetCheckMode(G4String newValue);
void SetPushFlag(G4String newValue);
void SetVerbosity(const G4String& newValue);
void SetCheckMode(const G4String& newValue);
void SetPushFlag(const G4String& newValue);
void RecursiveOverlapTest();
G4UIdirectory *geodir, *navdir, *testdir;
@@ -56,9 +56,9 @@ class G4GlobalMagFieldMessenger : public G4UImessenger
public: // with description
G4GlobalMagFieldMessenger(const G4ThreeVector& value = G4ThreeVector());
virtual ~G4GlobalMagFieldMessenger();
~G4GlobalMagFieldMessenger() override;
virtual void SetNewValue(G4UIcommand*, G4String);
void SetNewValue(G4UIcommand*, G4String) override;
void SetFieldValue(const G4ThreeVector& value);
G4ThreeVector GetFieldValue() const;
@@ -43,7 +43,7 @@ class G4LocatorChangeLogger : public std::vector<G4LocatorChangeRecord>
{
public:
G4LocatorChangeLogger( const std::string name ) : fName(name) {}
G4LocatorChangeLogger( const std::string& name ) : fName(name) {}
void AddRecord( G4LocatorChangeRecord && chngRecord );
void AddRecord( const G4LocatorChangeRecord & chngRecord );
@@ -50,17 +50,17 @@ class G4MultiLevelLocator : public G4VIntersectionLocator
G4MultiLevelLocator(G4Navigator *theNavigator);
// Constructor
~G4MultiLevelLocator();
~G4MultiLevelLocator() override;
// Default destructor
G4bool EstimateIntersectionPoint(
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin); // In/Out
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin) override; // In/Out
// If such an intersection exists, this function calculates the
// intersection point of the true path of the particle with the surface
// of the current volume (or of one of its daughters).
@@ -60,13 +60,13 @@ class G4MultiNavigator : public G4Navigator
G4MultiNavigator();
// Constructor - initialisers and setup.
~G4MultiNavigator();
~G4MultiNavigator() override;
// Destructor. No actions.
G4double ComputeStep( const G4ThreeVector& pGlobalPoint,
const G4ThreeVector& pDirection,
const G4double pCurrentProposedStepLength,
G4double& pNewSafety );
G4double& pNewSafety ) override;
// Return the distance to the next boundary of any geometry
G4double ObtainFinalStep( G4int navigatorId,
@@ -77,13 +77,13 @@ class G4MultiNavigator : public G4Navigator
void PrepareNavigators();
// Find which geometries are registered for this particles, and keep info
void PrepareNewTrack( const G4ThreeVector position,
void PrepareNewTrack( const G4ThreeVector& position,
const G4ThreeVector direction );
// Prepare Navigators and locate
G4VPhysicalVolume* ResetHierarchyAndLocate( const G4ThreeVector& point,
const G4ThreeVector& direction,
const G4TouchableHistory& h );
const G4ThreeVector& direction,
const G4TouchableHistory& h ) override;
// Reset the geometrical hierarchy for all geometries.
// Use the touchable history for the first (mass) geometry.
// Return the volume in the first (mass) geometry.
@@ -91,35 +91,35 @@ class G4MultiNavigator : public G4Navigator
// Important Note: In order to call this the geometries MUST be closed.
G4VPhysicalVolume* LocateGlobalPointAndSetup( const G4ThreeVector& point,
const G4ThreeVector* direction = nullptr,
const G4bool pRelativeSearch = true,
const G4bool ignoreDirection = true);
const G4ThreeVector* direction = nullptr,
const G4bool pRelativeSearch = true,
const G4bool ignoreDirection = true) override;
// Locate in all geometries.
// Return the volume in the first (mass) geometry
// Maintain vector of other volumes, to be returned separately
//
// Important Note: In order to call this the geometry MUST be closed.
void LocateGlobalPointWithinVolume( const G4ThreeVector& position );
void LocateGlobalPointWithinVolume( const G4ThreeVector& position ) override;
// Relocate in all geometries for point that has not changed volume
// (ie is within safety in all geometries or is distance less that
// along the direction of a computed step.
G4double ComputeSafety( const G4ThreeVector& globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = false );
const G4bool keepState = false ) override;
// Calculate the isotropic distance to the nearest boundary
// in any geometry from the specified point in the global coordinate
// system. The geometry must be closed.
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const override;
// Returns a reference counted handle to a touchable history.
virtual G4ThreeVector GetLocalExitNormal( G4bool* obtained ); // const
virtual G4ThreeVector GetLocalExitNormalAndCheck( const G4ThreeVector &E_Pt,
G4bool* obtained ); // const
virtual G4ThreeVector GetGlobalExitNormal( const G4ThreeVector &E_Pt,
G4bool* obtained ); // const
G4ThreeVector GetLocalExitNormal( G4bool* obtained ) override; // const
G4ThreeVector GetLocalExitNormalAndCheck( const G4ThreeVector &E_Pt,
G4bool* obtained ) override; // const
G4ThreeVector GetGlobalExitNormal( const G4ThreeVector &E_Pt,
G4bool* obtained ) override; // const
// Return Exit Surface Normal and validity too.
// Can only be called if the Navigator's last Step either
// - has just crossed a volume geometrical boundary and relocated, or
@@ -141,10 +141,10 @@ class G4MultiNavigator : public G4Navigator
protected: // with description
void ResetState();
void ResetState() override;
// Utility method to reset the navigator state machine.
void SetupHierarchy();
void SetupHierarchy() override;
// Renavigate & reset hierarchy described by current history
// o Reset volumes
// o Recompute transforms and/or solids of replicated/parameterised
@@ -91,7 +91,7 @@ void G4Navigator::SetWorldVolume(G4VPhysicalVolume* pWorld)
FatalException, "Volume must be centered on the origin.");
}
const G4RotationMatrix* rm = pWorld->GetRotation();
if ( rm && (!rm->isIdentity()) )
if ( (rm != nullptr) && (!rm->isIdentity()) )
{
G4Exception ("G4Navigator::SetWorldVolume()", "GeomNav0002",
FatalException, "Volume must not be rotated.");
@@ -326,7 +326,7 @@ void G4Navigator::LocateGlobalPointAndUpdateTouchable(
const G4bool RelativeSearch )
{
G4VPhysicalVolume* pPhysVol;
pPhysVol = LocateGlobalPointAndSetup( position, 0, RelativeSearch);
pPhysVol = LocateGlobalPointAndSetup( position, nullptr, RelativeSearch);
touchableToUpdate->UpdateYourself( pPhysVol, &fHistory );
}
@@ -353,7 +353,7 @@ void G4Navigator::SetVerboseLevel(G4int level)
fparamNav.SetVerboseLevel(level);
freplicaNav.SetVerboseLevel(level);
fregularNav.SetVerboseLevel(level);
if (fpExternalNav != nullptr) fpExternalNav->SetVerboseLevel(level);
if (fpExternalNav != nullptr) { fpExternalNav->SetVerboseLevel(level); }
}
// ********************************************************************
@@ -411,7 +411,7 @@ void G4Navigator::CheckMode(G4bool mode)
fparamNav.CheckMode(mode);
freplicaNav.CheckMode(mode);
fregularNav.CheckMode(mode);
if (fpExternalNav != nullptr) fpExternalNav->CheckMode(mode);
if (fpExternalNav != nullptr) { fpExternalNav->CheckMode(mode); }
}
// ********************************************************************
@@ -445,7 +445,7 @@ inline
G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const
{
G4int severity = 0, noZeros = fNumberZeroSteps;
if( noZeroSteps )
if( noZeroSteps != nullptr )
{
*noZeroSteps = fNumberZeroSteps;
}
@@ -522,7 +522,7 @@ void G4Navigator::SetExternalNavigation(G4VExternalNavigation* externalNav)
inline
G4Navigator* G4Navigator::Clone() const
{
G4Navigator* clone_nav = new G4Navigator();
auto clone_nav = new G4Navigator();
clone_nav->SetWorldVolume(fTopPhysical);
if( fpExternalNav != nullptr )
{
@@ -88,10 +88,7 @@ G4NormalNavigation::LevelLocate( G4NavigationHistory& history,
found = true;
break;
}
else
{
history.BackLevel();
}
history.BackLevel();
}
}
}
@@ -56,7 +56,7 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
public: // with description
G4ParameterisedNavigation();
~G4ParameterisedNavigation();
~G4ParameterisedNavigation() override;
inline G4SmartVoxelNode* ParamVoxelLocate( G4SmartVoxelHeader* pHead,
const G4ThreeVector& localPoint );
@@ -67,7 +67,7 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
const G4ThreeVector& globalPoint,
const G4ThreeVector* globalDirection,
const G4bool pLocatedOnEdge,
G4ThreeVector& localPoint );
G4ThreeVector& localPoint ) override;
G4double ComputeStep( const G4ThreeVector& globalPoint,
const G4ThreeVector& globalDirection,
@@ -79,11 +79,11 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
G4bool& exiting,
G4bool& entering,
G4VPhysicalVolume *(*pBlockedPhysical),
G4int& blockedReplicaNo );
G4int& blockedReplicaNo ) override;
G4double ComputeSafety( const G4ThreeVector& localPoint,
const G4NavigationHistory& history,
const G4double pProposedMaxLength=DBL_MAX );
const G4double pProposedMaxLength=DBL_MAX ) override;
private:
@@ -36,9 +36,10 @@
#ifndef G4PartialPhantomParameterisation_HH
#define G4PartialPhantomParameterisation_HH
#include <vector>
#include <set>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "G4Types.hh"
#include "G4PhantomParameterisation.hh"
@@ -54,16 +55,16 @@ class G4PartialPhantomParameterisation : public G4PhantomParameterisation
public: // with description
G4PartialPhantomParameterisation();
~G4PartialPhantomParameterisation();
~G4PartialPhantomParameterisation() override;
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const;
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override;
G4Material* ComputeMaterial(const G4int repNo,
G4VPhysicalVolume *currentVol,
const G4VTouchable *parentTouch = nullptr);
const G4VTouchable *parentTouch = nullptr) override;
G4int GetReplicaNo( const G4ThreeVector& localPoint,
const G4ThreeVector& localDir );
const G4ThreeVector& localDir ) override;
// Get the voxel number corresponding to the point in the container
// frame. Use 'localDir' to avoid precision problems at the surfaces.
@@ -77,12 +78,12 @@ class G4PartialPhantomParameterisation : public G4PhantomParameterisation
void SetFilledIDs( std::multimap<G4int,G4int> fid )
{
fFilledIDs = fid;
fFilledIDs = std::move(fid);
}
void SetFilledMins( std::map< G4int, std::map<G4int,G4int> > fmins )
{
fFilledMins = fmins;
fFilledMins = std::move(fmins);
}
void BuildContainerWalls();
@@ -50,9 +50,8 @@
class G4TransportationManager;
class G4Navigator;
#include "G4TouchableHandle.hh"
#include "G4FieldTrack.hh"
#include "G4MultiNavigator.hh"
#include "G4TouchableHandle.hh"
class G4PropagatorInField;
@@ -70,43 +70,43 @@ class G4PhantomParameterisation : public G4VPVParameterisation
public:
G4PhantomParameterisation();
~G4PhantomParameterisation();
~G4PhantomParameterisation() override;
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const;
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override;
virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *) override;
virtual G4Material* ComputeMaterial(const G4int repNo,
G4Material* ComputeMaterial(const G4int repNo,
G4VPhysicalVolume* currentVol,
const G4VTouchable* parentTouch=nullptr);
const G4VTouchable* parentTouch=nullptr) override;
// Dummy declarations ...
void ComputeDimensions (G4Box &, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Tubs&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Trd&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Trap&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Cons&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Orb&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Sphere&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Ellipsoid&,const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Torus&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Para&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Hype&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Polycone&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void ComputeDimensions (G4Polyhedra&, const G4int,
const G4VPhysicalVolume*) const {}
const G4VPhysicalVolume*) const override {}
void BuildContainerSolid( G4VPhysicalVolume* pPhysicalVol );
void BuildContainerSolid( G4VSolid* pMotherSolid );
@@ -123,8 +123,18 @@ class G4PropagatorInField
// Their new behaviour is to change the values for the global field
// manager
inline void SetLargestAcceptableStep( G4double newBigDist );
inline G4double GetLargestAcceptableStep();
void SetLargestAcceptableStep( G4double newBigDist );
G4double GetLargestAcceptableStep();
void ResetLargestAcceptableStep();
// Obtain / change the size of the largest step the method will undertake
// Reset method uses the world volume's
G4double GetMaxStepSizeMultiplier();
void SetMaxStepSizeMultiplier(G4double vm);
// Control extra Multiplier parameter for limiting long steps.
G4double GetMinBigDistance();
void SetMinBigDistance(G4double val);
// Control minimum 'directional' distance in case of too-large step
void SetTrajectoryFilter(G4VCurvedTrajectoryFilter* filter);
// Set the filter that examines & stores 'intermediate'
@@ -210,7 +220,7 @@ class G4PropagatorInField
void ReportLoopingParticle( G4int count, G4double StepTaken,
G4double stepRequest, const char* methodName,
G4ThreeVector momentumVec,
const G4ThreeVector& momentumVec,
G4VPhysicalVolume* physVol);
void ReportStuckParticle(G4int noZeroSteps, G4double proposedStep,
G4double lastTriedStep, G4VPhysicalVolume* physVol);
@@ -238,9 +248,15 @@ class G4PropagatorInField
G4int fAbandonThreshold_NoZeroSteps = 50; // Threshold # to abandon
G4double fZeroStepThreshold = 0.0;
// Threshold *length* for counting of tiny or 'zero' steps
// Parameters related to handling of very large steps which
// occur typically in large volumes with vacuum or very thin gas
G4double fLargestAcceptableStep;
// Maximum size of a step - for optimization (and to avoid problems)
G4double fMaxStepSizeMultiplier = 3;
// Multiplier for directional exit distance used as extra long-step limit
G4double fMinBigDistance= 100. ; // * CLHEP::mm
// Minimum distance added to directional exit distance
// ** End of PARAMETERS -----
G4double kCarTolerance;
@@ -204,25 +204,6 @@ void G4PropagatorInField::SetMaximumEpsilonStep( G4double newEpsMax )
fDetectorFieldMgr->SetMaximumEpsilonStep( newEpsMax );
}
// ------------------------------------------------------------------------
//
inline
void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist )
{
if( fLargestAcceptableStep>0.0 )
{
fLargestAcceptableStep = newBigDist;
}
}
// ------------------------------------------------------------------------
//
inline
G4double G4PropagatorInField::GetLargestAcceptableStep()
{
return fLargestAcceptableStep;
}
// ------------------------------------------------------------------------
//
inline
@@ -238,18 +219,28 @@ void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct,
G4int noHarsh,
G4int noAbandon )
{
if( noAct>0 )
if( noAct>0 )
{
fActionThreshold_NoZeroSteps = noAct;
}
if( noHarsh > fActionThreshold_NoZeroSteps )
{
fSevereActionThreshold_NoZeroSteps = noHarsh;
}
else
{
fSevereActionThreshold_NoZeroSteps = 2*(fActionThreshold_NoZeroSteps+1);
}
if( noAbandon > fSevereActionThreshold_NoZeroSteps+5 )
{
fAbandonThreshold_NoZeroSteps = noAbandon;
}
else
{
fAbandonThreshold_NoZeroSteps = 2*(fSevereActionThreshold_NoZeroSteps+3);
}
}
// ------------------------------------------------------------------------
@@ -313,7 +304,7 @@ SetNavigatorForPropagating( G4Navigator* SimpleOrMultiNavigator )
if (SimpleOrMultiNavigator != nullptr)
{
fNavigator = SimpleOrMultiNavigator;
if( fIntersectionLocator )
if( fIntersectionLocator != nullptr )
{
fIntersectionLocator->SetNavigatorFor( SimpleOrMultiNavigator );
}
@@ -442,7 +433,7 @@ void G4PropagatorInField::SetIterationsToIncreaseChordDistance(G4int numIters)
if(numIters <= 0)
{
// Disables relaxation
if( fVerboseLevel ){
if( fVerboseLevel != 0 ){
G4cout << "G4PropagatorInField: Turned OFF the Relaxation of chord "
<< "finder as iteration threshold = " << numIters
<< " is not positive." << G4endl;
@@ -117,7 +117,7 @@ class G4RegularNavigation
private:
G4int fverbose = false;
G4int fverbose = 0;
G4bool fcheck = false;
G4NormalNavigation* fnormalNav = nullptr;
@@ -68,7 +68,7 @@ struct G4ExitNormal
public:
G4ExitNormal(G4ThreeVector norm = G4ThreeVector(0.,0.,0.),
G4ExitNormal(const G4ThreeVector& norm = G4ThreeVector(0.,0.,0.),
G4bool calc = false,
G4bool valid= false,
ESide side = kNull )
@@ -162,7 +162,7 @@ class G4ReplicaNavigation
const G4int replicaNo,
G4ExitNormal& foundNormal ) const;
inline void SetPhiTransformation( const G4double ang,
G4VPhysicalVolume* pVol=0 ) const;
G4VPhysicalVolume* pVol=nullptr ) const;
private:
// Invariants - unaltered during navigation
@@ -66,7 +66,7 @@ G4ReplicaNavigation::VoxelLocate( const G4SmartVoxelHeader* pHead,
break;
case kPhi:
coord = localPoint.phi();
if ( (coord<0) && (coord<targetHeaderMin) ) coord += CLHEP::twopi;
if ( (coord<0) && (coord<targetHeaderMin) ) { coord += CLHEP::twopi; }
break;
case kRadial3D:
default:
@@ -105,17 +105,25 @@ G4ReplicaNavigation::VoxelLocate( const G4SmartVoxelHeader* pHead,
if ( (targetHeaderAxis==kPhi)
&& (targetHeaderMin==0) && (targetHeaderMax==CLHEP::twopi) )
{
if ( targetNodeNo<0 )
if ( targetNodeNo<0 )
{
targetNodeNo = targetHeaderNoSlices-1;
}
else if ( targetNodeNo>=targetHeaderNoSlices )
{
targetNodeNo = 0;
}
}
else
{
if( targetNodeNo<0 )
{
targetNodeNo = 0;
}
else if ( targetNodeNo>=targetHeaderNoSlices )
{
targetNodeNo = targetHeaderNoSlices-1;
}
}
}
}
@@ -49,17 +49,17 @@ class G4SimpleLocator : public G4VIntersectionLocator
G4SimpleLocator(G4Navigator* aNavigator);
// Constructor
~G4SimpleLocator();
~G4SimpleLocator() override;
// Default destructor
G4bool EstimateIntersectionPoint(
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin); // In/Out
const G4FieldTrack& curveStartPointTangent, // A
const G4FieldTrack& curveEndPointTangent, // B
const G4ThreeVector& trialPoint, // E
G4FieldTrack& intersectPointTangent, // Output
G4bool& recalculatedEndPoint, // Out
G4double& fPreviousSafety, // In/Out
G4ThreeVector& fPreviousSftOrigin) override; // In/Out
// If such an intersection exists, this function calculates the
// intersection point of the true path of the particle with the surface
// of the current volume (or of one of its daughters).
@@ -108,9 +108,8 @@ inline
std::vector<G4Navigator*>::iterator
G4TransportationManager::GetActiveNavigatorsIterator()
{
std::vector<G4Navigator*>::iterator iterator
= std::vector<G4Navigator*>::iterator(fActiveNavigators.begin());
return iterator;
auto iter = std::vector<G4Navigator*>::iterator(fActiveNavigators.begin());
return iter;
}
// ----------------------------------------------------------------------------
@@ -133,9 +132,8 @@ inline
std::vector<G4VPhysicalVolume*>::iterator
G4TransportationManager::GetWorldsIterator()
{
std::vector<G4VPhysicalVolume*>::iterator iterator
= std::vector<G4VPhysicalVolume*>::iterator(fWorlds.begin());
return iterator;
auto iter = std::vector<G4VPhysicalVolume*>::iterator(fWorlds.begin());
return iter;
}
// ----------------------------------------------------------------------------
@@ -160,7 +160,7 @@ G4VIntersectionLocator::IntersectChord( const G4ThreeVector& StartPointA,
IntersectionPoint = StartPointA + LinearStepLength * ChordAB_Dir;
}
}
if( ptrCalledNavigator )
if( ptrCalledNavigator != nullptr )
{
*ptrCalledNavigator = CalledNavigator;
}
@@ -118,7 +118,7 @@ G4VoxelNavigation::LevelLocate( G4NavigationHistory& history,
targetVoxelNode = VoxelLocate(targetVoxelHeader,localPoint);
targetNoDaughters = G4int(targetVoxelNode->GetNoContained());
if ( targetNoDaughters==0 ) return false;
if ( targetNoDaughters==0 ) { return false; }
//
// Search daughters in volume
@@ -147,10 +147,7 @@ G4VoxelNavigation::LevelLocate( G4NavigationHistory& history,
localPoint = samplePoint;
return true;
}
else
{
history.BackLevel();
}
history.BackLevel();
}
}
return false;
@@ -42,17 +42,17 @@ G4BrentLocator::G4BrentLocator(G4Navigator *theNavigator)
// Initialise the array of Pointers [max_depth+1] to do this
G4ThreeVector zeroV(0.0,0.0,0.0);
for (auto idepth=0; idepth<max_depth+1; ++idepth )
for (auto & idepth : ptrInterMedFT)
{
ptrInterMedFT[ idepth ] = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
idepth = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
}
}
G4BrentLocator::~G4BrentLocator()
{
for ( auto idepth=0; idepth<max_depth+1; ++idepth )
for (auto & idepth : ptrInterMedFT)
{
delete ptrInterMedFT[idepth];
delete idepth;
}
}
@@ -186,9 +186,9 @@ G4bool G4BrentLocator::EstimateIntersectionPoint(
//Final_section boolean store
G4bool fin_section_depth[max_depth];
for (auto idepth=0; idepth<max_depth; ++idepth )
for (bool & idepth : fin_section_depth)
{
fin_section_depth[idepth] = true;
idepth = true;
}
// 'SubStartPoint' is needed to calculate the length of the divided step
@@ -54,9 +54,7 @@ G4DrawVoxels::G4DrawVoxels()
// Destructor
//
G4DrawVoxels::~G4DrawVoxels()
{
}
G4DrawVoxels::~G4DrawVoxels() = default;
// Methods that allow changing colors of the drawing
//
@@ -184,7 +182,7 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
G4PlacedPolyhedronList*
G4DrawVoxels::CreatePlacedPolyhedra(const G4LogicalVolume* lv) const
{
G4PlacedPolyhedronList* pplist = new G4PlacedPolyhedronList;
auto pplist = new G4PlacedPolyhedronList;
G4VoxelLimits limits; // Working object for recursive call.
ComputeVoxelPolyhedra(lv,lv->GetVoxelHeader(),limits,pplist);
return pplist; //it s up to the calling program to destroy it then!
@@ -218,10 +216,10 @@ void G4DrawVoxels::DrawVoxels(const G4LogicalVolume* lv) const
{
// Drawing the bounding and voxel polyhedra for the pVolume
//
for (size_t i=0; i<pplist->size(); ++i)
for (const auto & i : *pplist)
{
pVVisManager->Draw((*pplist)[i].GetPolyhedron(),
(*pplist)[i].GetTransform()*transf3D);
pVVisManager->Draw(i.GetPolyhedron(),
i.GetTransform()*transf3D);
}
}
else
@@ -42,15 +42,12 @@
//-------------------------------------------------------------------
G4ErrorPropagationNavigator::G4ErrorPropagationNavigator()
: G4Navigator()
{
}
//-------------------------------------------------------------------
G4ErrorPropagationNavigator::~G4ErrorPropagationNavigator()
{
}
G4ErrorPropagationNavigator::~G4ErrorPropagationNavigator() = default;
//-------------------------------------------------------------------
@@ -208,9 +205,8 @@ GetGlobalExitNormal( const G4ThreeVector& point, G4bool* valid )
break;
case G4ErrorTarget_PlaneSurface:
case G4ErrorTarget_CylindricalSurface:
const G4ErrorSurfaceTarget* surfaceTarget=
static_cast<const G4ErrorSurfaceTarget*>(target);
normal = surfaceTarget->GetTangentPlane(point).normal().unit();
const auto surfTarget= static_cast<const G4ErrorSurfaceTarget*>(target);
normal = surfTarget->GetTangentPlane(point).normal().unit();
*valid = true;
break;
@@ -146,9 +146,9 @@ void G4GeomTestVolume::TestOverlapInTree() const
{
G4VPhysicalVolume* daughter = logical->GetDaughter(i);
G4LogicalVolume* daughterLogical = daughter->GetLogicalVolume();
if (daughterLogical->GetNoDaughters() == 0) continue;
if (daughterLogical->GetNoDaughters() == 0) { continue; }
G4bool found = (daughterLogical == previousLogical);
if (!found) found = (checked.find(daughterLogical) != checked.cend());
if (!found) { found = (checked.find(daughterLogical) != checked.cend()); }
if (!found)
{
checked.emplace(daughterLogical);
@@ -158,9 +158,11 @@ void G4GeomTestVolume::TestOverlapInTree() const
else
{
if (verbosity)
{
G4cout << "Checking overlaps in tree of volume " << daughter->GetName()
<< " (" << daughterLogical->GetSolid()->GetEntityType() << ")"
<< " is omitted, to avoid duplication" << G4endl;
}
}
}
}
@@ -175,9 +177,9 @@ void G4GeomTestVolume::TestRecursiveOverlap( G4int slevel, G4int depth )
// If not depth specified (i.e. set to -1), visit the whole tree.
// If requested initial level of depth is not zero, visit from beginning
//
if (depth == 0) return;
if (depth != -1) depth--;
if (slevel != 0) slevel--;
if (depth == 0) { return; }
if (depth != -1) { depth--; }
if (slevel != 0) { slevel--; }
//
// As long as we reached the requested
@@ -194,7 +196,7 @@ void G4GeomTestVolume::TestRecursiveOverlap( G4int slevel, G4int depth )
std::set<const G4LogicalVolume *> tested;
const G4LogicalVolume *logical = target->GetLogicalVolume();
G4int nDaughter = (G4int)logical->GetNoDaughters();
auto nDaughter = (G4int)logical->GetNoDaughters();
for( auto iDaughter=0; iDaughter<nDaughter; ++iDaughter )
{
G4VPhysicalVolume *daughter = logical->GetDaughter(iDaughter);
@@ -317,14 +317,14 @@ G4GeometryMessenger::ResetNavigator()
//
G4ThreeVector pt(0,0,0);
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
navigator->LocateGlobalPointAndSetup(pt,0,false);
navigator->LocateGlobalPointAndSetup(pt,nullptr,false);
}
//
// Set navigator verbosity
//
void
G4GeometryMessenger::SetVerbosity(G4String input)
G4GeometryMessenger::SetVerbosity(const G4String& input)
{
G4int level = verbCmd->GetNewIntValue(input);
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
@@ -335,7 +335,7 @@ G4GeometryMessenger::SetVerbosity(G4String input)
// Set navigator mode
//
void
G4GeometryMessenger::SetCheckMode(G4String input)
G4GeometryMessenger::SetCheckMode(const G4String& input)
{
G4bool mode = chkCmd->GetNewBoolValue(input);
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
@@ -348,7 +348,7 @@ G4GeometryMessenger::SetCheckMode(G4String input)
// Set navigator verbosity for push notifications
//
void
G4GeometryMessenger::SetPushFlag(G4String input)
G4GeometryMessenger::SetPushFlag(const G4String& input)
{
G4bool mode = pchkCmd->GetNewBoolValue(input);
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
@@ -43,7 +43,6 @@
//______________________________________________________________________________
G4GlobalMagFieldMessenger::G4GlobalMagFieldMessenger(const G4ThreeVector& value)
: G4UImessenger()
{
fDirectory = new G4UIdirectory("/globalField/");
fDirectory->SetGuidance("Global uniform magnetic field UI commands");
@@ -91,8 +90,8 @@ void G4GlobalMagFieldMessenger::SetField(const G4ThreeVector& value,
// Inactivate field if its value is zero
if ( value == G4ThreeVector() )
{
fieldManager->SetDetectorField(0);
fieldManager->CreateChordFinder(0);
fieldManager->SetDetectorField(nullptr);
fieldManager->CreateChordFinder(nullptr);
if ( fVerboseLevel > 0 )
{
@@ -140,7 +139,7 @@ void G4GlobalMagFieldMessenger::SetFieldValue(const G4ThreeVector& value)
G4ThreeVector G4GlobalMagFieldMessenger::GetFieldValue() const
{
if ( fMagField ) return fMagField->GetConstantFieldValue();
if ( fMagField != nullptr ) { return fMagField->GetConstantFieldValue(); }
return G4ThreeVector();
return {};
}
@@ -51,7 +51,7 @@ std::ostream& G4LocatorChangeRecord::ReportVector ( std::ostream& os,
{
using std::setw;
G4int prec= 16;
if( vecRec.size() == 0 )
if( vecRec.empty() )
{
os << "Locator Change Record for " << name << " is empty" << G4endl;
return os;
@@ -44,9 +44,9 @@ G4MultiLevelLocator::G4MultiLevelLocator(G4Navigator *theNavigator)
// Initialise the array of Pointers [max_depth+1] to do this
G4ThreeVector zeroV(0.0,0.0,0.0);
for ( auto idepth=0; idepth<max_depth+1; ++idepth )
for (auto & idepth : ptrInterMedFT)
{
ptrInterMedFT[ idepth ] = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
idepth = new G4FieldTrack( zeroV, zeroV, 0., 0., 0., 0.);
}
if (fCheckMode)
@@ -60,9 +60,9 @@ G4MultiLevelLocator::G4MultiLevelLocator(G4Navigator *theNavigator)
G4MultiLevelLocator::~G4MultiLevelLocator()
{
for ( auto idepth=0; idepth<max_depth+1; ++idepth )
for (auto & idepth : ptrInterMedFT)
{
delete ptrInterMedFT[idepth];
delete idepth;
}
#ifdef G4DEBUG_FIELD
ReportStatistics();
@@ -236,9 +236,9 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
// Final_section boolean store
//
G4bool fin_section_depth[max_depth];
for ( auto idepth=0; idepth<max_depth; ++idepth )
for (bool & idepth : fin_section_depth)
{
fin_section_depth[idepth] = true;
idepth = true;
}
// 'SubStartPoint' is needed to calculate the length of the divided step
//
@@ -276,17 +276,21 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
G4cerr.precision(op);
// G4LocatorChangeRecord::ReportVector(G4cerr, "endPointB", endChangeB );
// G4cerr<<"EndPoints A(start) and B(end): combined changes " << G4endl;
if (fCheckMode) {
G4LocatorChangeLogger::ReportEndChanges(G4cerr, endChangeA, endChangeB);
if (fCheckMode)
{
G4LocatorChangeLogger::ReportEndChanges(G4cerr, endChangeA, endChangeB);
}
}
#endif
if( !validIntersectP ){
if( !validIntersectP )
{
G4ExceptionDescription errmsg;
errmsg << "Assertion FAILURE - invalid (stale) Interection point. Substep: "
<< substep_no << " call: " << fNumCalls << G4endl;
if (fCheckMode)
G4LocatorChangeRecord::ReportEndChanges(errmsg, endChangeA, endChangeB );
{
G4LocatorChangeRecord::ReportEndChanges(errmsg, endChangeA, endChangeB );
}
G4Exception("G4MultiLevelLocator::EstimateIntersectionPoint", "GeomNav0004",
JustWarning, errmsg);
}
@@ -593,8 +597,11 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
}
else
{
if( CurrentB_PointVelocity.GetCurveLength() < CurrentA_PointVelocity.GetCurveLength() )
if( CurrentB_PointVelocity.GetCurveLength()
< CurrentA_PointVelocity.GetCurveLength() )
{
errorEndPt = 2;
}
}
if( errorEndPt > 1 ) // errorEndPt = 1 is milder, just: len(B)=len(A)
@@ -608,7 +615,8 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
SubStart_PointVelocity, CurrentE_Point,
ApproxIntersecPointV, substep_no, substep_no_p, depth);
if (fCheckMode) {
if (fCheckMode)
{
G4LocatorChangeRecord::ReportEndChanges(errmsg, endChangeA, endChangeB );
}
@@ -840,8 +848,11 @@ G4bool G4MultiLevelLocator::EstimateIntersectionPoint(
}
else
{
if( CurrentB_PointVelocity.GetCurveLength() < CurrentA_PointVelocity.GetCurveLength() )
if( CurrentB_PointVelocity.GetCurveLength()
< CurrentA_PointVelocity.GetCurveLength() )
{
errorEndPt = 2;
}
}
if (fCheckMode)
@@ -1009,9 +1020,9 @@ void G4MultiLevelLocator::ReportFieldValue( const G4FieldTrack& locationPV,
G4double startPoint[4] = { position.x(), position.y(), position.z(),
locationPV.GetLabTimeOfFlight() };
G4double FieldVec[maxNumFieldComp]; // 24 ;
for (auto i=0; i<maxNumFieldComp; ++i )
for (double & i : FieldVec)
{
FieldVec[i] = 0.0;
i = 0.0;
}
equation->GetFieldValue( startPoint, FieldVec);
G4cout << " B-field value (" << nameLoc << ")= "
@@ -39,12 +39,9 @@ class G4FieldManager;
#include "G4PropagatorInField.hh"
#include "G4TransportationManager.hh"
// ********************************************************************
// Constructor
// ********************************************************************
//
G4MultiNavigator::G4MultiNavigator()
: G4Navigator()
// -----------------------------------------------------------------------
G4MultiNavigator::G4MultiNavigator()
{
G4ThreeVector Big3Vector( kInfinity, kInfinity, kInfinity );
fLastLocatedPosition = Big3Vector;
@@ -63,10 +60,10 @@ G4MultiNavigator::G4MultiNavigator()
pTransportManager= G4TransportationManager::GetTransportationManager();
G4Navigator* massNav= pTransportManager->GetNavigatorForTracking();
if( massNav )
if( massNav != nullptr )
{
G4VPhysicalVolume* pWorld= massNav->GetWorldVolume();
if( pWorld )
if( pWorld != nullptr )
{
SetWorldVolume( pWorld );
fLastMassWorld = pWorld;
@@ -74,9 +71,11 @@ G4MultiNavigator::G4MultiNavigator()
}
}
G4MultiNavigator::~G4MultiNavigator()
{
}
// -----------------------------------------------------------------------
G4MultiNavigator::~G4MultiNavigator() = default;
// -----------------------------------------------------------------------
G4double G4MultiNavigator::ComputeStep(const G4ThreeVector& pGlobalPoint,
const G4ThreeVector& pDirection,
@@ -214,7 +213,7 @@ G4MultiNavigator::ObtainFinalStep( G4int navigatorId,
// ----------------------------------------------------------------------
void G4MultiNavigator::PrepareNewTrack( const G4ThreeVector position,
void G4MultiNavigator::PrepareNewTrack( const G4ThreeVector& position,
const G4ThreeVector direction )
{
#ifdef G4DEBUG_NAVIGATION
@@ -281,7 +280,7 @@ void G4MultiNavigator::PrepareNavigators()
G4VPhysicalVolume* massWorld = GetWorldVolume();
if( (massWorld != fLastMassWorld) && (massWorld!=0) )
if( (massWorld != fLastMassWorld) && (massWorld!=nullptr) )
{
// Pass along change to Mass Navigator
fpNavigator[0] -> SetWorldVolume( massWorld );
@@ -310,10 +309,9 @@ G4MultiNavigator::LocateGlobalPointAndSetup(const G4ThreeVector& position,
G4ThreeVector direction(0.0, 0.0, 0.0);
G4bool relative = pRelativeSearch;
std::vector<G4Navigator*>::iterator pNavIter
= pTransportManager->GetActiveNavigatorsIterator();
auto pNavIter = pTransportManager->GetActiveNavigatorsIterator();
if( pDirection ) { direction = *pDirection; }
if( pDirection != nullptr ) { direction = *pDirection; }
#ifdef G4DEBUG_NAVIGATION
if( fVerbose > 2 )
@@ -383,8 +381,7 @@ G4MultiNavigator::LocateGlobalPointWithinVolume(const G4ThreeVector& position)
{
// Relocate the point in each geometry
std::vector<G4Navigator*>::iterator pNavIter
= pTransportManager->GetActiveNavigatorsIterator();
auto pNavIter = pTransportManager->GetActiveNavigatorsIterator();
#ifdef G4DEBUG_NAVIGATION
if( fVerbose > 2 )
@@ -463,7 +460,7 @@ G4MultiNavigator::CreateTouchableHistoryHandle() const
touchHist->UpdateYourself( locatedVolume, touchHist->GetHistory() );
}
return G4TouchableHistoryHandle(touchHist);
return {touchHist};
}
// -----------------------------------------------------------------------
@@ -584,7 +581,7 @@ G4MultiNavigator::PrintLimited()
if (pNav != nullptr)
{
G4VPhysicalVolume *pWorld = pNav->GetWorldVolume();
if( pWorld )
if( pWorld != nullptr )
{
WorldName = pWorld->GetName();
}
@@ -662,8 +659,7 @@ G4MultiNavigator::ResetHierarchyAndLocate(const G4ThreeVector& point,
"Cannot reset hierarchy before navigators are initialised.");
}
std::vector<G4Navigator*>::iterator pNavIter=
pTransportManager->GetActiveNavigatorsIterator();
auto pNavIter= pTransportManager->GetActiveNavigatorsIterator();
for ( auto num = 0; num < fNoActiveNavigators ; ++pNavIter,++num )
{
@@ -700,8 +696,7 @@ G4MultiNavigator::GetGlobalExitNormal(const G4ThreeVector& argPoint,
{
if( fNoLimitingStep > 1 )
{
std::vector<G4Navigator*>::iterator pNavIter=
pTransportManager->GetActiveNavigatorsIterator();
auto pNavIter= pTransportManager->GetActiveNavigatorsIterator();
for ( auto num = 0; num < fNoActiveNavigators ; ++pNavIter, ++num )
{
@@ -41,9 +41,7 @@ G4NavigationLogger::G4NavigationLogger(const G4String& id)
{
}
G4NavigationLogger::~G4NavigationLogger()
{
}
G4NavigationLogger::~G4NavigationLogger() = default;
// ********************************************************************
// PreComputeStepLog
@@ -493,12 +491,12 @@ G4NavigationLogger::ComputeSafetyLog(const G4VSolid* solid,
{
if( banner < 0 )
{
banner = isMotherVolume;
banner = static_cast<G4int>(isMotherVolume);
}
if( fVerbose >= 1 )
{
G4String volumeType = isMotherVolume ? " Mother " : "Daughter";
if (banner)
if (banner != 0)
{
G4cout << "************** " << fId << "::ComputeSafety() ****************"
<< G4endl;
@@ -663,9 +661,9 @@ G4NavigationLogger::ReportOutsideMother(const G4ThreeVector& localPoint,
const G4VPhysicalVolume* physical,
G4double triggerDist) const
{
const G4LogicalVolume* logicalVol = physical
const G4LogicalVolume* logicalVol = physical != nullptr
? physical->GetLogicalVolume() : nullptr;
const G4VSolid* solid = logicalVol
const G4VSolid* solid = logicalVol != nullptr
? logicalVol->GetSolid() : nullptr;
G4String fMethod = fId + "::ComputeStep()";
@@ -784,9 +782,9 @@ ReportVolumeAndIntersection( std::ostream& os,
const G4VPhysicalVolume* physical ) const
{
G4String fMethod = fId + "::ComputeStep()";
const G4LogicalVolume* logicalVol = physical
const G4LogicalVolume* logicalVol = physical != nullptr
? physical->GetLogicalVolume() : nullptr;
const G4VSolid* solid = logicalVol
const G4VSolid* solid = logicalVol != nullptr
? logicalVol->GetSolid() : nullptr;
if( solid == nullptr )
{
+39 -31
View File
@@ -137,11 +137,11 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
G4bool notKnownContained = true, noResult;
G4VPhysicalVolume *targetPhysical;
G4LogicalVolume *targetLogical;
G4VSolid *targetSolid = 0;
G4VSolid *targetSolid = nullptr;
G4ThreeVector localPoint, globalDirection;
EInside insideCode;
G4bool considerDirection = pGlobalDirection && ((!ignoreDirection) || fLocatedOnEdge);
G4bool considerDirection = (pGlobalDirection != nullptr) && ((!ignoreDirection) || fLocatedOnEdge);
fLastTriedStepComputation = false;
fChangedGrandMotherRefFrame = false; // For local exit normal
@@ -185,7 +185,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
{
++noLevelsExited; // count this first level entered too
if ( fHistory.GetDepth() )
if ( fHistory.GetDepth() != 0 )
{
fBlockedPhysicalVolume = fHistory.GetTopVolume();
fBlockedReplicaNo = fHistory.GetTopReplicaNo();
@@ -195,7 +195,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
{
fLastLocatedPointLocal = localPoint;
fLocatedOutsideWorld = true;
fBlockedPhysicalVolume = 0; // to be sure
fBlockedPhysicalVolume = nullptr; // to be sure
fBlockedReplicaNo = -1;
fEntering = false; // No longer
fEnteredDaughter = false;
@@ -306,9 +306,13 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
{
G4String solidResponse = "-kInside-";
if (insideCode == kOutside)
{
solidResponse = "-kOutside-";
}
else if (insideCode == kSurface)
{
solidResponse = "-kSurface-";
}
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup(): ***" << G4endl
<< " Invoked Inside() for solid: " << targetSolid->GetName()
<< ". Solid replied: " << solidResponse << G4endl
@@ -338,8 +342,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
}
// Point is inside current volume, break out of the loop
if ( insideCode == kInside )
break;
if ( insideCode == kInside ) { break; }
// Point is outside current volume, move up a level in the hierarchy
if ( insideCode == kOutside )
@@ -396,8 +399,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
}
// Point is on a surface, but no longer exiting, break out of the loop
if ( !isExiting )
break;
if ( !isExiting ) { break; }
++noLevelsExited;
@@ -421,7 +423,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
//
const G4RotationMatrix* mRot =
fBlockedPhysicalVolume->GetRotation();
if( mRot )
if( mRot != nullptr )
{
fGrandMotherExitNormal *= (*mRot).inverse();
fChangedGrandMotherRefFrame = true;
@@ -446,12 +448,12 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
// Determine `type' of current mother volume
//
targetPhysical = fHistory.GetTopVolume();
if (!targetPhysical) { break; }
if (targetPhysical == nullptr) { break; }
targetLogical = targetPhysical->GetLogicalVolume();
switch( CharacteriseDaughters(targetLogical) )
{
case kNormal:
if ( targetLogical->GetVoxelHeader() ) // use optimised navigation
if ( targetLogical->GetVoxelHeader() != nullptr ) // use optimised navigation
{
noResult = GetVoxelNavigator().LevelLocate(fHistory,
fBlockedPhysicalVolume,
@@ -536,7 +538,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
{
G4VPhysicalVolume* enteredPhysical = fHistory.GetTopVolume();
const G4RotationMatrix* mRot = enteredPhysical->GetRotation();
if( mRot )
if( mRot != nullptr )
{
// Go deeper, i.e. move 'down' in the hierarchy
// Apply direct rotation, not inverse
@@ -565,7 +567,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
{
G4long oldcoutPrec = G4cout.precision(8);
G4String curPhysVol_Name("None");
if (targetPhysical) { curPhysVol_Name = targetPhysical->GetName(); }
if (targetPhysical != nullptr) { curPhysVol_Name = targetPhysical->GetName(); }
G4cout << " Return value = new volume = " << curPhysVol_Name << G4endl;
G4cout << " ----- Upon exiting:" << G4endl;
PrintState();
@@ -622,7 +624,7 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
switch( CharacteriseDaughters(motherLogical) )
{
case kNormal:
if ( pVoxelHeader )
if ( pVoxelHeader != nullptr )
{
GetVoxelNavigator().VoxelLocate( pVoxelHeader, fLastLocatedPointLocal );
}
@@ -679,7 +681,7 @@ void G4Navigator::SetSavedState()
fSaveState.spBlockedPhysicalVolume = fBlockedPhysicalVolume;
fSaveState.sBlockedReplicaNo = fBlockedReplicaNo;
fSaveState.sLastStepWasZero = fLastStepWasZero;
fSaveState.sLastStepWasZero = static_cast<G4int>(fLastStepWasZero);
fSaveState.sLocatedOutsideWorld = fLocatedOutsideWorld;
fSaveState.sLastLocatedPointLocal = fLastLocatedPointLocal;
@@ -709,7 +711,7 @@ void G4Navigator::RestoreSavedState()
fBlockedPhysicalVolume = fSaveState.spBlockedPhysicalVolume;
fBlockedReplicaNo = fSaveState.sBlockedReplicaNo;
fLastStepWasZero = fSaveState.sLastStepWasZero;
fLastStepWasZero = (fSaveState.sLastStepWasZero != 0);
fLocatedOutsideWorld = fSaveState.sLocatedOutsideWorld;
fLastLocatedPointLocal = fSaveState.sLastLocatedPointLocal;
@@ -825,7 +827,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
switch( CharacteriseDaughters(motherLogical) )
{
case kNormal:
if ( motherLogical->GetVoxelHeader() )
if ( motherLogical->GetVoxelHeader() != nullptr )
{
Step = GetVoxelNavigator().ComputeStep(fLastLocatedPointLocal,
localDirection,
@@ -1038,7 +1040,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
<< " (local position: " << newLocalPoint << ")" << G4endl
<< " (local direction: " << localDirection << ")." << G4endl
<< " Previous phys volume: '"
<< ( fLastMotherPhys ? fLastMotherPhys->GetName() : "" )
<< ( fLastMotherPhys != nullptr ? fLastMotherPhys->GetName() : "" )
<< "'" << G4endl << G4endl;
if( actAndReport || abandon )
{
@@ -1129,7 +1131,7 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
// Transform it to the 'grand-mother' coordinate system
//
const G4RotationMatrix* mRot = motherPhysical->GetRotation();
if( mRot )
if( mRot != nullptr )
{
fChangedGrandMotherRefFrame = true;
fGrandMotherExitNormal = (*mRot).inverse() * exitNormalMotherFrame;
@@ -1167,13 +1169,15 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector& pGlobalpoint,
}
if ( fHistory.GetTopVolumeType() != kReplica )
{
fCalculatedExitNormal = true;
}
// Now transform it to the global reference frame !!
//
if( fValidExitNormal || fCalculatedExitNormal )
{
G4int depth = (G4int)fHistory.GetDepth();
auto depth = (G4int)fHistory.GetDepth();
if( depth > 0 )
{
fExitNormalGlobalFrame = fHistory.GetTransform(depth-1)
@@ -1304,7 +1308,7 @@ void G4Navigator::ResetState()
//
void G4Navigator::SetupHierarchy()
{
const G4int depth = (G4int)fHistory.GetDepth();
const auto depth = (G4int)fHistory.GetDepth();
for ( auto i = 1; i <= depth; ++i )
{
switch ( fHistory.GetVolumeType(i) )
@@ -1369,10 +1373,10 @@ G4ThreeVector G4Navigator::GetLocalExitNormal( G4bool* valid )
//
G4ThreeVector nextSolidExitNormal(0.,0.,0.);
if( fEntering && (fBlockedPhysicalVolume!=0) )
if( fEntering && (fBlockedPhysicalVolume!=nullptr) )
{
candidateLogical = fBlockedPhysicalVolume->GetLogicalVolume();
if( candidateLogical )
if( candidateLogical != nullptr )
{
// fLastStepEndPointLocal is in the coordinates of the mother
// we need it in the daughter's coordinate system.
@@ -1650,7 +1654,7 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
<< " Volume: " << fHistory.GetTopVolume()->GetName() << G4endl;
#ifdef G4VERBOSE
G4LogicalVolume* candLog = fHistory.GetTopVolume()->GetLogicalVolume();
if ( candLog )
if ( candLog != nullptr )
{
message << " Solid: " << candLog->GetSolid()->GetName()
<< ", Type: " << candLog->GetSolid()->GetEntityType() << G4endl
@@ -1722,7 +1726,7 @@ G4Navigator::GetGlobalExitNormal(const G4ThreeVector& IntersectPointGlobal,
<< " Volume: " << fHistory.GetTopVolume()->GetName() << G4endl;
#ifdef G4VERBOSE
G4LogicalVolume* candLog = fHistory.GetTopVolume()->GetLogicalVolume();
if ( candLog )
if ( candLog != nullptr )
{
edN << " Solid: " << candLog->GetSolid()->GetName()
<< ", Type: " << candLog->GetSolid()->GetEntityType() << G4endl
@@ -1859,7 +1863,7 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector& pGlobalpoint,
switch(CharacteriseDaughters(motherLogical))
{
case kNormal:
if ( pVoxelHeader )
if ( pVoxelHeader != nullptr )
{
newSafety = fpVoxelSafety->ComputeSafety(localPoint,
*motherPhysical, pMaxLength);
@@ -1927,7 +1931,7 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector& pGlobalpoint,
//
G4TouchableHistoryHandle G4Navigator::CreateTouchableHistoryHandle() const
{
return G4TouchableHistoryHandle( CreateTouchableHistory() );
return { CreateTouchableHistory() };
}
// ********************************************************************
@@ -1945,7 +1949,7 @@ void G4Navigator::PrintState() const
<< " Exiting = " << fExiting // << G4endl
<< " Entering = " << fEntering // << G4endl
<< " BlockedPhysicalVolume= " ;
if (fBlockedPhysicalVolume==0)
if (fBlockedPhysicalVolume==nullptr)
{
G4cout << "None";
}
@@ -2116,7 +2120,7 @@ G4bool G4Navigator::CheckOverlapsIterative(G4VPhysicalVolume* vol)
<< " with length = " << trialLength << G4endl;
}
foundOverlap = vol->CheckOverlaps(nPoints, trialLength,
fVerbose, numOverlaps);
fVerbose != 0, numOverlaps);
trialLength *= 0.1;
if ( trialLength <= 1.0e-5 ) { numOverlaps= 1;}
}
@@ -2144,10 +2148,14 @@ std::ostream& operator << (std::ostream &os,const G4Navigator &n)
<< " Exiting = " << n.fExiting << G4endl
<< " Entering = " << n.fEntering << G4endl
<< " BlockedPhysicalVolume= " ;
if (n.fBlockedPhysicalVolume==0)
if (n.fBlockedPhysicalVolume==nullptr)
{
os << "None";
}
else
{
os << n.fBlockedPhysicalVolume->GetName();
}
os << G4endl
<< " BlockedReplicaNo = " << n.fBlockedReplicaNo << G4endl
<< " LastStepWasZero = " << n.fLastStepWasZero << G4endl
@@ -2170,7 +2178,7 @@ std::ostream& operator << (std::ostream &os,const G4Navigator &n)
<< std::setw( 5) << n.fValidExitNormal << " "
<< std::setw( 9) << n.fExiting << " "
<< std::setw( 9) << n.fEntering << " ";
if ( n.fBlockedPhysicalVolume==0 )
if ( n.fBlockedPhysicalVolume==nullptr )
{ os << std::setw(15) << "None"; }
else
{ os << std::setw(15)<< n.fBlockedPhysicalVolume->GetName(); }
@@ -302,15 +302,17 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector& localPoint,
if ( motherValidExitNormal )
{
const G4RotationMatrix *rot = motherPhysical->GetRotation();
if (rot)
if (rot != nullptr)
{
exitNormal *= rot->inverse();
#ifdef G4VERBOSE
if( fCheck )
{
fLogger->CheckAndReportBadNormal(exitNormal, // rotated
motherExitNormal, // original
*rot,
"From RotationMatrix" );
}
#endif
}
}
@@ -351,7 +353,7 @@ G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector& localPoint,
#ifdef G4VERBOSE
if( fCheck )
{
fLogger->ComputeSafetyLog(motherSolid,localPoint,motherSafety,true,true);
fLogger->ComputeSafetyLog(motherSolid,localPoint,motherSafety,true,1);
}
#endif
@@ -378,7 +380,7 @@ G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector& localPoint,
if(fCheck)
{
fLogger->ComputeSafetyLog(sampleSolid, samplePoint,
sampleSafety, false, false);
sampleSafety, false, 0);
// Not mother, no banner
}
#endif
@@ -53,17 +53,13 @@
// Constructor
// ********************************************************************
//
G4ParameterisedNavigation::G4ParameterisedNavigation()
{
}
G4ParameterisedNavigation::G4ParameterisedNavigation() = default;
// ***************************************************************************
// Destructor
// ***************************************************************************
//
G4ParameterisedNavigation::~G4ParameterisedNavigation()
{
}
G4ParameterisedNavigation::~G4ParameterisedNavigation() = default;
// ***************************************************************************
// ComputeStep
@@ -279,20 +275,30 @@ G4double G4ParameterisedNavigation::
<< " Solid gave DistanceToIn = "
<< sampleStep << " yet returns " ;
if( insideIntPt == kInside )
{
message << "-kInside-";
}
else if( insideIntPt == kOutside )
{
message << "-kOutside-";
}
else
{
message << "-kSurface-";
}
message << " for this point !" << G4endl
<< " Point = " << intersectionPoint
<< G4endl;
if ( insideIntPt != kInside )
{
message << " DistanceToIn(p) = "
<< sampleSolid->DistanceToIn(intersectionPoint);
if ( insideIntPt != kOutside )
}
if ( insideIntPt != kOutside )
{
message << " DistanceToOut(p) = "
<< sampleSolid->DistanceToOut(intersectionPoint);
}
G4Exception("G4ParameterisedNavigation::ComputeStep()",
"GeomNav1002", JustWarning, message);
G4cout.precision(oldcoutPrec);
@@ -365,7 +371,7 @@ G4double G4ParameterisedNavigation::
if ( validExitNormal )
{
const G4RotationMatrix* rot = motherPhysical->GetRotation();
if (rot)
if (rot != nullptr)
{
exitNormal *= rot->inverse();
}
@@ -42,15 +42,12 @@
//------------------------------------------------------------------
G4PartialPhantomParameterisation::G4PartialPhantomParameterisation()
: G4PhantomParameterisation()
{
}
//------------------------------------------------------------------
G4PartialPhantomParameterisation::~G4PartialPhantomParameterisation()
{
}
G4PartialPhantomParameterisation::~G4PartialPhantomParameterisation() = default;
//------------------------------------------------------------------
void G4PartialPhantomParameterisation::
@@ -172,13 +169,13 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
// if the direction is negative substract 1
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/(fVoxelHalfX*2.);
G4int nx = G4int(fx);
auto nx = G4int(fx);
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/(fVoxelHalfY*2.);
G4int ny = G4int(fy);
auto ny = G4int(fy);
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/(fVoxelHalfZ*2.);
G4int nz = G4int(fz);
auto 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
@@ -289,7 +286,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
"GeomNav1002", JustWarning, message);
}
G4int nyz = G4int(nz*fNoVoxelsY+ny);
auto nyz = G4int(nz*fNoVoxelsY+ny);
auto ite = fFilledIDs.cbegin();
/*
for( ite = fFilledIDs.cbegin(); ite != fFilledIDs.cend(); ++ite )
@@ -93,7 +93,7 @@ G4PathFinder::G4PathFinder()
fLimitTruth[num] = false;
fLimitedStep[num] = kUndefLimited;
fCurrentStepSize[num] = -1.0;
fLocatedVolume[num] = 0;
fLocatedVolume[num] = nullptr;
fPreSafetyValues[num]= -1.0;
fCurrentPreStepSafety[num] = -1.0;
fNewSafetyComputed[num]= -1.0;
@@ -106,7 +106,7 @@ G4PathFinder::G4PathFinder()
G4PathFinder::~G4PathFinder()
{
delete fpMultiNavigator;
fpPathFinder = 0;
fpPathFinder = nullptr;
}
// ----------------------------------------------------------------------------
@@ -544,8 +544,7 @@ void G4PathFinder::ReLocate( const G4ThreeVector& position )
{
// Locate the point in each geometry
std::vector<G4Navigator*>::iterator pNavIter =
fpTransportManager->GetActiveNavigatorsIterator();
auto pNavIter = fpTransportManager->GetActiveNavigatorsIterator();
#ifdef G4DEBUG_PATHFINDER
@@ -798,7 +797,7 @@ G4PathFinder::CreateTouchableHandle( G4int navId ) const
}
#endif
return G4TouchableHandle(touchHist);
return {touchHist};
}
G4double
@@ -1127,7 +1126,7 @@ void G4PathFinder::PrintLimited()
if (pNav != nullptr)
{
G4VPhysicalVolume *pWorld = pNav->GetWorldVolume();
if( pWorld )
if( pWorld != nullptr )
{
WorldName = pWorld->GetName();
}
@@ -46,9 +46,7 @@ G4PhantomParameterisation::G4PhantomParameterisation()
//------------------------------------------------------------------
G4PhantomParameterisation::~G4PhantomParameterisation()
{
}
G4PhantomParameterisation::~G4PhantomParameterisation() = default;
//------------------------------------------------------------------
@@ -63,6 +61,7 @@ BuildContainerSolid( G4VPhysicalVolume* pMotherPhysical )
// CheckVoxelsFillContainer();
}
//------------------------------------------------------------------
void G4PhantomParameterisation::
BuildContainerSolid( G4VSolid* pMotherSolid )
@@ -260,13 +259,13 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
// if the direction is negative substract 1
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/(fVoxelHalfX*2.);
G4int nx = G4int(fx);
auto nx = G4int(fx);
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/(fVoxelHalfY*2.);
G4int ny = G4int(fy);
auto ny = G4int(fy);
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/(fVoxelHalfZ*2.);
G4int nz = G4int(fz);
auto nz = G4int(fz);
// If it is on the surface side, check the direction: if direction is
// negative place it in the previous voxel (if direction is positive it is
@@ -327,7 +326,7 @@ GetReplicaNo( const G4ThreeVector& localPoint, const G4ThreeVector& localDir )
}
}
G4int copyNo = G4int(nx + fNoVoxelsX*ny + fNoVoxelsXY*nz);
auto copyNo = G4int(nx + fNoVoxelsX*ny + fNoVoxelsXY*nz);
// Check if there are still errors
//
@@ -49,6 +49,7 @@
#include "G4ChordFinder.hh"
#include "G4MultiLevelLocator.hh"
// ---------------------------------------------------------------------------
// Constructors and destructor
//
@@ -63,12 +64,15 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator* theNavigator,
{
fEpsilonStep = (fDetectorFieldMgr != nullptr)
? fDetectorFieldMgr->GetMaximumEpsilonStep() : 1.0e-5;
fLargestAcceptableStep = 1000.0 * meter;
fPreviousSftOrigin = G4ThreeVector(0.,0.,0.);
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fZeroStepThreshold = std::max( 1.0e5 * kCarTolerance, 1.0e-1 * micrometer );
fLargestAcceptableStep = 100.0 * meter; // Reduced from 1000.0 * meter
fMaxStepSizeMultiplier= 0.1 ; // 0.1 in git (larger for tests.) // Reduced from 100;
fMinBigDistance= 100. * CLHEP::mm;
#ifdef G4DEBUG_FIELD
G4cout << " PiF: Zero Step Threshold set to "
<< fZeroStepThreshold / millimeter
@@ -122,7 +126,7 @@ G4double G4PropagatorInField::ComputeStep(
G4VPhysicalVolume* pPhysVol,
G4bool canRelaxDeltaChord)
{
GetChordFinder()->OnComputeStep();
GetChordFinder()->OnComputeStep(&pFieldTrack);
const G4double deltaChord = GetChordFinder()->GetDeltaChord();
// If CurrentProposedStepLength is too small for finding Chords
@@ -136,7 +140,7 @@ G4double G4PropagatorInField::ComputeStep(
// Introducing smooth trajectory display (jacek 01/11/2002)
//
if (fpTrajectoryFilter)
if (fpTrajectoryFilter != nullptr)
{
fpTrajectoryFilter->CreateNewTrajectorySegment();
}
@@ -151,10 +155,14 @@ G4double G4PropagatorInField::ComputeStep(
G4cout << " Starting FT: " << pFieldTrack;
G4cout << " Requested length = " << CurrentProposedStepLength << G4endl;
G4cout << " PhysVol = ";
if( pPhysVol )
if( pPhysVol != nullptr )
{
G4cout << pPhysVol->GetName() << G4endl;
}
else
{
G4cout << " N/A ";
}
G4cout << G4endl;
}
@@ -192,7 +200,7 @@ G4double G4PropagatorInField::ComputeStep(
StartPointA = pFieldTrack.GetPosition();
VelocityUnit = pFieldTrack.GetMomentumDir();
G4double trialProposedStep = 1.e2 * ( 10.0 * cm +
G4double trialProposedStep = fMaxStepSizeMultiplier * ( fMinBigDistance +
fNavigator->GetWorldVolume()->GetLogicalVolume()->
GetSolid()->DistanceToOut(StartPointA, VelocityUnit) );
CurrentProposedStepLength = std::min( trialProposedStep,
@@ -236,14 +244,15 @@ G4double G4PropagatorInField::ComputeStep(
// is either geometrically sharp or between very different materials.
// Careful decreases to cope with tolerance are required
//
if( stepTrial > 100.0*fZeroStepThreshold )
if( stepTrial > 100.0*fZeroStepThreshold ) {
decreaseFactor = 0.35; // Try decreasing slower
else if( stepTrial > 30.0*fZeroStepThreshold )
} else if( stepTrial > 30.0*fZeroStepThreshold ) {
decreaseFactor= 0.5; // Try yet slower decrease
else if( stepTrial > 10.0*fZeroStepThreshold )
} else if( stepTrial > 10.0*fZeroStepThreshold ) {
decreaseFactor= 0.75; // Try even slower decreases
else
} else {
decreaseFactor= 0.9; // Try very slow decreases
}
}
stepTrial *= decreaseFactor;
@@ -395,7 +404,7 @@ G4double G4PropagatorInField::ComputeStep(
{
StepTaken += s_length_taken;
if (fpTrajectoryFilter) // For smooth trajectory display (jacek 1/11/2002)
if (fpTrajectoryFilter != nullptr) // For smooth trajectory display (jacek 1/11/2002)
{
fpTrajectoryFilter->TakeIntermediatePoint(CurrentState.GetPosition());
}
@@ -589,7 +598,7 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
{ G4cout << std::setw( 9) << requestStep << " "; }
else
{ G4cout << std::setw( 9) << "Init/NotKnown" << " "; }
if( startVolume != 0)
if( startVolume != nullptr)
{ G4cout << std::setw(12) << startVolume->GetName() << " "; }
G4cout.precision(oldprec);
G4cout << G4endl;
@@ -655,10 +664,7 @@ G4PropagatorInField::GimmeTrajectoryVectorAndForgetIt() const
{
return fpTrajectoryFilter->GimmeThePointsAndForgetThem();
}
else
{
return nullptr;
}
return nullptr;
}
// ---------------------------------------------------------------------------
@@ -761,7 +767,7 @@ void G4PropagatorInField::ReportLoopingParticle( G4int count,
G4double StepTaken,
G4double StepRequested,
const char* methodName,
G4ThreeVector momentumVec,
const G4ThreeVector& momentumVec,
G4VPhysicalVolume* pPhysVol )
{
std::ostringstream message;
@@ -785,18 +791,20 @@ void G4PropagatorInField::ReportLoopingParticle( G4int count,
}
message << std::setprecision(prec)
<< 100. * StepTaken / StepRequested << " % " << G4endl ;
if( pPhysVol )
if( pPhysVol != nullptr )
{
message << " in volume " << pPhysVol->GetName() ;
auto material = pPhysVol->GetLogicalVolume()->GetMaterial();
if( material != nullptr )
message << " with material " << material->GetName()
<< " ( density = "
<< material->GetDensity() / ( g/(cm*cm*cm) ) << " g / cm^3 ) ";
message << " in volume " << pPhysVol->GetName() ;
auto material = pPhysVol->GetLogicalVolume()->GetMaterial();
if( material != nullptr )
{
message << " with material " << material->GetName()
<< " ( density = "
<< material->GetDensity() / ( g/(cm*cm*cm) ) << " g / cm^3 ) ";
}
}
else
{
message << " in unknown (null) volume. " ;
message << " in unknown (null) volume. " ;
}
G4Exception(methodName, "GeomNav1002", JustWarning, message);
}
@@ -815,9 +823,63 @@ void G4PropagatorInField::ReportStuckParticle( G4int noZeroSteps,
<< " Proposed Step is " << proposedStep
<< " but Step Taken is "<< lastTriedStep << G4endl;
if( physVol != nullptr )
{
message << " in volume " << physVol->GetName() ;
}
else
{
message << " in unknown or null volume. " ;
}
G4Exception("G4PropagatorInField::ComputeStep()",
"GeomNav1002", JustWarning, message);
}
// ------------------------------------------------------------------------
// ----------------------------------------------
// Methods to alter Parameters
// ----------------------------------------------
// Was a data member (of an object) -- now moved to class member
G4double G4PropagatorInField::GetLargestAcceptableStep()
{
return fLargestAcceptableStep;
}
// ------------------------------------------------------------------------
//
void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist )
{
if( fLargestAcceptableStep>0.0 )
{
fLargestAcceptableStep = newBigDist;
}
}
// ---------------------------------------------------------------------------
G4double G4PropagatorInField::GetMaxStepSizeMultiplier()
{
return fMaxStepSizeMultiplier;
}
// ---------------------------------------------------------------------------
void G4PropagatorInField::SetMaxStepSizeMultiplier(G4double vm)
{
fMaxStepSizeMultiplier=vm;
}
// ---------------------------------------------------------------------------
G4double G4PropagatorInField::GetMinBigDistance()
{
return fMinBigDistance;
}
// ---------------------------------------------------------------------------
void G4PropagatorInField::SetMinBigDistance(G4double val)
{
fMinBigDistance= val;
}
@@ -47,9 +47,7 @@ G4RegularNavigation::G4RegularNavigation()
//------------------------------------------------------------------
G4RegularNavigation::~G4RegularNavigation()
{
}
G4RegularNavigation::~G4RegularNavigation() = default;
//------------------------------------------------------------------
@@ -91,8 +89,8 @@ G4double G4RegularNavigation::
motherLogical = motherPhysical->GetLogicalVolume();
daughterPhysical = motherLogical->GetDaughter(0);
G4PhantomParameterisation * daughterParam =
(G4PhantomParameterisation*)(daughterPhysical->GetParameterisation());
auto daughterParam =
(G4PhantomParameterisation*)(daughterPhysical->GetParameterisation());
G4int copyNo = daughterParam ->GetReplicaNo(localPoint,localDirection);
G4ThreeVector voxelTranslation = daughterParam->GetTranslation( copyNo );
@@ -132,7 +130,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
{
G4RegularNavigationHelper::Instance()->ClearStepLengths();
G4PhantomParameterisation *param =
auto param =
(G4PhantomParameterisation*)(pCurrentPhysical->GetParameterisation());
if( !param->SkipEqualMaterials() )
@@ -156,7 +154,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
// To get replica No: transform local point to the reference system of the
// param container volume
//
G4int ide = (G4int)history.GetDepth();
auto ide = (G4int)history.GetDepth();
G4ThreeVector containerPoint = history.GetTransform(ide)
.InverseTransformPoint(localPoint);
@@ -309,11 +307,7 @@ G4double G4RegularNavigation::ComputeStepSkippingEqualMaterials(
AddStepLength(copyNo, newStep-totalNewStep+currentProposedStepLength);
return currentProposedStepLength;
}
else
{
G4RegularNavigationHelper::Instance()->AddStepLength( copyNo, newStep );
}
G4RegularNavigationHelper::Instance()->AddStepLength( copyNo, newStep );
// Move container point until wall of voxel
//
@@ -395,7 +389,7 @@ G4RegularNavigation::LevelLocate( G4NavigationHistory& history,
// Get local direction
//
if( globalDirection )
if( globalDirection != nullptr )
{
localDir = history.GetTopTransform().TransformAxis(*globalDirection);
}
@@ -38,15 +38,11 @@ G4RegularNavigationHelper* G4RegularNavigationHelper::Instance()
// --------------------------------------------------------------------
//
G4RegularNavigationHelper::G4RegularNavigationHelper()
{
}
G4RegularNavigationHelper::G4RegularNavigationHelper() = default;
// --------------------------------------------------------------------
//
G4RegularNavigationHelper::~G4RegularNavigationHelper()
{
}
G4RegularNavigationHelper::~G4RegularNavigationHelper() = default;
// --------------------------------------------------------------------
//
@@ -65,9 +65,7 @@ G4ReplicaNavigation::G4ReplicaNavigation()
// Destructor
// ********************************************************************
//
G4ReplicaNavigation::~G4ReplicaNavigation()
{
}
G4ReplicaNavigation::~G4ReplicaNavigation() = default;
// ********************************************************************
// Inside
@@ -107,7 +105,7 @@ G4ReplicaNavigation::Inside(const G4VPhysicalVolume* pVol,
}
break;
case kPhi:
if ( localPoint.y()||localPoint.x() )
if ( (localPoint.y() != 0.0)||(localPoint.x() != 0.0) )
{
coord = std::fabs(std::atan2(localPoint.y(),localPoint.x()))-width*0.5;
if ( coord<=-halfkAngTolerance )
@@ -142,7 +140,7 @@ G4ReplicaNavigation::Inside(const G4VPhysicalVolume* pVol,
{
// Known to be inside outer radius
//
if ( replicaNo||offset )
if ( (replicaNo != 0)||(offset != 0.0) )
{
rmin = rmax-width;
tolRMin2 = rmin-halfkRadTolerance;
@@ -221,7 +219,7 @@ G4ReplicaNavigation::DistanceToOut(const G4VPhysicalVolume* pVol,
case kRho:
rho = localPoint.perp();
rmax = width*(replicaNo+1)+offset;
if ( replicaNo||offset )
if ( (replicaNo != 0)||(offset != 0.0) )
{
rmin = rmax-width;
safe1 = rho-rmin;
@@ -561,7 +559,7 @@ G4ReplicaNavigation::DistanceToOutRad(const G4ThreeVector& localPoint,
{
// Possible rmin intersection
//
if (rmin)
if (rmin != 0.0)
{
deltaR = t3-rmin*rmin;
b = t2/t1;
@@ -803,7 +801,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
history.GetTopReplicaNo(),
localPoint);
G4ExitNormal normalOutStc;
const G4int topDepth= (G4int)history.GetDepth();
const auto topDepth= (G4int)history.GetDepth();
ourSafety = std::min( ourSafety, sampleSafety);
@@ -954,9 +952,11 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
"Point is far outside Current Volume !" );
}
else
{
G4Exception("G4ReplicaNavigation::ComputeStep()",
"GeomNav1002", JustWarning, message,
"Point is a little outside Current Volume.");
}
}
}
#endif
@@ -987,7 +987,7 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
}
// Transform to Grand-mother reference frame
const G4RotationMatrix* rot = motherPhysical->GetRotation();
if ( rot )
if ( rot != nullptr )
{
exitNormalVector *= rot->inverse();
}
@@ -1094,21 +1094,24 @@ G4ReplicaNavigation::ComputeStep(const G4ThreeVector& globalPoint,
<< sampleSolid->GetName() << G4endl
<< " Solid gave DistanceToIn = "
<< sampleStepDistance << " yet returns " ;
if ( insideIntPt == kInside )
if ( insideIntPt == kInside ) {
message << "-kInside-";
else if ( insideIntPt == kOutside )
} else if ( insideIntPt == kOutside ) {
message << "-kOutside-";
else
} else {
message << "-kSurface-";
}
message << " for this point !" << G4endl
<< " Point = " << intersectionPoint << G4endl;
if ( insideIntPt != kInside )
if ( insideIntPt != kInside ) {
message << " DistanceToIn(p) = "
<< sampleSolid->DistanceToIn(intersectionPoint)
<< G4endl;
if ( insideIntPt != kOutside )
}
if ( insideIntPt != kOutside ) {
message << " DistanceToOut(p) = "
<< sampleSolid->DistanceToOut(intersectionPoint);
}
G4Exception("G4ReplicaNavigation::ComputeStep()",
"GeomNav1002", JustWarning, message);
G4cout.precision(oldcoutPrec);
@@ -1304,10 +1307,7 @@ G4ReplicaNavigation::BackLocate(G4NavigationHistory& history,
history.BackLevel(cdepth-depth);
return insideCode;
}
else
{
goodPoint = repPoint;
}
goodPoint = repPoint;
}
localPoint = history.GetTransform(depth).TransformPoint(globalPoint);
insideCode = Inside(history.GetVolume(depth),
@@ -35,11 +35,13 @@
#include "globals.hh"
// --------------------------------------------------------------------
G4SafetyHelper::G4SafetyHelper()
: fLastSafetyPosition(0.0,0.0,0.0)
{
}
// --------------------------------------------------------------------
void G4SafetyHelper::InitialiseNavigator()
{
fpPathFinder = G4PathFinder::GetInstance();
@@ -60,6 +62,7 @@ void G4SafetyHelper::InitialiseNavigator()
}
}
// --------------------------------------------------------------------
void G4SafetyHelper::InitialiseHelper()
{
fLastSafetyPosition = G4ThreeVector(0.0,0.0,0.0);
@@ -68,9 +71,7 @@ void G4SafetyHelper::InitialiseHelper()
fFirstCall = false;
}
G4SafetyHelper::~G4SafetyHelper()
{
}
G4SafetyHelper::~G4SafetyHelper() = default;
G4double
G4SafetyHelper::CheckNextStep(const G4ThreeVector& position,
@@ -93,6 +94,7 @@ G4SafetyHelper::CheckNextStep(const G4ThreeVector& position,
return linstep;
}
// --------------------------------------------------------------------
G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position,
G4double maxLength )
{
@@ -138,6 +140,7 @@ G4double G4SafetyHelper::ComputeSafety( const G4ThreeVector& position,
return newSafety;
}
// --------------------------------------------------------------------
void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector& newPosition )
{
#ifdef G4VERBOSE
@@ -172,6 +175,7 @@ void G4SafetyHelper::ReLocateWithinVolume( const G4ThreeVector& newPosition )
}
}
// --------------------------------------------------------------------
void G4SafetyHelper::Locate( const G4ThreeVector& newPosition,
const G4ThreeVector& newDirection)
{
@@ -39,9 +39,7 @@ G4SimpleLocator::G4SimpleLocator(G4Navigator *theNavigator)
{
}
G4SimpleLocator::~G4SimpleLocator()
{
}
G4SimpleLocator::~G4SimpleLocator() = default;
// --------------------------------------------------------------------------
// G4bool G4PropagatorInField::LocateIntersectionPoint(
@@ -53,7 +53,7 @@ G4Navigator* G4TransportationManager::fFirstTrackingNavigator= nullptr;
//
G4TransportationManager::G4TransportationManager()
{
if (fTransportationManager)
if (fTransportationManager != nullptr)
{
G4Exception("G4TransportationManager::G4TransportationManager()",
"GeomNav0002", FatalException,
@@ -63,15 +63,17 @@ G4TransportationManager::G4TransportationManager()
// Create the navigator for tracking and activate it; add to collections
//
G4Navigator* trackingNavigator= nullptr;
if( fFirstTrackingNavigator && fFirstTrackingNavigator->GetExternalNavigation() )
if( (fFirstTrackingNavigator != nullptr) && (fFirstTrackingNavigator->GetExternalNavigation() != nullptr) )
{
trackingNavigator = fFirstTrackingNavigator->Clone();
}
else
{
trackingNavigator = new G4Navigator();
if( fFirstTrackingNavigator == nullptr )
if( fFirstTrackingNavigator == nullptr )
{
fFirstTrackingNavigator = trackingNavigator;
}
}
trackingNavigator->Activate(true);
fNavigators.push_back(trackingNavigator);
@@ -132,7 +134,7 @@ void G4TransportationManager::SetFieldManager(G4FieldManager* newFieldManager)
// Message the PropagatorInField,
// which also maintains this information (to be reviewed)
//
if( fPropagatorInField )
if( fPropagatorInField != nullptr )
{
fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
}
@@ -159,9 +161,9 @@ void G4TransportationManager::SetNavigatorForTracking(G4Navigator* newNavigator)
//
void G4TransportationManager::ClearNavigators()
{
for (auto pNav=fNavigators.cbegin(); pNav!=fNavigators.cend(); ++pNav)
for (const auto & fNavigator : fNavigators)
{
delete *pNav;
delete fNavigator;
}
fNavigators.clear();
fActiveNavigators.clear();
@@ -203,9 +205,12 @@ G4Navigator* G4TransportationManager::GetNavigator( const G4String& worldName )
{
// If already existing, return the stored pointer to the navigator
//
for (auto pNav=fNavigators.cbegin(); pNav!=fNavigators.cend(); ++pNav)
for (const auto & fNavigator : fNavigators)
{
if ((*pNav)->GetWorldVolume()->GetName() == worldName) { return *pNav; }
if (fNavigator->GetWorldVolume()->GetName() == worldName)
{
return fNavigator;
}
}
// Check if world of that name already exists,
@@ -240,9 +245,9 @@ G4Navigator* G4TransportationManager::GetNavigator( const G4String& worldName )
//
G4Navigator* G4TransportationManager::GetNavigator( G4VPhysicalVolume* aWorld )
{
for (auto pNav=fNavigators.cbegin(); pNav!=fNavigators.cend(); ++pNav)
for (const auto & fNavigator : fNavigators)
{
if ((*pNav)->GetWorldVolume() == aWorld) { return *pNav; }
if (fNavigator->GetWorldVolume() == aWorld) { return fNavigator; }
}
G4Navigator* aNavigator = nullptr;
auto pWorld = std::find(fWorlds.cbegin(), fWorlds.cend(), aWorld);
@@ -325,10 +330,9 @@ G4int G4TransportationManager::ActivateNavigator( G4Navigator* aNavigator )
aNavigator->Activate(true);
G4int id = 0;
for(auto pActiveNav=fActiveNavigators.cbegin();
pActiveNav!=fActiveNavigators.cend(); ++pActiveNav)
for(const auto & fActiveNavigator : fActiveNavigators)
{
if (*pActiveNav == aNavigator) { return id; }
if (fActiveNavigator == aNavigator) { return id; }
++id;
}
@@ -375,10 +379,9 @@ void G4TransportationManager::DeActivateNavigator( G4Navigator* aNavigator )
//
void G4TransportationManager::InactivateAll( )
{
for (auto pNav=fActiveNavigators.cbegin();
pNav!=fActiveNavigators.cend(); ++pNav)
for (const auto & fActiveNavigator : fActiveNavigators)
{
(*pNav)->Activate(false);
fActiveNavigator->Activate(false);
}
fActiveNavigators.clear();
@@ -400,11 +403,11 @@ G4TransportationManager::IsWorldExisting ( const G4String& name )
auto pWorld = fWorlds.begin();
if ( *pWorld==nullptr ) { *pWorld=fNavigators[0]->GetWorldVolume(); }
for (auto cpWorld=fWorlds.cbegin(); cpWorld!=fWorlds.cend(); ++cpWorld)
for (const auto & fWorld : fWorlds)
{
if ((*cpWorld)->GetName() == name ) { return *cpWorld; }
if (fWorld->GetName() == name ) { return fWorld; }
}
return 0;
return nullptr;
}
// ----------------------------------------------------------------------------
@@ -472,7 +475,7 @@ void G4TransportationManager::ClearParallelWorlds()
fNavigators.push_back(trackingNavigator);
fActiveNavigators.push_back(trackingNavigator);
fWorlds.push_back(0); // NULL registered
fWorlds.push_back(nullptr); // NULL registered
}
// ----------------------------------------------------------------------------
@@ -32,19 +32,15 @@
// ********************************************************************
// Constructor
// *********V***********************************************************
// ********************************************************************
//
G4VExternalNavigation::G4VExternalNavigation()
{
}
G4VExternalNavigation::G4VExternalNavigation() = default;
// ********************************************************************
// Destructor
// ********************************************************************
//
G4VExternalNavigation::~G4VExternalNavigation()
{
}
G4VExternalNavigation::~G4VExternalNavigation() = default;
// ********************************************************************
// Inside call Inside() of a solid
@@ -403,7 +403,7 @@ GetLocalSurfaceNormal(const G4ThreeVector& CurrentE_Point, G4bool& validNormal)
// which side you are located onto (can return vector with wrong sign.)
// TO-DO: use direction (of chord) to identify volume we will be "entering"
if( located != 0)
if( located != nullptr)
{
G4LogicalVolume* pLogical= located->GetLogicalVolume();
G4VSolid* pSolid;
@@ -821,7 +821,7 @@ void G4VIntersectionLocator::ReportProgress( std::ostream& oss,
{
oss << "ReportProgress: Current status of intersection search: " << G4endl;
if( depth > 0 ) oss << " Depth= " << depth;
if( depth > 0 ) { oss << " Depth= " << depth; }
oss << " Substep no = " << substep_no << G4endl;
G4int verboseLevel = 5;
G4double safetyPrev = -1.0; // Add as argument ?
@@ -41,8 +41,7 @@
// ********************************************************************
//
G4VoxelNavigation::G4VoxelNavigation()
: fBList(),
fVoxelAxisStack(kNavigatorVoxelStackMax,kXAxis),
: fVoxelAxisStack(kNavigatorVoxelStackMax,kXAxis),
fVoxelNoSlicesStack(kNavigatorVoxelStackMax,0),
fVoxelSliceWidthStack(kNavigatorVoxelStackMax,0.),
fVoxelNodeNoStack(kNavigatorVoxelStackMax,0),
@@ -340,15 +339,17 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
if ( validExitNormal )
{
const G4RotationMatrix *rot = motherPhysical->GetRotation();
if (rot)
if (rot != nullptr)
{
exitNormal *= rot->inverse();
#ifdef G4VERBOSE
if( fCheck )
fLogger->CheckAndReportBadNormal(exitNormal, // rotated
motherExitNormal, // original
*rot,
"From RotationMatrix" );
{
fLogger->CheckAndReportBadNormal(exitNormal, // rotated
motherExitNormal, // original
*rot,
"From RotationMatrix" );
}
#endif
}
}
@@ -588,8 +589,8 @@ G4VoxelNavigation::LocateNextVoxel(const G4ThreeVector& localPoint,
voxelPoint = localPoint+localDirection*newDistance;
fVoxelNodeNoStack[newDepth] = newNodeNo;
fVoxelDepth = newDepth;
newVoxelNode = 0;
while ( !newVoxelNode )
newVoxelNode = nullptr;
while ( newVoxelNode == nullptr )
{
newProxy = newHeader->GetSlice(newNodeNo);
if (newProxy->IsNode())
@@ -718,7 +719,7 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
#ifdef G4VERBOSE
if( fCheck )
{
fLogger->ComputeSafetyLog (motherSolid,localPoint,motherSafety,true,true);
fLogger->ComputeSafetyLog (motherSolid,localPoint,motherSafety,true,1);
}
#endif
//
@@ -748,7 +749,7 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
if( fCheck )
{
fLogger->ComputeSafetyLog(sampleSolid, samplePoint,
sampleSafety, false, false);
sampleSafety, false, 0);
}
#endif
}
@@ -766,6 +767,6 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
//
void G4VoxelNavigation::SetVerboseLevel(G4int level)
{
if( fLogger ) fLogger->SetVerboseLevel(level);
if( fpVoxelSafety) fpVoxelSafety->SetVerboseLevel(level);
if( fLogger != nullptr ) { fLogger->SetVerboseLevel(level); }
if( fpVoxelSafety != nullptr) { fpVoxelSafety->SetVerboseLevel(level); }
}
@@ -42,8 +42,7 @@
// ********************************************************************
//
G4VoxelSafety::G4VoxelSafety()
: fBlockList(),
fVoxelAxisStack(kNavigatorVoxelStackMax,kXAxis),
: fVoxelAxisStack(kNavigatorVoxelStackMax,kXAxis),
fVoxelNoSlicesStack(kNavigatorVoxelStackMax,0),
fVoxelSliceWidthStack(kNavigatorVoxelStackMax,0.),
fVoxelNodeNoStack(kNavigatorVoxelStackMax,0),
@@ -56,9 +55,7 @@ G4VoxelSafety::G4VoxelSafety()
// Destructor
// ********************************************************************
//
G4VoxelSafety::~G4VoxelSafety()
{
}
G4VoxelSafety::~G4VoxelSafety() = default;
// ********************************************************************
// ComputeSafety
@@ -245,7 +242,7 @@ G4VoxelSafety::SafetyForVoxelHeader( const G4SmartVoxelHeader* pHeader,
G4double localCrd = localPoint(targetHeaderAxis);
const G4int candNodeNo = G4int( (localCrd-targetHeaderMin)
const auto candNodeNo = G4int( (localCrd-targetHeaderMin)
/ targetHeaderNodeWidth );
// Ensure that it is between 0 and targetHeader->GetMaxExtent() - 1
@@ -347,7 +344,7 @@ G4VoxelSafety::SafetyForVoxelHeader( const G4SmartVoxelHeader* pHeader,
}
#endif
if ( sampleProxy == 0 )
if ( sampleProxy == nullptr )
{
G4ExceptionDescription ed;
ed << " Problem for node number= " << targetNodeNo