Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RegularNavigation.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4RegularNavigation
27//
28// Class description:
29//
30// Utility for fast navigation in volumes containing a regular
31// parameterisation. If two contiguous voxels have the same material,
32// navigation does not stop at the surface.
33
34// Author: Pedro Arce (CIEMAT), May 2007
35// --------------------------------------------------------------------
36#ifndef G4RegularNavigation_HH
37#define G4RegularNavigation_HH 1
38
39#include <vector>
40
41#include "G4Types.hh"
42#include "G4ThreeVector.hh"
43#include "G4VNavigation.hh"
44
47class G4Navigator;
49
50/**
51 * @brief G4RegularNavigation is a concrete utility class for fast navigation
52 * in volumes containing a regular parameterisation. If two contiguous voxels
53 * have the same material, navigation does not stop at the surface.
54 */
55
57{
58 public:
59
60 /**
61 * Constructor and Destructor.
62 */
65
66 /**
67 * Locates a point using its position with respect to regular
68 * parameterisation container volume.
69 * @param[in,out] history Navigation history.
70 * @param[in,out] blockedVol Blocked volume to be ignored in queries.
71 * @param[in,out] blockedNum Copy number for blocked replica volumes.
72 * @param[in,out] globalPoint Point in global coordinates system.
73 * @param[in,out] globalDirection Global direction vector.
74 * @param[in,out] localPoint Point in local coordinates system.
75 * @returns Whether a containing volume has been found.
76 */
78 const G4VPhysicalVolume* blockedVol,
79 const G4int blockedNum,
80 const G4ThreeVector& globalPoint,
81 const G4ThreeVector* globalDirection,
82 const G4bool pLocatedOnEdge,
83 G4ThreeVector& localPoint ) final;
84
85 /**
86 * Method never called because to be called the daughter has to be a
87 * 'regular' volume. This would only happen if the track is in the
88 * mother of voxels volume. But the voxels fill completely their mother,
89 * so when a track enters the mother it automatically enters a voxel.
90 */
91 G4double ComputeStep( const G4ThreeVector& localPoint,
92 const G4ThreeVector& localDirection,
93 const G4double currentProposedStepLength,
94 G4double& newSafety,
95 G4NavigationHistory& history,
96 G4bool& validExitNormal,
97 G4ThreeVector& exitNormal,
98 G4bool& exiting,
99 G4bool& entering,
100 G4VPhysicalVolume *(*pBlockedPhysical),
101 G4int& blockedReplicaNo ) final;
102
103 /**
104 * Computes the step skipping surfaces when they separate voxels with
105 * equal materials. Loops to voxels until a different material is found:
106 * invokes G4NormalNavigation::ComputeStep() in each voxel and moves the
107 * point to the next voxel.
108 * @param[in] localPoint Local point.
109 * @param[in] localDirection Local direction vector.
110 * @param[in] currentProposedStepLength Current proposed step length.
111 * @param[in,out] newSafety New safety.
112 * @param[in,out] history Navigation history.
113 * @param[in,out] validExitNormal Flag to indicate whether exit normal is
114 * valid or not.
115 * @param[in,out] exitNormal Exit normal.
116 * @param[in,out] exiting Flag to indicate whether exiting a volume.
117 * @param[in,out] entering Flag to indicate whether entering a volume.
118 * @param[in,out] pBlockedPhysical Blocked physical volume that should be
119 * ignored in queries.
120 * @param[in,out] blockedReplicaNo Copy number for blocked replica volumes.
121 * @param[in] pCurrentPhysical Pointer to current volume.
122 * @returns Length from current point to next boundary surface along
123 * the direction.
124 */
126 G4ThreeVector& localPoint,
127 const G4ThreeVector& localDirection,
128 const G4double currentProposedStepLength,
129 G4double& newSafety,
130 G4NavigationHistory& history,
131 G4bool& validExitNormal,
132 G4ThreeVector& exitNormal,
133 G4bool& exiting,
134 G4bool& entering,
135 G4VPhysicalVolume *(*pBlockedPhysical),
136 G4int& blockedReplicaNo,
137 G4VPhysicalVolume* pCurrentPhysical);
138
139 /**
140 * Method never called because to be called the daughter has to be a
141 * 'regular' volume. This would only happen if the track is in the
142 * mother of voxels volume. But the voxels fill completely their mother,
143 * so when a track enters the mother it automatically enters a voxel.
144 */
145 G4double ComputeSafety( const G4ThreeVector& localPoint,
146 const G4NavigationHistory& history,
147 const G4double pProposedMaxLength = DBL_MAX ) final;
148
149 /**
150 * Setter for normal navigation.
151 */
152 void SetNormalNavigation( G4NormalNavigation* fnormnav );
153
154 private:
155
156 /** Cached pointer to normal navigation. */
157 G4NormalNavigation* fnormalNav = nullptr;
158
159 /** Surface tolerance. */
160 G4double kCarTolerance;
161
162 /** Cached minimum step. */
163 G4double fMinStep;
164
165 /** Whether the last ComputeStep moved Zero. Used to check for edges. */
166 G4bool fLastStepWasZero = false;
167
168 /** Number of preceding moves that were 0. Reset to 0 after finite step. */
169 G4int fNumberZeroSteps = 0;
170
171 /** After this many failed/zero steps, act (push etc). */
172 G4int fActionThreshold_NoZeroSteps = 2;
173
174 /** After this many failed/zero steps, abandon track. */
175 G4int fAbandonThreshold_NoZeroSteps = 25;
176
177 /** Maximum number of steps a track can travel skipping voxels
178 (if there are more, track is assumed to be stuck and it is killed). */
179 G4int fNoStepsAllowed = 10000;
180};
181
182#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4NavigationHistory is a class responsible for the maintenance of the history of the path taken throu...
G4Navigator is a class for use by the tracking management, able to obtain/calculate dynamic tracking ...
G4NormalNavigation is a concrete utility class for navigation in volumes containing only G4PVPlacemen...
G4double ComputeStepSkippingEqualMaterials(G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo, G4VPhysicalVolume *pCurrentPhysical)
~G4RegularNavigation() override
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint) final
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) final
void SetNormalNavigation(G4NormalNavigation *fnormnav)
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX) final
G4VNavigation class holds the common navigation interface for all geometry navigator types.
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
#define DBL_MAX
Definition templates.hh:62