45 fMinStep = 101*kCarTolerance;
57 const G4double currentProposedStepLength,
65 G4int& blockedReplicaNo)
80 LevelLocate( history, *pBlockedPhysical, blockedReplicaNo,
81 globalPoint, &globalDirection,
true, localPoint2 );
94 G4int copyNo = daughterParam ->GetReplicaNo(localPoint,localDirection);
96 G4ThreeVector voxelTranslation = daughterParam->GetTranslation( copyNo );
104 currentProposedStepLength,
120 const G4double currentProposedStepLength,
128 G4int& blockedReplicaNo,
136 if( !param->SkipEqualMaterials() )
140 currentProposedStepLength,
172 G4ThreeVector prevVoxelTranslation = containerPoint - localPoint;
182 G4int copyNo = param->GetReplicaNo(containerPoint,localDirection);
184 G4Material* currentMate = param->ComputeMaterial( copyNo,
nullptr,
nullptr );
187 G4VSolid* containerSolid = param->GetContainerSolid();
196 fNumberZeroSteps = 0;
197 for(
G4int ii = 0; ii < fNoStepsAllowed+1; ++ii )
199 if( ii == fNoStepsAllowed ) {
204 std::ostringstream message;
205 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
206 <<
"Stuck Track: potential geometry or navigation problem."
208 <<
" Track stuck, moving for more than "
209 << ii <<
" steps" <<
G4endl
210 <<
"- at point " << pGlobalpoint <<
G4endl
211 <<
" local direction: " << localDirection <<
G4endl;
212 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
217 newStep = voxelBox->
DistanceToOut( localPoint, localDirection );
218 fLastStepWasZero = (newStep<fMinStep);
219 if( fLastStepWasZero )
222#ifdef G4DEBUG_NAVIGATION
223 if( fNumberZeroSteps > 1 )
227 std::ostringstream message;
228 message.precision(16);
229 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials(): another 'zero' step, # "
231 <<
", at " << pGlobalpoint
232 <<
", nav-comp-step calls # " << ii
233 <<
", Step= " << newStep;
234 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
236 "Potential overlap in geometry!");
239 if( fNumberZeroSteps > fActionThreshold_NoZeroSteps-1 )
243 newStep = std::min(101*kCarTolerance*std::pow(10,fNumberZeroSteps-2),0.1);
244#ifdef G4DEBUG_NAVIGATION
247 std::ostringstream message;
248 message.precision(16);
249 message <<
"Track stuck or not moving." <<
G4endl
250 <<
" Track stuck, not moving for "
251 << fNumberZeroSteps <<
" steps" <<
G4endl
252 <<
"- at point " << pGlobalpoint
253 <<
" (local point " << localPoint <<
")" <<
G4endl
254 <<
" local direction: " << localDirection
255 <<
" Potential geometry or navigation problem !"
257 <<
" Trying pushing it of " << newStep <<
" mm ...";
258 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
260 "Potential overlap in geometry!");
263 if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
269 std::ostringstream message;
270 message <<
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()"
271 <<
"Stuck Track: potential geometry or navigation problem."
273 <<
" Track stuck, not moving for "
274 << fNumberZeroSteps <<
" steps" <<
G4endl
275 <<
"- at point " << pGlobalpoint <<
G4endl
276 <<
" local direction: " << localDirection <<
G4endl;
277 G4Exception(
"G4RegularNavigation::ComputeStepSkippingEqualMaterials()",
286 fNumberZeroSteps = 0;
288 if( (bFirstStep) && (newStep < currentProposedStepLength) )
294 newStep += kCarTolerance;
296 totalNewStep += newStep;
300 if(std::fabs(totalNewStep-currentProposedStepLength) < kCarTolerance)
302 return currentProposedStepLength;
304 if(totalNewStep > currentProposedStepLength)
307 AddStepLength(copyNo, newStep-totalNewStep+currentProposedStepLength);
308 return currentProposedStepLength;
314 containerPoint += newStep*localDirection;
322 copyNo = param->GetReplicaNo(containerPoint, localDirection);
323 G4ThreeVector voxelTranslation = param->GetTranslation( copyNo );
328 localPoint += newStep*localDirection;
329 localPoint += prevVoxelTranslation - voxelTranslation;
331 prevVoxelTranslation = voxelTranslation;
334 nextMate = param->ComputeMaterial( copyNo,
nullptr,
nullptr );
336 if( currentMate != nextMate ) {
break; }
392 if( globalDirection !=
nullptr )
403 replicaNo = pParam->
GetReplicaNo( localPoint, localDir );
423 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 ComputeSafety(const G4ThreeVector &globalpoint, const G4NavigationHistory &history, const G4double pMaxLength=DBL_MAX) 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
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 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) final
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint) final
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX) final
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)
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