Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user