44 fMinStep = 101*kCarTolerance;
56 const G4double currentProposedStepLength,
64 G4int& blockedReplicaNo)
79 LevelLocate( history, *pBlockedPhysical, blockedReplicaNo,
80 globalPoint, &globalDirection,
true, localPoint2 );
93 G4int copyNo = daughterParam ->GetReplicaNo(localPoint,localDirection);
95 G4ThreeVector voxelTranslation = daughterParam->GetTranslation( copyNo );
101 return fnormalNav->ComputeStep(daughterPoint,
103 currentProposedStepLength,
119 const G4double currentProposedStepLength,
127 G4int& blockedReplicaNo,
135 if( !param->SkipEqualMaterials() )
137 return fnormalNav->ComputeStep(localPoint,
139 currentProposedStepLength,
171 G4ThreeVector prevVoxelTranslation = containerPoint - localPoint;
181 G4int copyNo = param->GetReplicaNo(containerPoint,localDirection);
183 G4Material* currentMate = param->ComputeMaterial( copyNo,
nullptr,
nullptr );
186 G4VSolid* containerSolid = param->GetContainerSolid();
195 fNumberZeroSteps = 0;
196 for(
G4int ii = 0; ii < fNoStepsAllowed+1; ++ii )
198 if( ii == fNoStepsAllowed ) {
203 std::ostringstream message;
204 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
205 <<
"Stuck Track: potential geometry or navigation problem."
207 <<
" Track stuck, moving for more than "
208 << ii <<
" steps" <<
G4endl
209 <<
"- at point " << pGlobalpoint <<
G4endl
210 <<
" local direction: " << localDirection <<
G4endl;
211 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
216 newStep = voxelBox->
DistanceToOut( localPoint, localDirection );
217 fLastStepWasZero = (newStep<fMinStep);
218 if( fLastStepWasZero )
221#ifdef G4DEBUG_NAVIGATION
222 if( fNumberZeroSteps > 1 )
226 std::ostringstream message;
227 message.precision(16);
228 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials(): another 'zero' step, # "
230 <<
", at " << pGlobalpoint
231 <<
", nav-comp-step calls # " << ii
232 <<
", Step= " << newStep;
233 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
235 "Potential overlap in geometry!");
238 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
242 newStep = std::min(101*kCarTolerance*std::pow(10,fNumberZeroSteps-2),0.1);
243#ifdef G4DEBUG_NAVIGATION
246 std::ostringstream message;
247 message.precision(16);
248 message <<
"Track stuck or not moving." <<
G4endl
249 <<
" Track stuck, not moving for "
250 << fNumberZeroSteps <<
" steps" <<
G4endl
251 <<
"- at point " << pGlobalpoint
252 <<
" (local point " << localPoint <<
")" <<
G4endl
253 <<
" local direction: " << localDirection
254 <<
" Potential geometry or navigation problem !"
256 <<
" Trying pushing it of " << newStep <<
" mm ...";
257 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
259 "Potential overlap in geometry!");
262 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
268 std::ostringstream message;
269 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
270 <<
"Stuck Track: potential geometry or navigation problem."
272 <<
" Track stuck, not moving for "
273 << fNumberZeroSteps <<
" steps" <<
G4endl
274 <<
"- at point " << pGlobalpoint <<
G4endl
275 <<
" local direction: " << localDirection <<
G4endl;
276 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
285 fNumberZeroSteps = 0;
287 if( (bFirstStep) && (newStep < currentProposedStepLength) )
293 newStep += kCarTolerance;
295 totalNewStep += newStep;
299 if(std::fabs(totalNewStep-currentProposedStepLength) < kCarTolerance)
301 return currentProposedStepLength;
303 if(totalNewStep > currentProposedStepLength)
306 AddStepLength(copyNo, newStep-totalNewStep+currentProposedStepLength);
307 return currentProposedStepLength;
313 containerPoint += newStep*localDirection;
321 copyNo = param->GetReplicaNo(containerPoint, localDirection);
322 G4ThreeVector voxelTranslation = param->GetTranslation( copyNo );
327 localPoint += newStep*localDirection;
328 localPoint += prevVoxelTranslation - voxelTranslation;
330 prevVoxelTranslation = voxelTranslation;
333 nextMate = param->ComputeMaterial( copyNo,
nullptr,
nullptr );
335 if( currentMate != nextMate ) {
break; }
356 return fnormalNav->ComputeSafety(localPoint,
391 if( globalDirection !=
nullptr )
402 replicaNo = pParam->
GetReplicaNo( localPoint, localDir );
422 pPhysical, &parentTouchable) );
430 fnormalNav = fnormnav;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
void UpdateMaterial(G4Material *pMaterial)
G4NavigationHistory is a class responsible for the maintenance of the history of the path taken throu...
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
const G4AffineTransform & GetTopTransform() const
std::size_t GetDepth() const
G4VPhysicalVolume * GetTopVolume() const
const G4AffineTransform & GetTransform(G4int n) const
G4NormalNavigation is a concrete utility class for navigation in volumes containing only G4PVPlacemen...
G4PhantomParameterisation describes regular parameterisations: a set of boxes of equal dimension in t...
virtual G4int GetReplicaNo(const G4ThreeVector &localPoint, const G4ThreeVector &localDir)
G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr) override
void ComputeTransformation(const G4int, G4VPhysicalVolume *) const override
std::size_t GetNoVoxels() const
static G4RegularNavigationHelper * Instance()
void AddStepLength(G4int copyNo, G4double slen)
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
G4TouchableHistory is an object representing a touchable detector element, and its history in the geo...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
virtual void SetCopyNo(G4int CopyNo)=0
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPVParameterisation * GetParameterisation() const =0
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0