61 tolerance(theTolerance),
62 extent(theTarget->GetLogicalVolume()->GetSolid()->GetExtent())
133 if (depth == 0)
return;
134 if (depth != -1) depth--;
135 if (slevel != 0) slevel--;
150 std::set<const G4LogicalVolume *> tested;
155 for( iDaughter=0; iDaughter<nDaughter; ++iDaughter )
170 std::pair<std::set<const G4LogicalVolume *>::iterator,
G4bool>
171 there = tested.insert(daughterLogical);
172 if (!there.second)
continue;
195 if (depth == 0)
return;
196 if (depth != -1) depth--;
197 if (slevel != 0) slevel--;
212 std::set<const G4LogicalVolume *> tested;
217 for( iDaughter=0; iDaughter<nDaughter; ++iDaughter )
232 std::pair<std::set<const G4LogicalVolume *>::iterator,
G4bool>
233 there = tested.insert(daughterLogical);
234 if (!there.second)
continue;
241 fracZ, fracRho, usePhi,
258 G4double rhoMax = std::sqrt(xMax*xMax + yMax*yMax);
262 G4double zHalfLength = 0.5*(zMax-zMin);
272 if ((iPhi&1) == 0) iPhi++;
300 p.
setZ( z0 + zScale*zHalfLength );
302 p.
setZ( z0 - zScale*zHalfLength );
304 }
while( zScale *= fracZ, --iZ );
306 }
while( rho *= fracRho, --iRho );
318 p.
setZ( z0 + zScale*zHalfLength );
322 p.
setZ( z0 - zScale*zHalfLength );
325 }
while( zScale *= fracZ, --iZ );
327 }
while( phi += deltaPhi, --iPhi );
338 if (n1 <= 0 || n2 <= 0)
339 G4Exception(
"G4GeomTestVolume::TestCartGrid()",
"GeomNav0002",
362 for(i1=0;i1<=n1;++i1)
366 for(i2=0;i2<=n2;++i2)
387 if (depth == 0)
return;
388 if (depth != -1) depth--;
389 if (slevel != 0) slevel--;
404 std::set<const G4LogicalVolume *> tested;
409 for( iDaughter=0; iDaughter<nDaughter; ++iDaughter )
424 std::pair<std::set<const G4LogicalVolume *>::iterator,
G4bool>
425 there = tested.insert(daughterLogical);
426 if (!there.second)
continue;
447 std::vector<G4GeomTestVolPoint> points;
471 for( iDaughter=0; iDaughter<nDaughter; ++iDaughter)
487 pLocal = (*rotation)*pLocal;
488 vLocal = (*rotation)*vLocal;
505 iDaughter, translation, rotation ) );
512 std::sort( points.begin(), points.end() );
531 std::vector<G4bool> checked( n,
false );
535 if (checked[i])
continue;
537 G4int iDaug = points[i].GetDaughterIndex();
538 if (iDaug < 0)
continue;
543 G4double iS = points[i].GetDistance();
547 if (iDaug == points[j].GetDaughterIndex())
break;
555 GetLogicalVolume()->GetSolid(),
556 "Unmatched intersection point",
557 points[i].GetPosition() );
563 G4double jS = points[j].GetDistance();
571 if (checked[k])
continue;
573 G4bool kEntering = points[k].Entering();
574 G4double kS = points[k].GetDistance();
580 G4int kDaug = points[k].GetDaughterIndex();
586 if (kS-iS <
tolerance && kEntering )
continue;
587 if (jS-kS <
tolerance && (!kEntering))
continue;
592 std::map<G4long,G4GeomTestOvershootList>::iterator overshoot =
596 std::pair<std::map<G4long,G4GeomTestOvershootList>::iterator,
G4bool>
598 overshoots.insert( std::pair<const G4long,G4GeomTestOvershootList>
600 overshoot = result.first;
604 (*overshoot).second.AddError( points[i].GetPosition(),
605 points[k].GetPosition() );
607 (*overshoot).second.AddError( points[k].GetPosition(),
608 points[j].GetPosition() );
615 if (kS-iS <
tolerance && (!kEntering))
continue;
616 if (jS-kS <
tolerance && kEntering )
continue;
621 G4long key = iDaug < kDaug ?
622 (iDaug*nDaughter + kDaug) : (kDaug*nDaughter + iDaug);
624 std::map<G4long,G4GeomTestOverlapList>::iterator overlap =
628 std::pair<std::map<G4long,G4GeomTestOverlapList>::iterator,
G4bool>
630 overlaps.insert( std::pair<const G4long,G4GeomTestOverlapList>
632 overlap = result.first;
635 if (points[k].Entering())
636 (*overlap).second.AddError( points[k].GetPosition(),
637 points[j].GetPosition() );
639 (*overlap).second.AddError( points[i].GetPosition(),
640 points[k].GetPosition() );
655 logger->
NoProblem(
"GeomTest: no daughter volume extending outside mother detected.");
658 std::map<G4long,G4GeomTestOvershootList>::iterator overshoot =
674 std::map<G4long,G4GeomTestOverlapList>::iterator overlap =
CLHEP::Hep3Vector G4ThreeVector
double dot(const Hep3Vector &) const
virtual void OverlappingDaughters(const G4GeomTestOverlapList *)=0
virtual void OvershootingDaughter(const G4GeomTestOvershootList *)=0
virtual void SolidProblem(const G4VSolid *solid, const G4String &message, const G4ThreeVector &point)=0
virtual void NoProblem(const G4String &message)=0
G4int GetNumberPoints() const
const G4GeomTestPoint & GetPoint(G4int i) const
void TestCylinder(G4int nPhi=90, G4int nZ=50, G4int nRho=50, G4double fracZ=0.8, G4double fracRho=0.8, G4bool usePhi=false)
void SetTolerance(G4double tolerance)
std::map< G4long, G4GeomTestOverlapList > overlaps
void TestCartGridY(G4int nz=100, G4int nx=100)
void TestOneLine(const G4ThreeVector &p, const G4ThreeVector &v)
void TestRecursiveLine(const G4ThreeVector &p, const G4ThreeVector &v, G4int sLevel=0, G4int depth=-1)
std::map< G4long, G4GeomTestOvershootList > overshoots
void TestRecursiveCylinder(G4int nPhi=90, G4int nZ=50, G4int nRho=50, G4double fracZ=0.8, G4double fracRho=0.8, G4bool usePhi=false, G4int sLevel=0, G4int depth=-1)
G4GeomTestVolume(const G4VPhysicalVolume *theTarget, G4GeomTestLogger *theLogger, G4double theTolerance=1E-4)
G4double GetTolerance() const
void TestCartGridX(G4int ny=100, G4int nz=100)
void TestRecursiveCartGrid(G4int nx=100, G4int ny=100, G4int nz=100, G4int sLevel=0, G4int depth=-1)
const G4VPhysicalVolume * target
void TestCartGrid(const G4ThreeVector &g1, const G4ThreeVector &g2, const G4ThreeVector &v, G4int n1, G4int n2)
G4GeomTestLogger * logger
void TestCartGridXYZ(G4int nx=100, G4int ny=100, G4int nz=100)
void TestCartGridZ(G4int nx=100, G4int ny=100)
G4VSolid * GetSolid() const
G4int GetNoDaughters() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
virtual G4bool IsReplicated() const =0
G4ThreeVector GetFrameTranslation() const
G4LogicalVolume * GetLogicalVolume() const
const G4RotationMatrix * GetFrameRotation() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)