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

#include <G4ErrorPropagationNavigator.hh>

+ Inheritance diagram for G4ErrorPropagationNavigator:

Public Member Functions

 G4ErrorPropagationNavigator ()
 
 ~G4ErrorPropagationNavigator () override
 
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 *) 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 &rGlobPoint) 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

Definition at line 44 of file G4ErrorPropagationNavigator.hh.

Constructor & Destructor Documentation

◆ G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::G4ErrorPropagationNavigator ( )

Definition at line 44 of file G4ErrorPropagationNavigator.cc.

45{
46}

◆ ~G4ErrorPropagationNavigator()

G4ErrorPropagationNavigator::~G4ErrorPropagationNavigator ( )
overridedefault

Member Function Documentation

◆ ComputeSafety()

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

Reimplemented from G4Navigator.

Definition at line 150 of file G4ErrorPropagationNavigator.cc.

154{
155 G4double safetyGeom = G4Navigator::ComputeSafety(pGlobalPoint,
156 pMaxLength, keepState);
157
158 G4double safetyTarget = TargetSafetyFromPoint( pGlobalPoint );
159
160 return std::min(safetyGeom, safetyTarget);
161}
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

Reimplemented from G4Navigator.

Definition at line 54 of file G4ErrorPropagationNavigator.cc.

59{
60 G4double safetyGeom = DBL_MAX;
61
62 G4double Step = G4Navigator::ComputeStep(pGlobalPoint, pDirection,
63 pCurrentProposedStepLength,
64 safetyGeom);
65
68
69 if ( g4edata != nullptr )
70 {
71 const G4ErrorTarget* target = g4edata->GetTarget();
72 if( target != nullptr )
73 {
74 G4double StepPlane=target->GetDistanceFromPoint(pGlobalPoint,pDirection);
75
76 if( StepPlane < 0. ) // Negative means target is crossed,
77 { // will not be found
78 StepPlane = DBL_MAX;
79 }
80#ifdef G4VERBOSE
82 {
83 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
84 << " Target step: " << StepPlane
85 << ", Transportation step: " << Step << G4endl;
86 target->Dump( "G4ErrorPropagationNavigator::ComputeStep Target " );
87 }
88#endif
89
90 if( StepPlane < Step )
91 {
92#ifdef G4VERBOSE
94 {
95 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
96 << " TargetCloserThanBoundary: " << StepPlane << " < "
97 << Step << G4endl;
98 }
99#endif
100 Step = StepPlane;
102 }
103 else
104 {
106 }
107 }
108 }
109 G4double safetyTarget = TargetSafetyFromPoint(pGlobalPoint);
110
111 // Avoid call to G4Navigator::ComputeSafety - which could have side effects
112 //
113 pNewSafety = std::min(safetyGeom, safetyTarget);
114
115#ifdef G4VERBOSE
117 {
118 G4cout << "G4ErrorPropagationNavigator::ComputeStep()" << G4endl
119 << " Step: " << Step << ", ComputeSafety: " << pNewSafety
120 << G4endl;
121 }
122#endif
123
124 return Step;
125}
@ 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

Reimplemented from G4Navigator.

Definition at line 165 of file G4ErrorPropagationNavigator.cc.

167{
168 G4ErrorPropagatorData* g4edata
170 const G4ErrorTarget* target = nullptr;
171
172 G4ThreeVector normal(0.0, 0.0, 0.0);
173 G4double distance= 0;
174
175 // Determine which 'geometry' limited the step
176 if ( g4edata != nullptr )
177 {
178 target = g4edata->GetTarget();
179 if( target != nullptr )
180 {
181 distance = target->GetDistanceFromPoint(point);
182 }
183 }
184
185 if( distance > kCarTolerance || (target == nullptr) )
186 // Not reached the target or if a target does not exist,
187 // this seems the best we can do
188 {
189 normal = G4Navigator::GetGlobalExitNormal(point, valid);
190 }
191 else
192 {
193 switch( target->GetType() )
194 {
196 // The volume is in the 'real' mass geometry
197 normal = G4Navigator::GetGlobalExitNormal(point, valid);
198 break;
200 normal = G4ThreeVector( 0.0, 0.0, 0.0);
201 *valid = false;
202 G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
203 "Geometry1003",
204 JustWarning, "Unexpected value of Target type");
205 break;
208 const auto surfTarget= static_cast<const G4ErrorSurfaceTarget*>(target);
209 normal = surfTarget->GetTangentPlane(point).normal().unit();
210 *valid = true;
211 break;
212
213// default:
214// normal= G4ThreeVector( 0.0, 0.0, 0.0 );
215// *valid = false;
216// G4Exception("G4ErrorPropagationNavigator::GetGlobalExitNormal",
217// "Geometry:003",
218// FatalException, "Impossible value of Target type");
219// break;
220 }
221 }
222 return normal;
223}
@ 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
G4Plane3D GetTangentPlane(const G4ThreeVector &point) const override=0
G4ErrorTargetType GetType() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
G4double kCarTolerance
Normal3D< T > normal() const
Definition Plane3D.h:97

◆ TargetSafetyFromPoint()

G4double G4ErrorPropagationNavigator::TargetSafetyFromPoint ( const G4ThreeVector & pGlobalpoint)

Definition at line 129 of file G4ErrorPropagationNavigator.cc.

131{
132 G4double safety = DBL_MAX;
133
134 G4ErrorPropagatorData* g4edata
136
137 if ( g4edata != nullptr )
138 {
139 const G4ErrorTarget* target = g4edata->GetTarget();
140 if( target != nullptr )
141 {
142 safety = target->GetDistanceFromPoint(pGlobalpoint);
143 }
144 }
145 return safety;
146}

Referenced by ComputeSafety(), and ComputeStep().


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