61 : fVoxelAxis(
kUndefined), fVoxelNoSlices(0), fVoxelSliceWidth(0.),
62 fVoxelNodeNo(0), fVoxelHeader(0)
81 const G4double currentProposedStepLength,
89 G4int& blockedReplicaNo)
96 G4double ourStep=currentProposedStepLength, ourSafety;
98 G4bool motherValidExitNormal=
false;
103 G4bool initialNode, noStep;
105 G4int curNoVolumes, contentNo;
117 motherSolid = motherLogical->
GetSolid();
124 ourSafety = motherSafety;
129 if( motherSafety < 0.0 )
133 message <<
"Negative Safety In Voxel Navigation !" <<
G4endl
134 <<
" Current solid " << motherSolid->
GetName()
135 <<
" gave negative safety: " << motherSafety <<
G4endl
136 <<
" for the current (local) point " << localPoint;
137 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
143 message <<
"Point is outside Current Volume !" <<
G4endl
144 <<
" Point " << localPoint
145 <<
" is outside current volume " << motherPhysical->
GetName()
148 G4cout <<
" Estimated isotropic distance to solid (distToIn)= "
150 if( estDistToSolid > 100.0 * motherSolid->
GetTolerance() )
153 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
155 "Point is far outside Current Volume !");
158 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
160 "Point is a little outside Current Volume.");
171 &motherValidExitNormal,
174 if( (motherStep >=
kInfinity) || (motherStep < 0.0) )
180 ourStep = motherStep = 0.0;
185 validExitNormal = motherValidExitNormal;
186 exitNormal = motherExitNormal;
188 *pBlockedPhysical= 0;
210 if (exiting && (*pBlockedPhysical==samplePhysical) && validExitNormal)
232 for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
234 sampleNo = curVoxelNode->
GetVolume(contentNo);
247 const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
249 if ( sampleSafety<ourSafety )
251 ourSafety = sampleSafety;
253 if ( sampleSafety<=ourStep )
255 sampleDirection = sampleTf.TransformAxis(localDirection);
257 sampleSolid->
DistanceToIn(samplePoint, sampleDirection);
258 if ( sampleStep<=ourStep )
260 ourStep = sampleStep;
263 *pBlockedPhysical = samplePhysical;
264 blockedReplicaNo = sampleNo;
273 intersectionPoint= samplePoint + sampleStep * sampleDirection;
279 message <<
"Navigator gets conflicting response from Solid."
281 <<
" Inaccurate solid DistanceToIn"
283 <<
" Solid gave DistanceToIn = "
284 << sampleStep <<
" yet returns " ;
286 message <<
"-kInside-";
288 message <<
"-kOutside-";
290 message <<
"-kSurface-";
291 message <<
" for this point !" <<
G4endl
292 <<
" Point = " << intersectionPoint
295 message <<
" DistanceToIn(p) = "
298 message <<
" DistanceToOut(p) = "
300 G4Exception(
"G4ParameterisedNavigation::ComputeStep()",
302 G4cout.precision(oldcoutPrec);
315 if ( voxelSafety<ourSafety )
317 ourSafety = voxelSafety;
319 if ( currentProposedStepLength<ourSafety )
326 *pBlockedPhysical = 0;
333 if ( motherSafety<=ourStep )
340 &motherValidExitNormal,
344 if( ( motherStep < 0.0 ) || ( motherStep >=
kInfinity) )
349 ourStep = motherStep = 0.0;
355 if( motherValidExitNormal && (
fCheck || (motherStep<=ourStep)) )
358 localPoint, localDirection,
359 motherStep, motherSolid,
360 "From motherSolid::DistanceToOut");
363 if ( motherStep<=ourStep )
365 ourStep = motherStep;
368 if ( validExitNormal )
379 validExitNormal =
false;
406 G4VSolid *motherSolid, *sampleSolid;
408 G4int sampleNo, curVoxelNodeNo;
411 G4int curNoVolumes, contentNo;
423 motherSolid = motherLogical->
GetSolid();
430 ourSafety = motherSafety;
441 width, offset, consuming);
460 for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
462 sampleNo = curVoxelNode->
GetVolume(contentNo);
471 const G4ThreeVector samplePoint = sampleTf.TransformPoint(localPoint);
473 if ( sampleSafety<ourSafety )
475 ourSafety = sampleSafety;
480 if ( voxelSafety<ourSafety )
482 ourSafety=voxelSafety;
497 const EAxis pAxis)
const
507 G4double voxelSafety, plusVoxelSafety, minusVoxelSafety;
508 G4double curNodeOffset, minCurCommonDelta, maxCurCommonDelta;
509 G4int minCurNodeNoDelta, maxCurNodeNoDelta;
519 maxCurCommonDelta = fVoxelSliceWidth-minCurCommonDelta;
520 plusVoxelSafety = minCurNodeNoDelta*fVoxelSliceWidth+minCurCommonDelta;
521 minusVoxelSafety = maxCurNodeNoDelta*fVoxelSliceWidth+maxCurCommonDelta;
522 voxelSafety =
std::min(plusVoxelSafety,minusVoxelSafety);
561 G4double minVal, maxVal, curMinExtent, curCoord;
568 if ( minVal<=curCoord )
570 maxVal = curMinExtent
572 if ( maxVal<curCoord )
575 if ( newNodeNo<fVoxelHeader->GetNoSlices() )
607 const G4int blockedNum,
610 const G4bool pLocatedOnEdge,
620 G4int voxelNoDaughters, replicaNo;
631 if ( voxelNoDaughters==0 ) {
return false; }
643 for (
G4int sampleNo=voxelNoDaughters-1; sampleNo>=0; sampleNo-- )
645 replicaNo = motherVoxelNode->
GetVolume(sampleNo);
646 if ( (replicaNo!=blockedNum) || (pPhysical!=blockedVol) )
665 localPoint = samplePoint;
676 pPhysical, &parentTouchable) );
G4int GetMaxEquivalentSliceNo() const
void Enlarge(const G4int nv)
G4NavigationLogger * fLogger
G4LogicalVolume * GetLogicalVolume() const
G4SmartVoxelNode * GetNode() const
static const G4double kInfinity
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
G4bool LocateNextVoxel(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentStep, const EAxis pAxis)
G4int GetMinEquivalentSliceNo() const
G4bool IsBlocked(const G4int v) const
G4bool LocateNextVoxel(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4double currentStep)
virtual G4VPVParameterisation * GetParameterisation() const =0
G4SmartVoxelHeader * GetVoxelHeader() const
void message(RunManager *runmanager)
void UpdateMaterial(G4Material *pMaterial)
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
double dot(const Hep3Vector &) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4SmartVoxelHeader * fVoxelHeader
G4bool LevelLocate(G4NavigationHistory &history, const G4VPhysicalVolume *blockedVol, const G4int blockedNum, const G4ThreeVector &globalPoint, const G4ThreeVector *globalDirection, const G4bool pLocatedOnEdge, G4ThreeVector &localPoint)
const G4ThreeVector & GetTranslation() const
G4double ComputeVoxelSafety(const G4ThreeVector &localPoint, const EAxis pAxis) const
virtual EInside Inside(const G4ThreeVector &p) const =0
G4int GetNoContained() const
void BlockVolume(const G4int v)
G4int GetVolume(G4int pVolumeNo) const
void SetSolid(G4VSolid *pSolid)
const G4AffineTransform & GetTopTransform() const
static const double kMinExitingNormalCosine
G4double ComputeVoxelSafety(const G4ThreeVector &localPoint) const
G4SmartVoxelNode * ParamVoxelLocate(G4SmartVoxelHeader *pHead, const G4ThreeVector &localPoint)
G4VPhysicalVolume * GetTopVolume() const
void ReportOutsideMother(const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, const G4VPhysicalVolume *motherPV, G4double tDist=30.0 *CLHEP::cm) const
G4double GetTolerance() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4bool CheckAndReportBadNormal(const G4ThreeVector &unitNormal, const G4ThreeVector &localPoint, const G4ThreeVector &localDirection, G4double step, const G4VSolid *solid, const char *msg) const
G4double ComputeSafety(const G4ThreeVector &localPoint, const G4NavigationHistory &history, const G4double pProposedMaxLength=DBL_MAX)
G4double fVoxelSliceWidth
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4ParameterisedNavigation()
G4GLOB_DLL std::ostream G4cout
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4VSolid * GetSolid() const
G4SmartVoxelNode * fVoxelNode
const G4RotationMatrix * GetRotation() const
~G4ParameterisedNavigation()
static G4bool CheckPointOnSurface(const G4VSolid *sampleSolid, const G4ThreeVector &localPoint, const G4ThreeVector *globalDirection, const G4AffineTransform &sampleTransform, const G4bool locatedOnEdge)
virtual void SetCopyNo(G4int CopyNo)=0
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)
HepRotation inverse() const
G4VSolid * IdentifyAndPlaceSolid(G4int num, G4VPhysicalVolume *apparentPhys, G4VPVParameterisation *curParam)
const G4String & GetName() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments