Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Navigator.hh"
|
||||
|
||||
#include "G4TouchableHistoryHandle.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
|
||||
#include "G4NavigationHistory.hh"
|
||||
|
||||
@@ -112,7 +112,7 @@ class G4MultiNavigator : public G4Navigator
|
||||
// in any geometry from the specified point in the global coordinate
|
||||
// system. The geometry must be closed.
|
||||
|
||||
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const override;
|
||||
G4TouchableHandle CreateTouchableHistoryHandle() const override;
|
||||
// Returns a reference counted handle to a touchable history.
|
||||
|
||||
G4ThreeVector GetLocalExitNormal( G4bool* obtained ) override; // const
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4Navigator
|
||||
// G4Navigator
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -37,10 +37,9 @@
|
||||
// - Made Navigator Abstract G. Cosmo, Nov 2003
|
||||
// - Added check mode G. Cosmo, Mar 2004
|
||||
// - Zero step protections J.A. / G.C., Nov 2004
|
||||
// *********************************************************************
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4NAVIGATOR_HH
|
||||
#define G4NAVIGATOR_HH
|
||||
#define G4NAVIGATOR_HH 1
|
||||
|
||||
#include "geomdefs.hh"
|
||||
|
||||
@@ -49,10 +48,7 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh" // Used in inline methods
|
||||
#include "G4GRSVolume.hh" // " "
|
||||
#include "G4GRSSolid.hh" // " "
|
||||
#include "G4TouchableHandle.hh" // " "
|
||||
#include "G4TouchableHistoryHandle.hh"
|
||||
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4NormalNavigation.hh"
|
||||
@@ -65,481 +61,469 @@
|
||||
#include <iostream>
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
#define ALTERNATIVE_VOXEL_NAV 1
|
||||
class G4SafetyCalculator;
|
||||
|
||||
class G4Navigator
|
||||
{
|
||||
public: // with description
|
||||
public:
|
||||
|
||||
friend std::ostream& operator << (std::ostream &os, const G4Navigator &n);
|
||||
friend std::ostream& operator << (std::ostream &os, const G4Navigator &n);
|
||||
|
||||
G4Navigator();
|
||||
// Constructor - initialisers and setup.
|
||||
G4Navigator();
|
||||
// Constructor - initialisers and setup.
|
||||
|
||||
G4Navigator(const G4Navigator&) = delete;
|
||||
G4Navigator& operator=(const G4Navigator&) = delete;
|
||||
// Copy constructor & assignment operator not allowed.
|
||||
G4Navigator(const G4Navigator&) = delete;
|
||||
G4Navigator& operator=(const G4Navigator&) = delete;
|
||||
// Copy constructor & assignment operator not allowed.
|
||||
|
||||
virtual ~G4Navigator();
|
||||
// Destructor. No actions.
|
||||
virtual ~G4Navigator();
|
||||
// Destructor. No actions.
|
||||
|
||||
virtual G4double ComputeStep(const G4ThreeVector& pGlobalPoint,
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety);
|
||||
// Calculate the distance to the next boundary intersected
|
||||
// along the specified NORMALISED vector direction and
|
||||
// from the specified point in the global coordinate
|
||||
// system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume
|
||||
// must have been called with the same global point prior to this call.
|
||||
// The isotropic distance to the nearest boundary is also
|
||||
// calculated (usually an underestimate). The current
|
||||
// proposed Step length is used to avoid intersection
|
||||
// calculations: if it can be determined that the nearest
|
||||
// boundary is >pCurrentProposedStepLength away, kInfinity
|
||||
// is returned together with the computed isotropic safety
|
||||
// distance. Geometry must be closed.
|
||||
virtual G4double ComputeStep(const G4ThreeVector& pGlobalPoint,
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety);
|
||||
// Calculate the distance to the next boundary intersected
|
||||
// along the specified NORMALISED vector direction and
|
||||
// from the specified point in the global coordinate
|
||||
// system. LocateGlobalPointAndSetup or LocateGlobalPointWithinVolume
|
||||
// must have been called with the same global point prior to this call.
|
||||
// The isotropic distance to the nearest boundary is also
|
||||
// calculated (usually an underestimate). The current
|
||||
// proposed Step length is used to avoid intersection
|
||||
// calculations: if it can be determined that the nearest
|
||||
// boundary is >pCurrentProposedStepLength away, kInfinity
|
||||
// is returned together with the computed isotropic safety
|
||||
// distance. Geometry must be closed.
|
||||
|
||||
G4double CheckNextStep(const G4ThreeVector& pGlobalPoint,
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety);
|
||||
// Same as above, but do not disturb the state of the Navigator.
|
||||
G4double CheckNextStep(const G4ThreeVector& pGlobalPoint,
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety);
|
||||
// Same as above, but do not disturb the state of the Navigator.
|
||||
|
||||
virtual
|
||||
G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector& point,
|
||||
const G4ThreeVector& direction,
|
||||
const G4TouchableHistory& h);
|
||||
virtual
|
||||
G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector& point,
|
||||
const G4ThreeVector& direction,
|
||||
const G4TouchableHistory& h);
|
||||
|
||||
// Resets the geometrical hierarchy and search for the volumes deepest
|
||||
// in the hierarchy containing the point in the global coordinate space.
|
||||
// The direction is used to check if a volume is entered.
|
||||
// The search begin is the geometrical hierarchy at the location of the
|
||||
// last located point, or the endpoint of the previous Step if
|
||||
// SetGeometricallyLimitedStep() has been called immediately before.
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
// Resets the geometrical hierarchy and search for the volumes deepest
|
||||
// in the hierarchy containing the point in the global coordinate space.
|
||||
// The direction is used to check if a volume is entered.
|
||||
// The search begin is the geometrical hierarchy at the location of the
|
||||
// last located point, or the endpoint of the previous Step if
|
||||
// SetGeometricallyLimitedStep() has been called immediately before.
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
virtual
|
||||
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
|
||||
const G4ThreeVector* direction = nullptr,
|
||||
const G4bool pRelativeSearch = true,
|
||||
const G4bool ignoreDirection = true);
|
||||
// Search the geometrical hierarchy for the volumes deepest in the hierarchy
|
||||
// containing the point in the global coordinate space. Two main cases are:
|
||||
// i) If pRelativeSearch=false it makes use of no previous/state
|
||||
// information. Returns the physical volume containing the point,
|
||||
// with all previous mothers correctly set up.
|
||||
// ii) If pRelativeSearch is set to true, the search begin is the
|
||||
// geometrical hierarchy at the location of the last located point,
|
||||
// or the endpoint of the previous Step if SetGeometricallyLimitedStep()
|
||||
// has been called immediately before.
|
||||
// The direction is used (to check if a volume is entered) if either
|
||||
// - the argument ignoreDirection is false, or
|
||||
// - the Navigator has determined that it is on an edge shared by two or
|
||||
// more volumes. (This is state information.)
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
virtual
|
||||
G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
|
||||
const G4ThreeVector* direction = nullptr,
|
||||
const G4bool pRelativeSearch = true,
|
||||
const G4bool ignoreDirection = true);
|
||||
// Search the geometrical hierarchy for the volumes deepest in hierarchy
|
||||
// containing the point in the global coordinate space. Two main cases
|
||||
// are:
|
||||
// i) If pRelativeSearch=false it makes use of no previous/state
|
||||
// information. Returns the physical volume containing the point,
|
||||
// with all previous mothers correctly set up.
|
||||
// ii) If pRelativeSearch is set to true, the search begin is the
|
||||
// geometrical hierarchy at the location of the last located point,
|
||||
// or the endpoint of previous Step if SetGeometricallyLimitedStep()
|
||||
// has been called immediately before.
|
||||
// The direction is used (to check if a volume is entered) if either
|
||||
// - the argument ignoreDirection is false, or
|
||||
// - the Navigator has determined that it is on an edge shared by two
|
||||
// or more volumes. (This is state information.)
|
||||
//
|
||||
// Important Note: In order to call this the geometry MUST be closed.
|
||||
|
||||
virtual
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
// Notify the Navigator that a track has moved to the new Global point
|
||||
// 'position', that is known to be within the current safety.
|
||||
// No check is performed to ensure that it is within the volume.
|
||||
// This method can be called instead of LocateGlobalPointAndSetup ONLY if
|
||||
// the caller is certain that the new global point (position) is inside the
|
||||
// same volume as the previous position. Usually this can be guaranteed
|
||||
// only if the point is within safety.
|
||||
virtual
|
||||
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
|
||||
// Notify the Navigator that a track has moved to the new Global point
|
||||
// 'position', that is known to be within the current safety.
|
||||
// No check is performed to ensure that it is within the volume.
|
||||
// This method can be called instead of LocateGlobalPointAndSetup ONLY if
|
||||
// the caller is certain that the new global point (position) is inside
|
||||
// the same volume as the previous position.
|
||||
// Usually this can be guaranteed only if the point is within safety.
|
||||
|
||||
inline void LocateGlobalPointAndUpdateTouchableHandle(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4TouchableHandle& oldTouchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// First, search the geometrical hierarchy like the above method
|
||||
// LocateGlobalPointAndSetup(). Then use the volume found and its
|
||||
// navigation history to update the touchable.
|
||||
inline void LocateGlobalPointAndUpdateTouchableHandle(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4TouchableHandle& oldTouchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// First, search the geometrical hierarchy like the above method
|
||||
// LocateGlobalPointAndSetup(). Then use the volume found and its
|
||||
// navigation history to update the touchable.
|
||||
|
||||
inline void LocateGlobalPointAndUpdateTouchable(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4VTouchable* touchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// First, search the geometrical hierarchy like the above method
|
||||
// LocateGlobalPointAndSetup(). Then use the volume found and its
|
||||
// navigation history to update the touchable.
|
||||
inline void LocateGlobalPointAndUpdateTouchable(
|
||||
const G4ThreeVector& position,
|
||||
const G4ThreeVector& direction,
|
||||
G4VTouchable* touchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// First, search the geometrical hierarchy like the above method
|
||||
// LocateGlobalPointAndSetup(). Then use the volume found and its
|
||||
// navigation history to update the touchable.
|
||||
|
||||
inline void LocateGlobalPointAndUpdateTouchable(
|
||||
const G4ThreeVector& position,
|
||||
G4VTouchable* touchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// Same as the method above but missing direction.
|
||||
inline void LocateGlobalPointAndUpdateTouchable(
|
||||
const G4ThreeVector& position,
|
||||
G4VTouchable* touchableToUpdate,
|
||||
const G4bool RelativeSearch = true);
|
||||
// Same as the method above but missing direction.
|
||||
|
||||
inline void SetGeometricallyLimitedStep();
|
||||
// Inform the navigator that the previous Step calculated
|
||||
// by the geometry was taken in its entirety.
|
||||
inline void SetGeometricallyLimitedStep();
|
||||
// Inform the navigator that the previous Step calculated
|
||||
// by the geometry was taken in its entirety.
|
||||
|
||||
virtual G4double ComputeSafety(const G4ThreeVector& globalpoint,
|
||||
const G4double pProposedMaxLength = DBL_MAX,
|
||||
const G4bool keepState = true);
|
||||
// Calculate the isotropic distance to the nearest boundary from the
|
||||
// specified point in the global coordinate system.
|
||||
// The globalpoint utilised must be within the current volume.
|
||||
// The value returned is usually an underestimate.
|
||||
// The proposed maximum length is used to avoid volume safety
|
||||
// calculations. The geometry must be closed.
|
||||
// To ensure minimum side effects from the call, keepState
|
||||
// must be true.
|
||||
virtual G4double ComputeSafety(const G4ThreeVector& globalpoint,
|
||||
const G4double pProposedMaxLength = DBL_MAX,
|
||||
const G4bool keepState = true);
|
||||
// Calculate the isotropic distance to the nearest boundary from the
|
||||
// specified point in the global coordinate system.
|
||||
// The globalpoint utilised must be within the current volume.
|
||||
// The value returned is usually an underestimate.
|
||||
// The proposed maximum length is used to avoid volume safety
|
||||
// calculations. The geometry must be closed.
|
||||
// To ensure minimum side effects from the call, keepState must be true.
|
||||
|
||||
inline G4VPhysicalVolume* GetWorldVolume() const;
|
||||
// Return the current world (`topmost') volume.
|
||||
inline G4VPhysicalVolume* GetWorldVolume() const;
|
||||
// Return the current world (`topmost') volume.
|
||||
|
||||
inline void SetWorldVolume(G4VPhysicalVolume* pWorld);
|
||||
// Set the world (`topmost') volume. This must be positioned at
|
||||
// origin (0,0,0) and unrotated.
|
||||
inline void SetWorldVolume(G4VPhysicalVolume* pWorld);
|
||||
// Set the world (`topmost') volume. This must be positioned at
|
||||
// origin (0,0,0) and unrotated.
|
||||
|
||||
inline G4GRSVolume* CreateGRSVolume() const;
|
||||
inline G4GRSSolid* CreateGRSSolid() const;
|
||||
inline G4TouchableHistory* CreateTouchableHistory() const;
|
||||
inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
|
||||
// `Touchable' creation methods: caller has deletion responsibility.
|
||||
inline G4TouchableHistory* CreateTouchableHistory() const;
|
||||
inline G4TouchableHistory* CreateTouchableHistory(const G4NavigationHistory*) const;
|
||||
// `Touchable' creation methods: caller has deletion responsibility.
|
||||
|
||||
virtual G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
|
||||
// Returns a reference counted handle to a touchable history.
|
||||
virtual G4TouchableHandle CreateTouchableHistoryHandle() const;
|
||||
// Returns a reference counted handle to a touchable history.
|
||||
|
||||
virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
|
||||
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector& point,
|
||||
G4bool* valid);
|
||||
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point,
|
||||
G4bool* valid);
|
||||
// Return Exit Surface Normal and validity too.
|
||||
// Can only be called if the Navigator's last Step has crossed a
|
||||
// volume geometrical boundary.
|
||||
// It returns the Normal to the surface pointing out of the volume that
|
||||
// was left behind and/or into the volume that was entered.
|
||||
// Convention:
|
||||
// The *local* normal is in the coordinate system of the *final* volume.
|
||||
// Restriction:
|
||||
// Normals are not available for replica volumes (returns valid= false)
|
||||
// These methods takes full care about how to calculate this normal,
|
||||
// but if the surfaces are not convex it will return valid=false.
|
||||
virtual G4ThreeVector GetLocalExitNormal(G4bool* valid);
|
||||
virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector& point,
|
||||
G4bool* valid);
|
||||
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector& point,
|
||||
G4bool* valid);
|
||||
// Return Exit Surface Normal and validity too.
|
||||
// Can only be called if the Navigator's last Step has crossed a
|
||||
// volume geometrical boundary.
|
||||
// It returns the Normal to the surface pointing out of the volume that
|
||||
// was left behind and/or into the volume that was entered.
|
||||
// Convention:
|
||||
// The *local* normal is in the coordinate system of the *final* volume.
|
||||
// Restriction:
|
||||
// Normals are not available for replica volumes (returns valid= false)
|
||||
// These methods takes full care about how to calculate this normal,
|
||||
// but if the surfaces are not convex it will return valid=false.
|
||||
|
||||
inline G4int GetVerboseLevel() const;
|
||||
inline void SetVerboseLevel(G4int level);
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
inline G4int GetVerboseLevel() const;
|
||||
inline void SetVerboseLevel(G4int level);
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
inline G4bool IsActive() const;
|
||||
// Verify if the navigator is active.
|
||||
inline void Activate(G4bool flag);
|
||||
// Activate/inactivate the navigator.
|
||||
inline G4bool IsActive() const;
|
||||
// Verify if the navigator is active.
|
||||
inline void Activate(G4bool flag);
|
||||
// Activate/inactivate the navigator.
|
||||
|
||||
inline G4bool EnteredDaughterVolume() const;
|
||||
// The purpose of this function is to inform the caller if the track is
|
||||
// entering a daughter volume while exiting from the current volume.
|
||||
// This method returns
|
||||
// - True only in case 1) above, that is when the Step has caused
|
||||
// the track to arrive at a boundary of a daughter.
|
||||
// - False in cases 2), 3) and 4), i.e. in all other cases.
|
||||
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
|
||||
// was not called when it should have been called.
|
||||
inline G4bool ExitedMotherVolume() const;
|
||||
// Verify if the step has exited the mother volume.
|
||||
inline G4bool EnteredDaughterVolume() const;
|
||||
// The purpose of this function is to inform the caller if the track is
|
||||
// entering a daughter volume while exiting from the current volume.
|
||||
// This method returns
|
||||
// - True only in case 1) above, that is when the Step has caused
|
||||
// the track to arrive at a boundary of a daughter.
|
||||
// - False in cases 2), 3) and 4), i.e. in all other cases.
|
||||
// This function is not guaranteed to work if SetGeometricallyLimitedStep()
|
||||
// was not called when it should have been called.
|
||||
inline G4bool ExitedMotherVolume() const;
|
||||
// Verify if the step has exited the mother volume.
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
inline G4bool IsCheckModeActive() const;
|
||||
inline void SetPushVerbosity(G4bool mode);
|
||||
// Set/unset verbosity for pushed tracks (default is true).
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
inline G4bool IsCheckModeActive() const;
|
||||
inline void SetPushVerbosity(G4bool mode);
|
||||
// Set/unset verbosity for pushed tracks (default is true).
|
||||
|
||||
void PrintState() const;
|
||||
// Print the internal state of the Navigator (for debugging).
|
||||
// The level of detail is according to the verbosity.
|
||||
void PrintState() const;
|
||||
// Print the internal state of the Navigator (for debugging).
|
||||
// The level of detail is according to the verbosity.
|
||||
|
||||
inline const G4AffineTransform& GetGlobalToLocalTransform() const;
|
||||
inline const G4AffineTransform GetLocalToGlobalTransform() const;
|
||||
// Obtain the transformations Global/Local (and inverse).
|
||||
// Clients of these methods must copy the data if they need to keep it.
|
||||
inline const G4AffineTransform& GetGlobalToLocalTransform() const;
|
||||
inline const G4AffineTransform GetLocalToGlobalTransform() const;
|
||||
// Obtain the transformations Global/Local (and inverse).
|
||||
// Clients of these methods must copy the data if they need to keep it.
|
||||
|
||||
G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume* dVolume,
|
||||
G4int dReplicaNo,
|
||||
EVolume dVolumeType );
|
||||
// Obtain mother to daughter transformation
|
||||
G4AffineTransform GetMotherToDaughterTransform(G4VPhysicalVolume* dVolume,
|
||||
G4int dReplicaNo,
|
||||
EVolume dVolumeType );
|
||||
// Obtain mother to daughter transformation.
|
||||
|
||||
inline void ResetStackAndState();
|
||||
// Reset stack and minimum or navigator state machine necessary for reset
|
||||
// as needed by LocalGlobalPointAndSetup.
|
||||
// [Does not perform clears, resizes, or reset fLastLocatedPointLocal]
|
||||
inline void ResetStackAndState();
|
||||
// Reset stack and minimum or navigator state machine necessary for reset
|
||||
// as needed by LocalGlobalPointAndSetup.
|
||||
// Does not perform clears, resizes, or reset fLastLocatedPointLocal.
|
||||
|
||||
inline G4int SeverityOfZeroStepping( G4int* noZeroSteps ) const;
|
||||
// Report on severity of error and number of zero steps,
|
||||
// in case Navigator is stuck and is returning zero steps.
|
||||
// Values: 1 (small problem), 5 (correcting),
|
||||
// 9 (ready to abandon), 10 (abandoned)
|
||||
inline G4int SeverityOfZeroStepping( G4int* noZeroSteps ) const;
|
||||
// Report on severity of error and number of zero steps,
|
||||
// in case Navigator is stuck and is returning zero steps.
|
||||
// Values: 1 (small problem), 5 (correcting),
|
||||
// 9 (ready to abandon), 10 (abandoned)
|
||||
|
||||
inline G4ThreeVector GetCurrentLocalCoordinate() const;
|
||||
// Return the local coordinate of the point in the reference system
|
||||
// of its containing volume that was found by LocalGlobalPointAndSetup.
|
||||
// The local coordinate of the last located track.
|
||||
inline G4ThreeVector GetCurrentLocalCoordinate() const;
|
||||
// Return the local coordinate of the point in the reference system
|
||||
// of its containing volume that was found by LocalGlobalPointAndSetup.
|
||||
// The local coordinate of the last located track.
|
||||
|
||||
inline G4ThreeVector NetTranslation() const;
|
||||
inline G4RotationMatrix NetRotation() const;
|
||||
// Compute+return the local->global translation/rotation of current volume.
|
||||
inline G4ThreeVector NetTranslation() const;
|
||||
inline G4RotationMatrix NetRotation() const;
|
||||
// Compute+return the local->global translation/rotation of current volume.
|
||||
|
||||
inline void EnableBestSafety( G4bool value = false );
|
||||
// Enable best-possible evaluation of isotropic safety.
|
||||
inline void EnableBestSafety( G4bool value = false );
|
||||
// Enable best-possible evaluation of isotropic safety.
|
||||
|
||||
inline G4VExternalNavigation* GetExternalNavigation() const;
|
||||
inline void SetExternalNavigation(G4VExternalNavigation* externalNav);
|
||||
// Accessor & modifier for custom external navigation.
|
||||
inline G4VExternalNavigation* GetExternalNavigation() const;
|
||||
void SetExternalNavigation(G4VExternalNavigation* externalNav);
|
||||
// Accessor & modifier for custom external navigation.
|
||||
|
||||
inline G4Navigator* Clone() const;
|
||||
// Cloning feature for use in MT applications to clone
|
||||
// navigator, including external sub-navigator.
|
||||
// Client has responsibility for ownership of returned allocated pointer.
|
||||
inline G4VoxelNavigation& GetVoxelNavigator();
|
||||
void SetVoxelNavigation(G4VoxelNavigation* voxelNav);
|
||||
// Alternative navigator for voxel volumes.
|
||||
|
||||
inline G4ThreeVector GetLastStepEndPoint() const { return fStepEndPoint;}
|
||||
// Get endpoint of last step
|
||||
inline G4Navigator* Clone() const;
|
||||
// Cloning feature for use in MT applications to clone
|
||||
// navigator, including external sub-navigator.
|
||||
// Client has responsibility for ownership of returned allocated pointer.
|
||||
|
||||
void InformLastStep(G4double lastStep, G4bool entersDaughtVol, G4bool exitsMotherVol );
|
||||
// Derived navigators which rely on LocateGlobalPointAndSetup
|
||||
// need to inform size of step -- to maintain logic about
|
||||
// arriving on boundary for challenging cases.
|
||||
// Required in order to cope with multile trials at boundaries
|
||||
// => Locate with use direction rather than simple, fast logic
|
||||
inline G4ThreeVector GetLastStepEndPoint() const { return fStepEndPoint;}
|
||||
// Get endpoint of last step.
|
||||
|
||||
protected: // with description
|
||||
void InformLastStep(G4double lastStep,
|
||||
G4bool entersDaughtVol,
|
||||
G4bool exitsMotherVol );
|
||||
// Derived navigators which rely on LocateGlobalPointAndSetup() need to
|
||||
// inform size of step, to maintain logic about arriving on boundary
|
||||
// for challenging cases.
|
||||
// Required in order to cope with multiple trials at boundaries
|
||||
// => Locate with use direction rather than simple, fast logic.
|
||||
|
||||
void SetSavedState();
|
||||
// ( fValidExitNormal, fExitNormal, fExiting, fEntering,
|
||||
// fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero);
|
||||
// Extended to include:
|
||||
// ( fLastLocatedPointLocal, fLocatedOutsideWorld;
|
||||
// fEnteredDaughter, fExitedMother
|
||||
// fPreviousSftOrigin, sPreviousSafety) Safety Sphere.
|
||||
protected:
|
||||
|
||||
void RestoreSavedState();
|
||||
// Copy aspects of the state, to enable a non-state changing
|
||||
// call to ComputeStep().
|
||||
void SetSavedState();
|
||||
// ( fValidExitNormal, fExitNormal, fExiting, fEntering,
|
||||
// fBlockedPhysicalVolume, fBlockedReplicaNo, fLastStepWasZero);
|
||||
// Extended to include:
|
||||
// ( fLastLocatedPointLocal, fLocatedOutsideWorld;
|
||||
// fEnteredDaughter, fExitedMother
|
||||
// fPreviousSftOrigin, sPreviousSafety) Safety Sphere.
|
||||
|
||||
void RestoreSavedState();
|
||||
// Copy aspects of the state, to enable a non-state changing
|
||||
// call to ComputeStep().
|
||||
|
||||
virtual void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
virtual void ResetState();
|
||||
// Utility method to reset the navigator state machine.
|
||||
|
||||
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
|
||||
// Return position vector in local coordinate system, given a position
|
||||
// vector in world coordinate system.
|
||||
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
|
||||
// Return position vector in local coordinate system, given a position
|
||||
// vector in world coordinate system.
|
||||
|
||||
inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const;
|
||||
// Return the local direction of the specified vector in the reference
|
||||
// system of the volume that was found by LocalGlobalPointAndSetup.
|
||||
// The Local Coordinates of point in world coordinate system.
|
||||
inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const;
|
||||
// Return the local direction of the specified vector in the reference
|
||||
// system of the volume that was found by LocalGlobalPointAndSetup.
|
||||
// The Local Coordinates of point in world coordinate system.
|
||||
|
||||
inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
|
||||
// Characterise `type' of volume - normal/replicated/parameterised.
|
||||
inline EVolume VolumeType(const G4VPhysicalVolume *pVol) const;
|
||||
// Characterise `type' of volume - normal/replicated/parameterised.
|
||||
|
||||
inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const;
|
||||
// Characterise daughter of logical volume.
|
||||
inline EVolume CharacteriseDaughters(const G4LogicalVolume *pLog) const;
|
||||
// Characterise daughter of logical volume.
|
||||
|
||||
inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLv) const;
|
||||
// Get regular structure ID of first daughter
|
||||
inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume *pLv) const;
|
||||
// Get regular structure ID of first daughter.
|
||||
|
||||
virtual void SetupHierarchy();
|
||||
// Renavigate & reset hierarchy described by current history
|
||||
// o Reset volumes
|
||||
// o Recompute transforms and/or solids of replicated/parameterised
|
||||
// volumes.
|
||||
virtual void SetupHierarchy();
|
||||
// Renavigate & reset hierarchy described by current history:
|
||||
// o Reset volumes and recompute transforms and/or solids of
|
||||
// replicated/parameterised volumes.
|
||||
|
||||
G4bool CheckOverlapsIterative(G4VPhysicalVolume* vol);
|
||||
// Utility method to trigger overlaps check on a volume with reported
|
||||
// overlaps ordered by relevance. Used in ComputeStep() when loopings
|
||||
// with zero step are detected.
|
||||
G4bool CheckOverlapsIterative(G4VPhysicalVolume* vol);
|
||||
// Utility method to trigger overlaps check on a volume with reported
|
||||
// overlaps ordered by relevance. Used in ComputeStep() when loopings
|
||||
// with zero step are detected.
|
||||
|
||||
#ifdef ALTERNATIVE_VOXEL_NAV
|
||||
public:
|
||||
void SetVoxelNavigation(G4VoxelNavigation *voxelNav);
|
||||
// Alternative navigator for voxel volumes -- for use in integrating
|
||||
// VecGeom Navigation
|
||||
#endif
|
||||
private:
|
||||
inline G4VoxelNavigation& GetVoxelNavigator();
|
||||
private:
|
||||
|
||||
private:
|
||||
void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
|
||||
G4double moveLenSq) const;
|
||||
// Log and checks for steps larger than the tolerance.
|
||||
|
||||
void ComputeStepLog(const G4ThreeVector& pGlobalpoint,
|
||||
G4double moveLenSq) const;
|
||||
// Log and checks for steps larger than the tolerance
|
||||
protected:
|
||||
|
||||
protected: // without description
|
||||
G4double kCarTolerance, fMinStep, fSqTol;
|
||||
// Cached tolerances.
|
||||
|
||||
G4double kCarTolerance, fMinStep, fSqTol;
|
||||
// Cached tolerances.
|
||||
//
|
||||
// BEGIN State information
|
||||
//
|
||||
|
||||
//
|
||||
// BEGIN State information
|
||||
//
|
||||
G4NavigationHistory fHistory;
|
||||
// Transformation and history of the current path
|
||||
// through the geometrical hierarchy.
|
||||
|
||||
G4NavigationHistory fHistory;
|
||||
// Transformation and history of the current path
|
||||
// through the geometrical hierarchy.
|
||||
G4ThreeVector fStepEndPoint;
|
||||
// Endpoint of last ComputeStep
|
||||
// can be used for optimisation (e.g. when computing safety).
|
||||
G4ThreeVector fLastStepEndPointLocal;
|
||||
// Position of the end-point of the last call to ComputeStep
|
||||
// in last Local coordinates.
|
||||
|
||||
G4ThreeVector fStepEndPoint;
|
||||
// Endpoint of last ComputeStep
|
||||
// can be used for optimisation (e.g. when computing safety).
|
||||
G4ThreeVector fLastStepEndPointLocal;
|
||||
// Position of the end-point of the last call to ComputeStep
|
||||
// in last Local coordinates.
|
||||
|
||||
G4int fVerbose = 0;
|
||||
// Verbose(ness) level [if > 0, printout can occur].
|
||||
G4int fVerbose = 0;
|
||||
// Verbose(ness) level [if > 0, printout can occur].
|
||||
|
||||
G4bool fEnteredDaughter;
|
||||
// A memory of whether in this Step a daughter volume is entered
|
||||
// (set in Compute & Locate).
|
||||
// After Compute: it expects to enter a daughter
|
||||
// After Locate: it has entered a daughter
|
||||
G4bool fEnteredDaughter;
|
||||
// A memory of whether in this Step a daughter volume is entered
|
||||
// (set in Compute & Locate).
|
||||
// After Compute: it expects to enter a daughter
|
||||
// After Locate: it has entered a daughter.
|
||||
|
||||
G4bool fExitedMother;
|
||||
// A similar memory whether the Step exited current "mother" volume
|
||||
// completely, not entering daughter.
|
||||
G4bool fExitedMother;
|
||||
// A similar memory whether the Step exited current "mother" volume
|
||||
// completely, not entering daughter.
|
||||
|
||||
G4bool fWasLimitedByGeometry = false;
|
||||
// Set true if last Step was limited by geometry.
|
||||
G4bool fWasLimitedByGeometry = false;
|
||||
// Set true if last Step was limited by geometry.
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
G4ThreeVector fLastLocatedPointLocal;
|
||||
// Position of the last located point relative to its containing volume.
|
||||
// This is coupled with the bool member fLocatedOutsideWorld;
|
||||
G4ThreeVector fLastLocatedPointLocal;
|
||||
// Position of the last located point relative to its containing volume.
|
||||
// This is coupled with the bool member fLocatedOutsideWorld;
|
||||
|
||||
G4ThreeVector fExitNormal; // Leaving volume normal, in the
|
||||
// volume containing the exited
|
||||
// volume's coordinate system
|
||||
// This is closely coupled with G4bool fValidExitNormal - which
|
||||
// signals whether we have a (valid) normal for volume we're leaving
|
||||
G4ThreeVector fExitNormal;
|
||||
// Leaving volume normal, in the volume containing the exited
|
||||
// volume's coordinate system.
|
||||
// This is closely coupled with fValidExitNormal, which signals whether
|
||||
// we have a (valid) normal for volume we're leaving.
|
||||
|
||||
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
|
||||
// own coordinate system
|
||||
G4ThreeVector fExitNormalGlobalFrame; // Leaving volume normal, in the
|
||||
// global coordinate system
|
||||
G4ThreeVector fGrandMotherExitNormal;
|
||||
// Leaving volume normal, in its own coordinate system.
|
||||
G4ThreeVector fExitNormalGlobalFrame;
|
||||
// Leaving volume normal, in the global coordinate system.
|
||||
|
||||
G4ThreeVector fPreviousSftOrigin;
|
||||
G4double fPreviousSafety;
|
||||
// Memory of last safety origin & value. Used in ComputeStep to ensure
|
||||
// that origin of current Step is in the same volume as the point of the
|
||||
// last relocation
|
||||
G4ThreeVector fPreviousSftOrigin;
|
||||
G4double fPreviousSafety;
|
||||
// Memory of last safety origin & value. Used in ComputeStep() to ensure
|
||||
// that origin of current Step is in the same volume as the point of the
|
||||
// last relocation.
|
||||
|
||||
G4VPhysicalVolume* fLastMotherPhys = nullptr;
|
||||
// Memory of the mother volume during previous step.
|
||||
// Intended use: inform user in case of stuck track.
|
||||
G4VPhysicalVolume* fLastMotherPhys = nullptr;
|
||||
// Memory of the mother volume during previous step.
|
||||
// Intended use: inform user in case of stuck track.
|
||||
|
||||
G4VPhysicalVolume* fBlockedPhysicalVolume;
|
||||
G4int fBlockedReplicaNo;
|
||||
// Identifies the volume and copy / replica number that is
|
||||
// blocked (after exiting -- because the exit direction is along the exit normal)
|
||||
// or a candidate for entry (after compute step.)
|
||||
G4VPhysicalVolume* fBlockedPhysicalVolume;
|
||||
G4int fBlockedReplicaNo;
|
||||
// Identifies the volume and copy / replica number that is blocked
|
||||
// (after exiting -- because the exit direction is along the exit normal)
|
||||
// or a candidate for entry (after compute step).
|
||||
|
||||
// Count zero steps - as one or two can occur due to changing momentum at
|
||||
// a boundary or at an edge common between volumes
|
||||
// - several are likely a problem in the geometry
|
||||
// description or in the navigation
|
||||
//
|
||||
G4int fNumberZeroSteps;
|
||||
// Number of preceding moves that were Zero. Reset to 0 after finite step
|
||||
G4int fActionThreshold_NoZeroSteps = 10;
|
||||
// After this many failed/zero steps, act (push etc)
|
||||
G4int fAbandonThreshold_NoZeroSteps = 25;
|
||||
// After this many failed/zero steps, abandon track
|
||||
G4int fNumberZeroSteps;
|
||||
// Count zero steps, as one or two can occur due to changing momentum at
|
||||
// a boundary or at an edge common between volumes; several zero steps
|
||||
// are likely a problem in the geometry description or in the navigation.
|
||||
// Number of preceding moves that were Zero. Reset to 0 after finite step.
|
||||
G4int fActionThreshold_NoZeroSteps = 10;
|
||||
// After this many failed/zero steps, act (push etc).
|
||||
G4int fAbandonThreshold_NoZeroSteps = 25;
|
||||
// After this many failed/zero steps, abandon track.
|
||||
|
||||
G4bool fActive = false;
|
||||
// States if the navigator is activated or not.
|
||||
G4bool fActive = false;
|
||||
// States if the navigator is activated or not.
|
||||
|
||||
G4bool fLastTriedStepComputation = false;
|
||||
// Whether ComputeStep was called since the last call to a Locate method
|
||||
// Uses: - distinguish parts of state which differ before/after calls
|
||||
// to ComputeStep or one of the Locate methods;
|
||||
// - avoid two consecutive calls to compute-step (illegal).
|
||||
G4bool fLastTriedStepComputation = false;
|
||||
// Whether ComputeStep() was called since the last call to a Locate().
|
||||
// Uses: distinguish parts of state which differ before/after calls
|
||||
// to ComputeStep() or one of the Locate() methods; avoid two consecutive
|
||||
// calls to compute-step (illegal).
|
||||
|
||||
G4bool fEntering,fExiting;
|
||||
// Entering/Exiting volumes blocking/setup
|
||||
// o If exiting
|
||||
// volume ptr & replica number (set & used by Locate..())
|
||||
// used for blocking on redescent of geometry
|
||||
// o If entering
|
||||
// volume ptr & replica number (set by ComputeStep(),used by
|
||||
// Locate..()) of volume for `automatic' entry
|
||||
G4bool fEntering, fExiting;
|
||||
// Entering/Exiting volumes blocking/setup.
|
||||
// o If exiting, volume ptr & replica number (set & used by Locate..())
|
||||
// used for blocking on redescent of geometry;
|
||||
// o If entering, volume ptr & replica number (set by ComputeStep(),
|
||||
// used by Locate..()) of volume for 'automatic' entry.
|
||||
|
||||
G4bool fValidExitNormal; // Set true if have leaving volume normal
|
||||
G4bool fLastStepWasZero;
|
||||
// Whether the last ComputeStep moved Zero. Used to check for edges.
|
||||
G4bool fLocatedOnEdge;
|
||||
// Whether the Navigator has detected an edge
|
||||
G4bool fLocatedOutsideWorld;
|
||||
// Whether the last call to Locate methods left the world
|
||||
G4bool fValidExitNormal;
|
||||
// Set true if have leaving volume normal.
|
||||
G4bool fLastStepWasZero;
|
||||
// Whether the last ComputeStep moved Zero. Used to check for edges.
|
||||
G4bool fLocatedOnEdge;
|
||||
// Whether the Navigator has detected an edge.
|
||||
G4bool fLocatedOutsideWorld;
|
||||
// Whether the last call to Locate methods left the world.
|
||||
|
||||
G4bool fChangedGrandMotherRefFrame; // Whether frame is changed
|
||||
G4bool fCalculatedExitNormal; // Has it been computed since
|
||||
// the last call to ComputeStep
|
||||
// Covers both Global and GrandMother
|
||||
//
|
||||
// END State information
|
||||
//
|
||||
G4bool fChangedGrandMotherRefFrame;
|
||||
// Whether frame is changed.
|
||||
G4bool fCalculatedExitNormal;
|
||||
// Has it been computed since the last call to ComputeStep().
|
||||
// Covers both Global and GrandMother.
|
||||
|
||||
// Optional State information (created/used as needed)
|
||||
//
|
||||
// END State information
|
||||
//
|
||||
|
||||
// Optional State information (created/used as needed)
|
||||
//
|
||||
|
||||
// Save key state information (NOT the navigation history stack)
|
||||
//
|
||||
struct G4SaveNavigatorState
|
||||
{
|
||||
G4ThreeVector sExitNormal;
|
||||
G4bool sValidExitNormal;
|
||||
G4bool sEntering, sExiting;
|
||||
G4VPhysicalVolume* spBlockedPhysicalVolume;
|
||||
G4int sBlockedReplicaNo;
|
||||
G4int sLastStepWasZero;
|
||||
G4bool sWasLimitedByGeometry;
|
||||
// Save key state information (NOT the navigation history stack)
|
||||
//
|
||||
struct G4SaveNavigatorState
|
||||
{
|
||||
G4ThreeVector sExitNormal;
|
||||
G4bool sValidExitNormal;
|
||||
G4bool sEntering, sExiting;
|
||||
G4VPhysicalVolume* spBlockedPhysicalVolume;
|
||||
G4int sBlockedReplicaNo;
|
||||
G4int sLastStepWasZero;
|
||||
G4bool sWasLimitedByGeometry;
|
||||
|
||||
// Potentially relevant
|
||||
//
|
||||
G4bool sLocatedOutsideWorld;
|
||||
G4ThreeVector sLastLocatedPointLocal;
|
||||
G4bool sEnteredDaughter, sExitedMother;
|
||||
G4ThreeVector sPreviousSftOrigin;
|
||||
G4double sPreviousSafety;
|
||||
} fSaveState;
|
||||
// Potentially relevant
|
||||
//
|
||||
G4bool sLocatedOutsideWorld;
|
||||
G4ThreeVector sLastLocatedPointLocal;
|
||||
G4bool sEnteredDaughter, sExitedMother;
|
||||
G4ThreeVector sPreviousSftOrigin;
|
||||
G4double sPreviousSafety;
|
||||
} fSaveState;
|
||||
|
||||
private:
|
||||
// BEGIN -- Tracking Invariants
|
||||
// ===========================================
|
||||
G4VPhysicalVolume* fTopPhysical = nullptr;
|
||||
// A link to the topmost physical volume in the detector.
|
||||
// Must be positioned at the origin and unrotated.
|
||||
// BEGIN -- Tracking Invariants
|
||||
// ===========================================
|
||||
|
||||
// Helpers/Utility classes
|
||||
//
|
||||
G4NormalNavigation fnormalNav;
|
||||
#ifdef ALTERNATIVE_VOXEL_NAV
|
||||
G4VoxelNavigation* fpvoxelNav;
|
||||
#else
|
||||
G4VoxelNavigation fvoxelNav;
|
||||
#endif
|
||||
G4ParameterisedNavigation fparamNav;
|
||||
G4ReplicaNavigation freplicaNav;
|
||||
G4RegularNavigation fregularNav;
|
||||
G4VExternalNavigation* fpExternalNav = nullptr;
|
||||
G4VoxelSafety* fpVoxelSafety;
|
||||
G4VPhysicalVolume* fTopPhysical = nullptr;
|
||||
// A link to the topmost physical volume in the detector.
|
||||
// Must be positioned at the origin and unrotated.
|
||||
|
||||
// Utility information
|
||||
//
|
||||
G4bool fCheck = false;
|
||||
// Check-mode flag [if true, more strict checks are performed].
|
||||
G4bool fPushed = false, fWarnPush = true;
|
||||
// Push flags [if true, means a stuck particle has been pushed].
|
||||
// Helpers/Utility classes
|
||||
//
|
||||
G4NormalNavigation fnormalNav;
|
||||
G4VoxelNavigation* fpvoxelNav;
|
||||
G4ParameterisedNavigation fparamNav;
|
||||
G4ReplicaNavigation freplicaNav;
|
||||
G4RegularNavigation fregularNav;
|
||||
G4VExternalNavigation* fpExternalNav = nullptr;
|
||||
G4VoxelSafety* fpVoxelSafety;
|
||||
G4SafetyCalculator* fpSafetyCalculator = nullptr;
|
||||
|
||||
// End -- Tracking Invariants
|
||||
// Utility information
|
||||
//
|
||||
G4bool fCheck = false;
|
||||
// Check-mode flag [if true, more strict checks are performed].
|
||||
G4bool fPushed = false, fWarnPush = true;
|
||||
// Push flags [if true, means a stuck particle has been pushed].
|
||||
|
||||
// End -- Tracking Invariants
|
||||
};
|
||||
|
||||
#include "G4Navigator.icc"
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4Navigator Inline implementation
|
||||
// G4Navigator class Inline implementation
|
||||
//
|
||||
// ********************************************************************
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// ********************************************************************
|
||||
// GetCurrentLocalCoordinate
|
||||
@@ -215,36 +215,6 @@ G4RotationMatrix G4Navigator::NetRotation() const
|
||||
return fHistory.GetTopTransform().InverseNetRotation();
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CreateGRSVolume
|
||||
//
|
||||
// `Touchable' creation method: caller has deletion responsibility
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4GRSVolume* G4Navigator::CreateGRSVolume() const
|
||||
{
|
||||
const G4AffineTransform& tf = fHistory.GetTopTransform();
|
||||
return new G4GRSVolume(fHistory.GetTopVolume(),
|
||||
tf.InverseNetRotation(),
|
||||
tf.InverseNetTranslation());
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CreateGRSSolid
|
||||
//
|
||||
// `Touchable' creation method: caller has deletion responsibility
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4GRSSolid* G4Navigator::CreateGRSSolid() const
|
||||
{
|
||||
const G4AffineTransform& tf = fHistory.GetTopTransform();
|
||||
return new G4GRSSolid(fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid(),
|
||||
tf.InverseNetRotation(),
|
||||
tf.InverseNetTranslation());
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CreateTouchableHistory
|
||||
//
|
||||
@@ -478,12 +448,9 @@ G4int G4Navigator::SeverityOfZeroStepping( G4int* noZeroSteps ) const
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
G4VoxelNavigation& G4Navigator::GetVoxelNavigator() {
|
||||
#ifdef ALTERNATIVE_VOXEL_NAV
|
||||
return *fpvoxelNav;
|
||||
#else
|
||||
return fvoxelNav;
|
||||
#endif
|
||||
G4VoxelNavigation& G4Navigator::GetVoxelNavigator()
|
||||
{
|
||||
return *fpvoxelNav;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -505,16 +472,6 @@ G4VExternalNavigation* G4Navigator::GetExternalNavigation() const
|
||||
return fpExternalNav;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetExternalNavigation
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4Navigator::SetExternalNavigation(G4VExternalNavigation* externalNav)
|
||||
{
|
||||
fpExternalNav = externalNav;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Clone
|
||||
// ********************************************************************
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4VNavigation.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
@@ -48,7 +49,7 @@
|
||||
|
||||
class G4NavigationLogger;
|
||||
|
||||
class G4NormalNavigation
|
||||
class G4NormalNavigation : public G4VNavigation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
@@ -64,7 +65,7 @@ class G4NormalNavigation
|
||||
const G4ThreeVector &globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector &localPoint);
|
||||
G4ThreeVector &localPoint) final;
|
||||
// Search positioned volumes in mother at current top level of history
|
||||
// for volume containing globalPoint. Do not test the blocked volume.
|
||||
// If a containing volume is found, `stack' the new volume and return
|
||||
@@ -82,25 +83,18 @@ class G4NormalNavigation
|
||||
G4bool &exiting,
|
||||
G4bool &entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int &blockedReplicaNo );
|
||||
G4int &blockedReplicaNo ) final;
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector &globalpoint,
|
||||
const G4NavigationHistory &history,
|
||||
const G4double pMaxLength=DBL_MAX );
|
||||
const G4double pMaxLength=DBL_MAX ) final;
|
||||
|
||||
G4int GetVerboseLevel() const;
|
||||
void SetVerboseLevel(G4int level);
|
||||
virtual G4int GetVerboseLevel() const final;
|
||||
virtual void SetVerboseLevel(G4int level) final;
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
|
||||
private:
|
||||
|
||||
G4bool fCheck = false;
|
||||
G4NavigationLogger* fLogger;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,16 +27,6 @@
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// ********************************************************************
|
||||
// CheckMode
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4NormalNavigation::CheckMode(G4bool mode)
|
||||
{
|
||||
fCheck = mode;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// LevelLocate
|
||||
// ********************************************************************
|
||||
|
||||
@@ -85,6 +85,9 @@ class G4ParameterisedNavigation : public G4VoxelNavigation
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pProposedMaxLength=DBL_MAX ) override;
|
||||
|
||||
void RelocateWithinVolume( G4VPhysicalVolume* motherPhysical,
|
||||
const G4ThreeVector& localPoint ) override;
|
||||
|
||||
private:
|
||||
|
||||
G4double ComputeVoxelSafety( const G4ThreeVector& localPoint,
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
#include "G4Types.hh"
|
||||
#include "G4PhantomParameterisation.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4VTouchable;
|
||||
class G4VSolid;
|
||||
class G4Material;
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
#include "G4Types.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4VTouchable;
|
||||
class G4VSolid;
|
||||
class G4Material;
|
||||
|
||||
|
||||
@@ -41,13 +41,14 @@
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VNavigation.hh"
|
||||
|
||||
class G4NormalNavigation;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Navigator;
|
||||
class G4NavigationHistory;
|
||||
|
||||
class G4RegularNavigation
|
||||
class G4RegularNavigation : public G4VNavigation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
@@ -60,7 +61,7 @@ class G4RegularNavigation
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint );
|
||||
G4ThreeVector& localPoint ) final;
|
||||
// Locate point using its position with respect to regular
|
||||
// parameterisation container volume.
|
||||
|
||||
@@ -74,7 +75,7 @@ class G4RegularNavigation
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume *(*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo );
|
||||
G4int& blockedReplicaNo ) final;
|
||||
// Method never called because to be called the daughter has to be a
|
||||
// 'regular' volume. This would only happen if the track is in the
|
||||
// mother of voxels volume. But the voxels fill completely their mother,
|
||||
@@ -100,7 +101,7 @@ class G4RegularNavigation
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& localPoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pProposedMaxLength = DBL_MAX );
|
||||
const G4double pProposedMaxLength = DBL_MAX ) final;
|
||||
// Method never called because to be called the daughter has to be a
|
||||
// 'regular' volume. This would only happen if the track is in the
|
||||
// mother of voxels volume. But the voxels fill completely their mother,
|
||||
@@ -108,18 +109,11 @@ class G4RegularNavigation
|
||||
|
||||
public: // without description
|
||||
|
||||
// Set and Get methods
|
||||
|
||||
void SetVerboseLevel(G4int level) { fverbose = level; }
|
||||
void CheckMode(G4bool mode) { fcheck = mode; }
|
||||
void SetNormalNavigation( G4NormalNavigation* fnormnav )
|
||||
{ fnormalNav = fnormnav; }
|
||||
|
||||
private:
|
||||
|
||||
G4int fverbose = 0;
|
||||
G4bool fcheck = false;
|
||||
|
||||
G4NormalNavigation* fnormalNav = nullptr;
|
||||
G4double kCarTolerance;
|
||||
G4double fMinStep;
|
||||
|
||||
@@ -107,8 +107,8 @@ class G4ReplicaNavigation
|
||||
|
||||
G4double ComputeSafety( const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector& localPoint,
|
||||
G4NavigationHistory& history,
|
||||
const G4double pProposedMaxLength = DBL_MAX );
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pProposedMaxLength = DBL_MAX ) const;
|
||||
|
||||
EInside BackLocate( G4NavigationHistory &history,
|
||||
const G4ThreeVector& globalPoint,
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4SafetyCalculator
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A class that provides an estimate of the isotropic safety - the
|
||||
// minimum distance from a global point to the nearest boundary
|
||||
// of the current volume or the nearest daughter volumes.
|
||||
// This estimate can be an underestimate, either because a solid
|
||||
// provides an underestimate (for speed) or in order to avoid
|
||||
// substantial additional computations.
|
||||
//
|
||||
// Obtains from the navigator the current transformation history.
|
||||
|
||||
// Author: John Apostolakis, CERN - February 2023
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4SafetyCalculator_HH
|
||||
#define G4SafetyCalculator_HH 1
|
||||
|
||||
#include "geomdefs.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
#include "G4LogicalVolume.hh" // Used in inline methods
|
||||
#include "G4TouchableHistoryHandle.hh"
|
||||
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4NormalNavigation.hh"
|
||||
#include "G4VoxelNavigation.hh"
|
||||
#include "G4ParameterisedNavigation.hh"
|
||||
#include "G4ReplicaNavigation.hh"
|
||||
#include "G4RegularNavigation.hh"
|
||||
#include "G4VExternalNavigation.hh"
|
||||
|
||||
#include "G4VoxelSafety.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4SafetyCalculator
|
||||
{
|
||||
public:
|
||||
|
||||
G4SafetyCalculator( const G4Navigator& navigator,
|
||||
const G4NavigationHistory& navHistory );
|
||||
// Constructor - initialisers and setup.
|
||||
|
||||
G4SafetyCalculator(const G4SafetyCalculator&) = delete;
|
||||
G4SafetyCalculator& operator=(const G4SafetyCalculator&) = delete;
|
||||
// Copy constructor & assignment operator not allowed.
|
||||
|
||||
~G4SafetyCalculator() = default;
|
||||
// Destructor. No actions.
|
||||
|
||||
G4double SafetyInCurrentVolume(const G4ThreeVector& globalpoint,
|
||||
G4VPhysicalVolume* physicalVolume,
|
||||
const G4double pProposedMaxLength = DBL_MAX,
|
||||
G4bool verbose = false );
|
||||
// Calculate the isotropic distance to the nearest boundary from the
|
||||
// specified point in the global coordinate system.
|
||||
// The globalpoint utilised *must* be located exactly within the
|
||||
// current volume (it also must *not* be in a daughter volume).
|
||||
// The value returned can be an underestimate (and typically will be
|
||||
// if complex volumes are involved).
|
||||
// The calculation will not look beyond the proposed maximum length
|
||||
// to avoid extra volume safety calculations. The geometry must be closed.
|
||||
|
||||
G4VExternalNavigation* GetExternalNavigation() const;
|
||||
void SetExternalNavigation(G4VExternalNavigation* externalNav);
|
||||
// Accessor & modifier for custom external navigation.
|
||||
|
||||
void CompareSafetyValues( G4double oldSafety,
|
||||
G4double newValue,
|
||||
G4VPhysicalVolume* motherPhysical,
|
||||
const G4ThreeVector &globalPoint,
|
||||
G4bool keepState,
|
||||
G4double maxLength,
|
||||
G4bool enteredVolume,
|
||||
G4bool exitedVolume );
|
||||
// Compare estimates of the safety, and report if difference(s) found.
|
||||
|
||||
protected:
|
||||
|
||||
void QuickLocateWithinVolume(const G4ThreeVector& pointLocal,
|
||||
G4VPhysicalVolume* motherPhysical);
|
||||
// Prepare state of sub-navigators by informing them of current point.
|
||||
|
||||
inline G4ThreeVector ComputeLocalPoint(const G4ThreeVector& rGlobPoint) const;
|
||||
// Return position vector in local coordinate system, given a position
|
||||
// vector in world coordinate system.
|
||||
|
||||
inline G4ThreeVector ComputeLocalAxis(const G4ThreeVector& pVec) const;
|
||||
// Return the local direction of the specified vector in the reference
|
||||
// system of the volume that was found by LocalGlobalPointAndSetup().
|
||||
// The Local Coordinates of point in world coordinate system.
|
||||
|
||||
inline EVolume CharacteriseDaughters(const G4LogicalVolume* pLog) const;
|
||||
// Characterise daughter of logical volume.
|
||||
|
||||
inline G4int GetDaughtersRegularStructureId(const G4LogicalVolume* pLv) const;
|
||||
// Get regular structure ID of first daughter.
|
||||
|
||||
private:
|
||||
|
||||
// BEGIN -- Tracking Invariants part 1
|
||||
//
|
||||
const G4Navigator& fNavigator;
|
||||
// Associated navigator. Needed for details of current state,
|
||||
// for optimisation
|
||||
|
||||
const G4NavigationHistory& fNavHistory;
|
||||
// Associated navigator's navigation history. Transformation and history
|
||||
// of the current path through the geometrical hierarchy.
|
||||
//
|
||||
// END -- Tracking Invariants part 1
|
||||
|
||||
G4double fkCarTolerance;
|
||||
// Cached tolerance.
|
||||
|
||||
// BEGIN State information
|
||||
//
|
||||
G4ThreeVector fPreviousSftOrigin;
|
||||
G4double fPreviousSafety = 0.0;
|
||||
// Memory of last safety origin & value. Used in ComputeStep to ensure
|
||||
// that origin of current Step is in the same volume as the point of the
|
||||
// last relocation.
|
||||
|
||||
// Helpers/Utility classes - their state can change
|
||||
//
|
||||
G4NormalNavigation fnormalNav;
|
||||
G4VoxelNavigation fvoxelNav;
|
||||
G4ParameterisedNavigation fparamNav;
|
||||
G4ReplicaNavigation freplicaNav;
|
||||
G4RegularNavigation fregularNav;
|
||||
G4VExternalNavigation* fpExternalNav = nullptr;
|
||||
G4VoxelSafety fVoxelSafety;
|
||||
};
|
||||
|
||||
// Auxiliary inline methods -- copied from G4Navigator
|
||||
|
||||
// Return local coordinates given point in the world coord system.
|
||||
//
|
||||
inline G4ThreeVector
|
||||
G4SafetyCalculator::ComputeLocalPoint(const G4ThreeVector& pGlobalPoint) const
|
||||
{
|
||||
return fNavHistory.GetTopTransform().TransformPoint(pGlobalPoint);
|
||||
}
|
||||
|
||||
// Returns local direction given vector direction in world coord system.
|
||||
//
|
||||
inline G4ThreeVector
|
||||
G4SafetyCalculator::ComputeLocalAxis(const G4ThreeVector& pVec) const
|
||||
{
|
||||
return fNavHistory.GetTopTransform().TransformAxis(pVec);
|
||||
}
|
||||
|
||||
inline EVolume
|
||||
G4SafetyCalculator::CharacteriseDaughters(const G4LogicalVolume* pLog) const
|
||||
{
|
||||
return pLog->CharacteriseDaughters();
|
||||
}
|
||||
|
||||
inline G4int
|
||||
G4SafetyCalculator::GetDaughtersRegularStructureId(const G4LogicalVolume* pLog) const
|
||||
{
|
||||
G4int regId = 0;
|
||||
G4VPhysicalVolume *pVol;
|
||||
|
||||
if ( pLog->GetNoDaughters() == 1 )
|
||||
{
|
||||
pVol = pLog->GetDaughter(0);
|
||||
regId = pVol->GetRegularStructureId();
|
||||
}
|
||||
return regId;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -35,13 +35,14 @@
|
||||
#ifndef G4VEXTERNALNAVIGATION_HH
|
||||
#define G4VEXTERNALNAVIGATION_HH
|
||||
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VNavigation.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
class G4VExternalNavigation
|
||||
class G4VExternalNavigation : public G4VNavigation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
@@ -50,45 +51,6 @@ class G4VExternalNavigation
|
||||
|
||||
virtual ~G4VExternalNavigation();
|
||||
// Destructor
|
||||
|
||||
virtual G4bool LevelLocate( G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume* blockedVol,
|
||||
const G4int blockedNum,
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint) = 0;
|
||||
// Search positioned volumes in mother at current top level of history
|
||||
// for volume containing globalPoint. Do not test the blocked volume.
|
||||
// If a containing volume is found, `stack' the new volume and return
|
||||
// true, else return false (the point lying in the mother but not any
|
||||
// of the daughters). localPoint = global point in local system on entry,
|
||||
// point in new system on exit.
|
||||
|
||||
virtual G4double ComputeStep( const G4ThreeVector& localPoint,
|
||||
const G4ThreeVector& localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double& newSafety,
|
||||
G4NavigationHistory& history,
|
||||
G4bool& validExitNormal,
|
||||
G4ThreeVector& exitNormal,
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume** pBlockedPhysical,
|
||||
G4int& blockedReplicaNo ) = 0;
|
||||
// Compute the length of a step to the next boundary.
|
||||
// Ignore the (input) pBlockedPhysical volume (with replica/parameterisation
|
||||
// number 'blockedReplica')
|
||||
// Identify the next candidate volume (if a daughter of current volume),
|
||||
// and return it in pBlockedPhysical, blockedReplicaNo
|
||||
// In/Out Navigation history: to be update for volume of next intersection.
|
||||
// In/out 'newsafety' is the known isotropic safety of the initial point:
|
||||
// an earlier (likely crude) estimate on input,
|
||||
// to be updated with new estimate for the same (start) point.
|
||||
|
||||
virtual G4double ComputeSafety( const G4ThreeVector& globalpoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pMaxLength = DBL_MAX ) = 0;
|
||||
|
||||
virtual G4VExternalNavigation* Clone() = 0;
|
||||
|
||||
@@ -105,20 +67,6 @@ class G4VExternalNavigation
|
||||
// Update any relevant internal state to take account that
|
||||
// - the location has been moved to 'localPoint'
|
||||
// - it remains in the current (mother) physical volume 'motherPhysical'
|
||||
|
||||
inline G4int GetVerboseLevel() const { return fVerbose; }
|
||||
inline void SetVerboseLevel(G4int level) { fVerbose = level; }
|
||||
// Get/Set verbosity level.
|
||||
|
||||
inline void CheckMode(G4bool mode) { fCheck = mode; }
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Should be effective only with G4VERBOSE set.
|
||||
|
||||
protected:
|
||||
|
||||
G4bool fCheck = false;
|
||||
G4int fVerbose = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4VNavigation
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Navigation interface common between all navigator types.
|
||||
|
||||
// Author: G. Amadio - CERN, March 2022
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4VNAVIGATION_HH
|
||||
#define G4VNAVIGATION_HH
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4NavigationHistory;
|
||||
|
||||
/**
|
||||
* @brief G4VNavigation class holds the common navigation interface
|
||||
* for all geometry navigator types.
|
||||
*/
|
||||
|
||||
class G4VNavigation
|
||||
{
|
||||
public:
|
||||
/** Virtual Destructor. */
|
||||
virtual ~G4VNavigation() {}
|
||||
|
||||
/**
|
||||
* Search positioned volumes in mother at current top level of @p history
|
||||
* for volume containing @p globalPoint. Do not test against @p blockedVol.
|
||||
* If a containing volume is found, push it onto navigation history state.
|
||||
* @param[in,out] history Navigation history.
|
||||
* @param[in,out] blockedVol Blocked volume that should be ignored in queries.
|
||||
* @param[in,out] blockedNum Copy number for blocked replica volumes.
|
||||
* @param[in,out] globalPoint Global point
|
||||
* @param[in,out] globalDirection Pointer to global direction or null pointer.
|
||||
* @param[in,out] localPoint = global point in local system on entry, point
|
||||
* in new system on exit.
|
||||
* @returns Whether a containing volume has been found.
|
||||
*/
|
||||
virtual G4bool LevelLocate(G4NavigationHistory& history,
|
||||
const G4VPhysicalVolume* blockedVol,
|
||||
const G4int blockedNum,
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint) = 0;
|
||||
|
||||
/**
|
||||
* Compute the length of a step to the next boundary.
|
||||
* Do not test against @p pBlockedPhysical. Identify the next candidate volume
|
||||
* (if a daughter of current volume), and return it in pBlockedPhysical,
|
||||
* blockedReplicaNo.
|
||||
* @param[in] localPoint Local point
|
||||
* @param[in] localDirection Pointer to local direction or null pointer.
|
||||
* @param[in] currentProposedStepLength Current proposed step length.
|
||||
* @param[in,out] newSafety New safety.
|
||||
* @param[in,out] history Navigation history.
|
||||
* @param[in,out] validExitNormal Flag to indicate whether exit normal is
|
||||
* valid or not.
|
||||
* @param[in,out] exitNormal Exit normal.
|
||||
* @param[in,out] entering Flag to indicate whether we are entering a volume.
|
||||
* @param[in,out] exiting Flag to indicate whether we are exiting a volume.
|
||||
* @param[in,out] pBlockedPhysical Blocked physical volume that should be
|
||||
* ignored in queries.
|
||||
* @param[in,out] blockedReplicaNo Copy number for blocked replica volumes.
|
||||
* @returns Length from current point to next boundary surface along @p
|
||||
* localDirection.
|
||||
*/
|
||||
virtual G4double ComputeStep(const G4ThreeVector& localPoint,
|
||||
const G4ThreeVector& localDirection,
|
||||
const G4double currentProposedStepLength,
|
||||
G4double& newSafety,
|
||||
G4NavigationHistory& history,
|
||||
G4bool& validExitNormal,
|
||||
G4ThreeVector& exitNormal,
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume*(*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo) = 0;
|
||||
|
||||
/**
|
||||
* Compute the distance to the closest surface.
|
||||
* @param[in] globalPoint Global point.
|
||||
* @param[in] history Navigation history.
|
||||
* @param[in] pMaxLength Maximum step length beyond which volumes need not be
|
||||
* checked.
|
||||
* @returns Length from current point to closest surface.
|
||||
*/
|
||||
virtual G4double ComputeSafety(const G4ThreeVector& globalpoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pMaxLength = DBL_MAX) = 0;
|
||||
|
||||
/**
|
||||
* Update internal navigation state to take into account that location
|
||||
* has been moved, but remains within the @p motherPhysical volume.
|
||||
* @param[in] motherPhysical Current physical volume.
|
||||
* @param[in] localPoint Local point.
|
||||
*/
|
||||
virtual void RelocateWithinVolume(G4VPhysicalVolume* /* motherPhysical */,
|
||||
const G4ThreeVector& /* localPoint */)
|
||||
{
|
||||
/* do nothing by default */
|
||||
}
|
||||
|
||||
/** Get current verbosity level */
|
||||
virtual G4int GetVerboseLevel() const { return fVerbose; }
|
||||
|
||||
/** Set current verbosity level */
|
||||
virtual void SetVerboseLevel(G4int level) { fVerbose = level; }
|
||||
|
||||
/**
|
||||
* Set check mode.
|
||||
* When enabled, forces navigator to run in "check mode", hence using
|
||||
* additional verifications and stricter condictions for ensuring correctness.
|
||||
* Effective only when G4VERBOSE is enabled.
|
||||
*/
|
||||
void CheckMode(G4bool mode) { fCheck = mode; }
|
||||
|
||||
protected:
|
||||
G4int fVerbose = 0;
|
||||
G4bool fCheck = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -37,6 +37,7 @@
|
||||
#define G4VOXELNAVIGATION_HH
|
||||
|
||||
#include "geomdefs.hh"
|
||||
#include "G4VNavigation.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
#include "G4NavigationLogger.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
@@ -60,7 +61,7 @@ class G4VoxelSafety;
|
||||
#include "G4SmartVoxelNode.hh"
|
||||
#include "G4SmartVoxelHeader.hh"
|
||||
|
||||
class G4VoxelNavigation
|
||||
class G4VoxelNavigation : public G4VNavigation
|
||||
{
|
||||
public: // with description
|
||||
|
||||
@@ -76,7 +77,7 @@ class G4VoxelNavigation
|
||||
const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector* globalDirection,
|
||||
const G4bool pLocatedOnEdge,
|
||||
G4ThreeVector& localPoint );
|
||||
G4ThreeVector& localPoint ) override;
|
||||
|
||||
virtual G4double ComputeStep( const G4ThreeVector& globalPoint,
|
||||
const G4ThreeVector& globalDirection,
|
||||
@@ -88,22 +89,20 @@ class G4VoxelNavigation
|
||||
G4bool& exiting,
|
||||
G4bool& entering,
|
||||
G4VPhysicalVolume* (*pBlockedPhysical),
|
||||
G4int& blockedReplicaNo );
|
||||
G4int& blockedReplicaNo ) override;
|
||||
|
||||
virtual G4double ComputeSafety( const G4ThreeVector& globalpoint,
|
||||
const G4NavigationHistory& history,
|
||||
const G4double pMaxLength = DBL_MAX );
|
||||
const G4double pMaxLength = DBL_MAX ) override;
|
||||
|
||||
inline G4int GetVerboseLevel() const;
|
||||
void SetVerboseLevel(G4int level);
|
||||
virtual void RelocateWithinVolume( G4VPhysicalVolume* motherPhysical,
|
||||
const G4ThreeVector& localPoint ) override;
|
||||
|
||||
virtual G4int GetVerboseLevel() const override;
|
||||
virtual void SetVerboseLevel(G4int level) override;
|
||||
// Get/Set Verbose(ness) level.
|
||||
// [if level>0 && G4VERBOSE, printout can occur]
|
||||
|
||||
inline void CheckMode(G4bool mode);
|
||||
// Run navigation in "check-mode", therefore using additional
|
||||
// verifications and more strict correctness conditions.
|
||||
// Is effective only with G4VERBOSE set.
|
||||
|
||||
inline void EnableBestSafety( G4bool flag = false );
|
||||
// Enable best-possible evaluation of isotropic safety
|
||||
|
||||
@@ -182,7 +181,6 @@ class G4VoxelNavigation
|
||||
G4double fHalfTolerance;
|
||||
// Surface tolerance
|
||||
|
||||
G4bool fCheck = false;
|
||||
G4bool fBestSafety = false;
|
||||
|
||||
G4NavigationLogger* fLogger;
|
||||
|
||||
@@ -163,16 +163,6 @@ G4int G4VoxelNavigation::GetVerboseLevel() const
|
||||
return fLogger->GetVerboseLevel();
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// CheckMode
|
||||
// ********************************************************************
|
||||
//
|
||||
inline
|
||||
void G4VoxelNavigation::CheckMode(G4bool mode)
|
||||
{
|
||||
fCheck = mode;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// EnableBestSafety
|
||||
// ********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user