Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParameterisedNavigation.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// G4ParameterisedNavigation
27//
28// Class description:
29//
30// Utility for navigation in volumes containing a single G4PVParameterised
31// volume for which voxels for the replicated volumes have been constructed.
32// [Voxels MUST be along one axis only: NOT refined]
33
34// Author: Paul Kent (CERN), August 1996
35// --------------------------------------------------------------------
36#ifndef G4PARAMETERISEDNAVIGATION_HH
37#define G4PARAMETERISEDNAVIGATION_HH 1
38
39#include "G4Types.hh"
40
41#include <vector>
42
43#include "G4VoxelNavigation.hh"
45#include "G4AffineTransform.hh"
46#include "G4VPhysicalVolume.hh"
48#include "G4LogicalVolume.hh"
49#include "G4VSolid.hh"
50#include "G4ThreeVector.hh"
51#include "G4BlockingList.hh"
52
53/**
54 * @brief G4ParameterisedNavigation is a concrete utility class for navigation
55 * in volumes containing a single G4PVParameterised volume for which voxels for
56 * the replicated volumes have been constructed.
57 * @note Voxels MUST be along one axis only: NOT refined.
58 */
59
61{
62 public:
63
64 /**
65 * Constructor and default Destructor.
66 */
69
70 /**
71 * Locates voxel node based on given point. If no parameterisation axis
72 * is specified, adopt default location strategy as for placements.
73 * @param[in] pHead Pointer to header of nodes to look through.
74 * @param[in] localPoint Local point
75 * @returns Pointer to the node where the given point is located.
76 */
78 const G4ThreeVector& localPoint );
79
80 /**
81 * Searches positioned volumes in mother at current top level of @p history
82 * for volume containing @p globalPoint. Do not test against @p blockedVol.
83 * If a containing volume is found, push it onto navigation history state.
84 * @param[in,out] history Navigation history.
85 * @param[in,out] blockedVol Blocked volume to be ignored in queries.
86 * @param[in,out] blockedNum Copy number for blocked replica volumes.
87 * @param[in,out] globalPoint Point in global coordinates system.
88 * @param[in,out] globalDirection Global direction vector.
89 * @param[in] pLocatedOnEdge Flag specifying if point is located on edge.
90 * @param[in,out] localPoint Point in local coordinates system.
91 * @returns Whether a containing volume has been found.
92 */
94 const G4VPhysicalVolume* blockedVol,
95 const G4int blockedNum,
96 const G4ThreeVector& globalPoint,
97 const G4ThreeVector* globalDirection,
98 const G4bool pLocatedOnEdge,
99 G4ThreeVector& localPoint ) override;
100
101 /**
102 * Computes the length of a step to the next boundary.
103 * Does not test against @p pBlockedPhysical. Identifies the next candidate
104 * volume (if a daughter of the current volume), and returns it in:
105 * pBlockedPhysical, blockedReplicaNo.
106 * @param[in] localPoint Local point.
107 * @param[in] localDirection Local direction vector.
108 * @param[in] currentProposedStepLength Current proposed step length.
109 * @param[in,out] newSafety New safety.
110 * @param[in,out] history Navigation history.
111 * @param[in,out] validExitNormal Flag to indicate whether exit normal is
112 * valid or not.
113 * @param[in,out] exitNormal Exit normal.
114 * @param[in,out] exiting Flag to indicate whether exiting a volume.
115 * @param[in,out] entering Flag to indicate whether entering a volume.
116 * @param[in,out] pBlockedPhysical Blocked physical volume that should be
117 * ignored in queries.
118 * @param[in,out] blockedReplicaNo Copy number for blocked replica volumes.
119 * @returns Length from current point to next boundary surface along
120 * @p localDirection.
121 */
122 G4double ComputeStep( const G4ThreeVector& localPoint,
123 const G4ThreeVector& localDirection,
124 const G4double currentProposedStepLength,
125 G4double& newSafety,
126 G4NavigationHistory& history,
127 G4bool& validExitNormal,
128 G4ThreeVector& exitNormal,
129 G4bool& exiting,
130 G4bool& entering,
131 G4VPhysicalVolume *(*pBlockedPhysical),
132 G4int& blockedReplicaNo ) override;
133
134 /**
135 * Calculates the isotropic distance to the nearest boundary from the
136 * specified point in the local coordinate system.
137 * The localpoint utilised must be within the current volume.
138 * @param[in] localPoint Local point.
139 * @param[in] history Navigation history.
140 * @param[in] pMaxLength Maximum step length beyond which volumes
141 * need not be checked.
142 * @returns Length from current point to closest surface.
143 */
144 G4double ComputeSafety( const G4ThreeVector& localPoint,
145 const G4NavigationHistory& history,
146 const G4double pProposedMaxLength=DBL_MAX ) override;
147
148 /**
149 * Updates internal navigation state to take into account that location
150 * has been moved, but remains within the @p motherPhysical volume.
151 * @param[in] motherPhysical Current physical volume.
152 * @param[in] localPoint Local point.
153 */
154 void RelocateWithinVolume( G4VPhysicalVolume* motherPhysical,
155 const G4ThreeVector& localPoint ) override;
156
157 private:
158
159 /**
160 * Computes safety from specified point to voxel boundaries using already
161 * located point.
162 * @param[in] localPoint Local point.
163 * @param[in] pAxis Axis of parameterisation.
164 * @returns Safety length from current point to voxel boundary.
165 */
166 G4double ComputeVoxelSafety( const G4ThreeVector& localPoint,
167 const EAxis pAxis ) const;
168
169 /**
170 * Finds the next voxel from the current voxel and point in the specified
171 * direction.
172 * @param[in] localPoint Local point.
173 * @param[in] localDirection Direction along which compute the distance.
174 * @param[in] currentStep Current step size.
175 * @param[in] pAxis Axis of parameterisation.
176 * @returns false if all voxels considered
177 * [current Step ends inside same voxel or leaves all voxels]
178 * true otherwise
179 * [the information on the next voxel is saved].
180 */
181 G4bool LocateNextVoxel( const G4ThreeVector& localPoint,
182 const G4ThreeVector& localDirection,
183 const G4double currentStep,
184 const EAxis pAxis );
185
186 /**
187 * Calls virtual 'Compute' methods, and copies information if nested.
188 * Method necessary to resolve cases with nested parameterisations.
189 * @param[in] num Copy number of parameterisation.
190 * @param[in] apparentPhys Potentially a PhysV or PhysT.
191 * @param[in] curParam Pointer to the parameterisation algorithm.
192 * @returns A pointer to the computed parameterised solid.
193 */
194 inline G4VSolid* IdentifyAndPlaceSolid( G4int num,
195 G4VPhysicalVolume* apparentPhys,
196 G4VPVParameterisation* curParam );
197
198 private:
199
200 // Voxel Stack information (for 1D optimisation only)
201 //
202 EAxis fVoxelAxis = kUndefined;
203 G4int fVoxelNoSlices = 0;
204 G4double fVoxelSliceWidth = 0.0;
205 std::size_t fVoxelNodeNo = 0;
206 G4SmartVoxelHeader* fVoxelHeader = nullptr;
207};
208
209#include "G4ParameterisedNavigation.icc"
210
211#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...
G4SmartVoxelNode * ParamVoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
~G4ParameterisedNavigation() override
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX) override
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) override
void RelocateWithinVolume(G4VPhysicalVolume *motherPhysical, const G4ThreeVector &localPoint) override
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint) override
G4SmartVoxelHeader represents a set of voxels, created by a single axis of virtual division....
G4SmartVoxelNode defines a node in the smart voxel hierarchy, i.e. a 'slice' of space along a given a...
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
Definition G4VSolid.hh:80
EAxis
Definition geomdefs.hh:54
@ kUndefined
Definition geomdefs.hh:61
#define DBL_MAX
Definition templates.hh:62