45 fMinStep = 101*kCarTolerance;
59 const G4double currentProposedStepLength,
67 G4int& blockedReplicaNo)
82 LevelLocate( history, *pBlockedPhysical, blockedReplicaNo,
83 globalPoint, &globalDirection,
true, localPoint2 );
106 currentProposedStepLength,
122 const G4double currentProposedStepLength,
130 G4int& blockedReplicaNo,
142 currentProposedStepLength,
174 G4ThreeVector prevVoxelTranslation = containerPoint - localPoint;
198 fNumberZeroSteps = 0;
199 for(
G4int ii = 0; ii < fNoStepsAllowed+1; ++ii )
201 if( ii == fNoStepsAllowed ) {
206 std::ostringstream message;
207 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
208 <<
"Stuck Track: potential geometry or navigation problem."
210 <<
" Track stuck, moving for more than "
211 << ii <<
" steps" <<
G4endl
212 <<
"- at point " << pGlobalpoint <<
G4endl
213 <<
" local direction: " << localDirection <<
G4endl;
214 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
219 newStep = voxelBox->
DistanceToOut( localPoint, localDirection );
220 fLastStepWasZero = (newStep<fMinStep);
221 if( fLastStepWasZero )
224#ifdef G4DEBUG_NAVIGATION
225 if( fNumberZeroSteps > 1 )
229 std::ostringstream message;
230 message.precision(16);
231 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials(): another 'zero' step, # "
233 <<
", at " << pGlobalpoint
234 <<
", nav-comp-step calls # " << ii
235 <<
", Step= " << newStep;
236 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
238 "Potential overlap in geometry!");
241 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
245 newStep = std::min(101*kCarTolerance*std::pow(10,fNumberZeroSteps-2),0.1);
246#ifdef G4DEBUG_NAVIGATION
249 std::ostringstream message;
250 message.precision(16);
251 message <<
"Track stuck or not moving." <<
G4endl
252 <<
" Track stuck, not moving for "
253 << fNumberZeroSteps <<
" steps" <<
G4endl
254 <<
"- at point " << pGlobalpoint
255 <<
" (local point " << localPoint <<
")" <<
G4endl
256 <<
" local direction: " << localDirection
257 <<
" Potential geometry or navigation problem !"
259 <<
" Trying pushing it of " << newStep <<
" mm ...";
260 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
262 "Potential overlap in geometry!");
265 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
271 std::ostringstream message;
272 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
273 <<
"Stuck Track: potential geometry or navigation problem."
275 <<
" Track stuck, not moving for "
276 << fNumberZeroSteps <<
" steps" <<
G4endl
277 <<
"- at point " << pGlobalpoint <<
G4endl
278 <<
" local direction: " << localDirection <<
G4endl;
279 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
288 fNumberZeroSteps = 0;
290 if( (bFirstStep) && (newStep < currentProposedStepLength) )
296 newStep += kCarTolerance;
298 totalNewStep += newStep;
302 if(std::fabs(totalNewStep-currentProposedStepLength) < kCarTolerance)
304 return currentProposedStepLength;
306 if(totalNewStep > currentProposedStepLength)
309 AddStepLength(copyNo, newStep-totalNewStep+currentProposedStepLength);
310 return currentProposedStepLength;
320 containerPoint += newStep*localDirection;
328 copyNo = param->
GetReplicaNo(containerPoint, localDirection);
334 localPoint += newStep*localDirection;
335 localPoint += prevVoxelTranslation - voxelTranslation;
337 prevVoxelTranslation = voxelTranslation;
342 if( currentMate != nextMate ) {
break; }
398 if( globalDirection )
409 replicaNo = pParam->
GetReplicaNo( localPoint, localDir );
429 pPhysical, &parentTouchable) );
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
void UpdateMaterial(G4Material *pMaterial)
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
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)
G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX)
virtual G4int GetReplicaNo(const G4ThreeVector &localPoint, const G4ThreeVector &localDir)
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
G4VSolid * GetContainerSolid() const
G4ThreeVector GetTranslation(const G4int copyNo) const
G4bool SkipEqualMaterials() const
std::size_t GetNoVoxels() const
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const
static G4RegularNavigationHelper * Instance()
void AddStepLength(G4int copyNo, G4double slen)
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX)
G4double ComputeStepSkippingEqualMaterials(G4ThreeVector &localPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo, G4VPhysicalVolume *pCurrentPhysical)
G4double ComputeStep(const G4ThreeVector &globalPoint, const G4ThreeVector &globalDirection, const G4double currentProposedStepLength, G4double &newSafety, G4NavigationHistory &history, G4bool &validExitNormal, G4ThreeVector &exitNormal, G4bool &exiting, G4bool &entering, G4VPhysicalVolume *(*pBlockedPhysical), G4int &blockedReplicaNo)
virtual void SetCopyNo(G4int CopyNo)=0
G4LogicalVolume * GetLogicalVolume() const
virtual G4VPVParameterisation * GetParameterisation() const =0
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