Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ErrorPropagationNavigator Class Reference

G4ErrorPropagationNavigator is a class for performing double navigation in the detector geometry and on the target surface for error propagation. It overloads ComputeStep() and ComputeSafety() methods. More...

#include <G4ErrorPropagationNavigator.hh>

Inheritance diagram for G4ErrorPropagationNavigator:

Public Member Functions

 G4ErrorPropagationNavigator ()=default
 ~G4ErrorPropagationNavigator () override=default
G4double ComputeStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety) override
G4double ComputeSafety (const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true) override
G4ThreeVector GetGlobalExitNormal (const G4ThreeVector &point, G4bool *valid) override
G4double TargetSafetyFromPoint (const G4ThreeVector &pGlobalpoint)
Public Member Functions inherited from G4Navigator
 G4Navigator ()
 G4Navigator (const G4Navigator &)=delete
G4Navigatoroperator= (const G4Navigator &)=delete
virtual ~G4Navigator ()
G4double CheckNextStep (const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
virtual G4VPhysicalVolumeResetHierarchyAndLocate (const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
virtual G4VPhysicalVolumeLocateGlobalPointAndSetup (const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual void LocateGlobalPointWithinVolume (const G4ThreeVector &position)
void LocateGlobalPointAndUpdateTouchableHandle (const G4ThreeVector &position, const G4ThreeVector &direction, G4TouchableHandle &oldTouchableToUpdate, const G4bool RelativeSearch=true)
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, const G4ThreeVector &direction, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
void LocateGlobalPointAndUpdateTouchable (const G4ThreeVector &position, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
void SetGeometricallyLimitedStep ()
G4VPhysicalVolumeGetWorldVolume () const
void SetWorldVolume (G4VPhysicalVolume *pWorld)
G4TouchableHistoryCreateTouchableHistory () const
G4TouchableHistoryCreateTouchableHistory (const G4NavigationHistory *h) const
virtual G4TouchableHandle CreateTouchableHistoryHandle () const
virtual G4ThreeVector GetLocalExitNormal (G4bool *valid)
virtual G4ThreeVector GetLocalExitNormalAndCheck (const G4ThreeVector &point, G4bool *valid)
G4int GetVerboseLevel () const
void SetVerboseLevel (G4int level)
G4bool IsActive () const
void Activate (G4bool flag)
G4bool EnteredDaughterVolume () const
G4bool ExitedMotherVolume () const
void CheckMode (G4bool mode)
G4bool IsCheckModeActive () const
void SetPushVerbosity (G4bool mode)
void PrintState () const
const G4AffineTransformGetGlobalToLocalTransform () const
const G4AffineTransform GetLocalToGlobalTransform () const
G4AffineTransform GetMotherToDaughterTransform (G4VPhysicalVolume *dVolume, G4int dReplicaNo, EVolume dVolumeType)
void ResetStackAndState ()
G4int SeverityOfZeroStepping (G4int *noZeroSteps) const
G4ThreeVector GetCurrentLocalCoordinate () const
G4ThreeVector NetTranslation () const
G4RotationMatrix NetRotation () const
void EnableBestSafety (G4bool value=false)
G4VExternalNavigationGetExternalNavigation () const
void SetExternalNavigation (G4VExternalNavigation *externalNav)
G4VoxelNavigationGetVoxelNavigator ()
void SetVoxelNavigation (G4VoxelNavigation *voxelNav)
G4NavigatorClone () const
G4ThreeVector GetLastStepEndPoint () const
void InformLastStep (G4double lastStep, G4bool entersDaughtVol, G4bool exitsMotherVol)

Additional Inherited Members

Protected Member Functions inherited from G4Navigator
void SetSavedState ()
void RestoreSavedState ()
virtual void ResetState ()
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &rGlobP) const
G4ThreeVector ComputeLocalAxis (const G4ThreeVector &pVec) const
EVolume VolumeType (const G4VPhysicalVolume *pVol) const
EVolume CharacteriseDaughters (const G4LogicalVolume *pLog) const
G4int GetDaughtersRegularStructureId (const G4LogicalVolume *pLv) const
virtual void SetupHierarchy ()
G4bool CheckOverlapsIterative (G4VPhysicalVolume *vol)
Protected Attributes inherited from G4Navigator
G4double kCarTolerance
G4double fMinStep
G4double fSqTol
G4NavigationHistory fHistory
G4ThreeVector fStepEndPoint
G4ThreeVector fLastStepEndPointLocal
G4int fVerbose = 0
G4bool fEnteredDaughter
G4bool fExitedMother
G4bool fWasLimitedByGeometry = false

Detailed Description

G4ErrorPropagationNavigator is a class for performing double navigation in the detector geometry and on the target surface for error propagation. It overloads ComputeStep() and ComputeSafety() methods.

Definition at line 48 of file G4ErrorPropagationNavigator.hh.

Constructor & Destructor Documentation

◆ G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::G4ErrorPropagationNavigator ( )
default

Constructor and Destructor.

◆ ~G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::~G4ErrorPropagationNavigator ( )
overridedefault

Member Function Documentation

◆ ComputeSafety()

G4double G4ErrorPropagationNavigator::ComputeSafety ( const G4ThreeVector & globalpoint,
const G4double pProposedMaxLength = DBL_MAX,
const G4bool keepState = true )
overridevirtual

Calls the navigation in the detector geometry and then checks if the distance to surface is smaller than the proposed safety.

Parameters
[in]globalpointThe point in global coordinates system. The point must be within the current volume.
[in]pProposedMaxLengthThe proposed maximum length is used to avoid volume safety calculations.
[in]keepStateFlag to instruct keeping the state (default true) to ensure minimum side effects from the call.
Returns
Length from current point to closest boundary surface. The value returned is usually an underestimate.

Reimplemented from G4Navigator.

Definition at line 137 of file G4ErrorPropagationNavigator.cc.

141{
142 G4double safetyGeom = G4Navigator::ComputeSafety(pGlobalPoint,
143 pMaxLength, keepState);
144
145 G4double safetyTarget = TargetSafetyFromPoint( pGlobalPoint );
146
147 return std::min(safetyGeom, safetyTarget);
148}
double G4double
Definition G4Types.hh:83
G4double TargetSafetyFromPoint(const G4ThreeVector &pGlobalpoint)
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)

◆ ComputeStep()

G4double G4ErrorPropagationNavigator::ComputeStep ( const G4ThreeVector & pGlobalPoint,
const G4ThreeVector & pDirection,
const G4double pCurrentProposedStepLength,
G4double & pNewSafety )
overridevirtual

Calls the navigation in the detector geometry and then checks if the distance to surface is smaller than the proposed step.

Parameters
[in]pGlobalPointThe point in global coordinates system.
[in]pDirectionThe normalised vector direction.
[in]pCurrentProposedStepLengthCurrent proposed step length.
[in,out]newSafetyNew safety.
Returns
Length from current point to next boundary surface along pDirection.

Reimplemented from G4Navigator.

Definition at line 41 of file G4ErrorPropagationNavigator.cc.

46{
47 G4double safetyGeom = DBL_MAX;
48
49 G4double Step = G4Navigator::ComputeStep(pGlobalPoint, pDirection,
50 pCurrentProposedStepLength,
51 safetyGeom);
52
53 G4ErrorPropagatorData* g4edata
55
56 if ( g4edata != nullptr )
57 {
58 const G4ErrorTarget* target = g4edata->GetTarget();
59 if( target != nullptr )
60 {
61 G4double StepPlane=target->GetDistanceFromPoint(pGlobalPoint,pDirection);
62
63 if( StepPlane < 0. ) // Negative means target is crossed,
64 { // will not be found
65 StepPlane = DBL_MAX;
66 }
67#ifdef G4VERBOSE
69 {
70 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
71 << " Target step: " << StepPlane
72 << ", Transportation step: " << Step << G4endl;
73 target->Dump( "G4ErrorPropagationNavigator::ComputeStep Target " );
74 }
75#endif
76
77 if( StepPlane < Step )
78 {
79#ifdef G4VERBOSE
81 {
82 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
83 << " TargetCloserThanBoundary: " << StepPlane << " < "
84 << Step << G4endl;
85 }
86#endif
87 Step = StepPlane;
89 }
90 else
91 {
93 }
94 }
95 }
96 G4double safetyTarget = TargetSafetyFromPoint(pGlobalPoint);
97
98 // Avoid call to G4Navigator::ComputeSafety - which could have side effects
99 //
100 pNewSafety = std::min(safetyGeom, safetyTarget);
101
102#ifdef G4VERBOSE
104 {
105 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
106 << " Step: " << Step << ", ComputeSafety: " << pNewSafety
107 << G4endl;
108 }
109#endif
110
111 return Step;
112}
@ G4ErrorState_TargetCloserThanBoundary
@ G4ErrorState_Propagating
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4ErrorPropagatorData * GetErrorPropagatorData()
const G4ErrorTarget * GetTarget(G4bool mustExist=false) const
void SetState(G4ErrorState sta)
virtual void Dump(const G4String &msg) const =0
virtual G4double GetDistanceFromPoint(const G4ThreeVector &, const G4ThreeVector &) const
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
#define DBL_MAX
Definition templates.hh:62

◆ GetGlobalExitNormal()

G4ThreeVector G4ErrorPropagationNavigator::GetGlobalExitNormal ( const G4ThreeVector & point,
G4bool * valid )
overridevirtual

Returns Exit Surface Normal and validity too. Can only be called if the Navigator's last Step has crossed a volume geometrical boundary. Normal points out of the volume exited and/or into the volume entered.

Parameters
[in]pointPoint in global coordinates system to compare to.
[in,out]validFlag indicating if normal is valid.
Returns
A Exit Surface Normal vector and validity too.

Reimplemented from G4Navigator.

Definition at line 152 of file G4ErrorPropagationNavigator.cc.

154{
155 G4ErrorPropagatorData* g4edata
157 const G4ErrorTarget* target = nullptr;
158
159 G4ThreeVector normal(0.0, 0.0, 0.0);
160 G4double distance= 0;
161
162 // Determine which 'geometry' limited the step
163 if ( g4edata != nullptr )
164 {
165 target = g4edata->GetTarget();
166 if( target != nullptr )
167 {
168 distance = target->GetDistanceFromPoint(point);
169 }
170 }
171
172 if( distance > kCarTolerance || (target == nullptr) )
173 // Not reached the target or if a target does not exist,
174 // this seems the best we can do
175 {
176 normal = G4Navigator::GetGlobalExitNormal(point, valid);
177 }
178 else
179 {
180 switch( target->GetType() )
181 {
183 // The volume is in the 'real' mass geometry
184 normal = G4Navigator::GetGlobalExitNormal(point, valid);
185 break;
187 normal = G4ThreeVector( 0.0, 0.0, 0.0);
188 *valid = false;
189 G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
190 "Geometry1003",
191 JustWarning, "Unexpected value of Target type");
192 break;
195 const auto surfTarget= static_cast<const G4ErrorSurfaceTarget*>(target);
196 normal = surfTarget->GetTangentPlane(point).normal().unit();
197 *valid = true;
198 break;
199
200// default:
201// normal= G4ThreeVector( 0.0, 0.0, 0.0 );
202// *valid = false;
203// G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
204// "Geometry:003",
205// FatalException, "Impossible value of Target type");
206// break;
207 }
208 }
209 return normal;
210}
@ G4ErrorTarget_PlaneSurface
@ G4ErrorTarget_CylindricalSurface
@ G4ErrorTarget_GeomVolume
@ G4ErrorTarget_TrkL
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4ErrorTargetType GetType() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
G4double kCarTolerance

◆ TargetSafetyFromPoint()

G4double G4ErrorPropagationNavigator::TargetSafetyFromPoint ( const G4ThreeVector & pGlobalpoint)

Computes the isotropic safety for 'Target'.

Parameters
[in]pGlobalpointPoint in global coordinates system.
Returns
The isotropic safety value.

Definition at line 116 of file G4ErrorPropagationNavigator.cc.

118{
119 G4double safety = DBL_MAX;
120
121 G4ErrorPropagatorData* g4edata
123
124 if ( g4edata != nullptr )
125 {
126 const G4ErrorTarget* target = g4edata->GetTarget();
127 if( target != nullptr )
128 {
129 safety = target->GetDistanceFromPoint(pGlobalpoint);
130 }
131 }
132 return safety;
133}

Referenced by ComputeSafety(), and ComputeStep().


The documentation for this class was generated from the following files: