Geant4.10
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4GeomTestVolume Class Reference

#include <G4GeomTestVolume.hh>

Public Member Functions

 G4GeomTestVolume (G4VPhysicalVolume *theTarget, G4double theTolerance=0.0, G4int numberOfPoints=10000, G4bool theVerbosity=true)
 
 ~G4GeomTestVolume ()
 
G4double GetTolerance () const
 
void SetTolerance (G4double tolerance)
 
G4int GetResolution () const
 
void SetResolution (G4int points)
 
G4bool GetVerbosity () const
 
void SetVerbosity (G4bool verbosity)
 
G4int GetErrorsThreshold () const
 
void SetErrorsThreshold (G4int max)
 
void TestRecursiveOverlap (G4int sLevel=0, G4int depth=-1)
 

Detailed Description

Definition at line 49 of file G4GeomTestVolume.hh.

Constructor & Destructor Documentation

G4GeomTestVolume::G4GeomTestVolume ( G4VPhysicalVolume theTarget,
G4double  theTolerance = 0.0,
G4int  numberOfPoints = 10000,
G4bool  theVerbosity = true 
)

Definition at line 49 of file G4GeomTestVolume.cc.

53  : target(theTarget), tolerance(theTolerance),
54  resolution(numberOfPoints), maxErr(1), verbosity(theVerbosity)
55 {;}
const XML_Char * target
G4GeomTestVolume::~G4GeomTestVolume ( )

Definition at line 60 of file G4GeomTestVolume.cc.

60 {;}

Member Function Documentation

G4int G4GeomTestVolume::GetErrorsThreshold ( ) const

Definition at line 113 of file G4GeomTestVolume.cc.

114 {
115  return maxErr;
116 }
G4int G4GeomTestVolume::GetResolution ( ) const

Definition at line 81 of file G4GeomTestVolume.cc.

82 {
83  return resolution;
84 }
G4double G4GeomTestVolume::GetTolerance ( ) const

Definition at line 65 of file G4GeomTestVolume.cc.

66 {
67  return tolerance;
68 }
G4bool G4GeomTestVolume::GetVerbosity ( ) const

Definition at line 97 of file G4GeomTestVolume.cc.

98 {
99  return verbosity;
100 }
void G4GeomTestVolume::SetErrorsThreshold ( G4int  max)

Definition at line 121 of file G4GeomTestVolume.cc.

References G4INCL::Math::max().

Referenced by G4GeometryMessenger::SetNewValue(), and TestRecursiveOverlap().

122 {
123  maxErr = max;
124 }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void G4GeomTestVolume::SetResolution ( G4int  points)

Definition at line 89 of file G4GeomTestVolume.cc.

Referenced by G4GeometryMessenger::SetNewValue().

90 {
91  resolution = np;
92 }
void G4GeomTestVolume::SetTolerance ( G4double  tolerance)

Definition at line 73 of file G4GeomTestVolume.cc.

Referenced by G4GeometryMessenger::SetNewValue().

74 {
75  tolerance = tol;
76 }
void G4GeomTestVolume::SetVerbosity ( G4bool  verbosity)

Definition at line 105 of file G4GeomTestVolume.cc.

Referenced by G4GeometryMessenger::SetNewValue().

106 {
107  verbosity = verb;
108 }
void G4GeomTestVolume::TestRecursiveOverlap ( G4int  sLevel = 0,
G4int  depth = -1 
)

Definition at line 129 of file G4GeomTestVolume.cc.

References G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetNoDaughters(), SetErrorsThreshold(), and TestRecursiveOverlap().

Referenced by TestRecursiveOverlap().

130 {
131  // If reached requested level of depth (i.e. set to 0), exit.
132  // If not depth specified (i.e. set to -1), visit the whole tree.
133  // If requested initial level of depth is not zero, visit from beginning
134  //
135  if (depth == 0) return;
136  if (depth != -1) depth--;
137  if (slevel != 0) slevel--;
138 
139  //
140  // As long as we reached the requested
141  // initial level of depth, test ourselves
142  //
143  if ( slevel==0 )
144  {
145  target->CheckOverlaps(resolution, tolerance, verbosity, maxErr);
146  }
147 
148  //
149  // Loop over unique daughters
150  //
151  std::set<const G4LogicalVolume *> tested;
152 
153  const G4LogicalVolume *logical = target->GetLogicalVolume();
154  G4int nDaughter = logical->GetNoDaughters();
155  G4int iDaughter;
156  for( iDaughter=0; iDaughter<nDaughter; ++iDaughter )
157  {
158  G4VPhysicalVolume *daughter = logical->GetDaughter(iDaughter);
159  const G4LogicalVolume *daughterLogical =
160  daughter->GetLogicalVolume();
161 
162  //
163  // Tested already?
164  //
165  std::pair<std::set<const G4LogicalVolume *>::iterator, G4bool>
166  there = tested.insert(daughterLogical);
167  if (!there.second) continue;
168 
169  //
170  // Recurse
171  //
172  G4GeomTestVolume vTest( daughter, tolerance, resolution, verbosity );
173  vTest.SetErrorsThreshold(maxErr);
174  vTest.TestRecursiveOverlap( slevel,depth );
175  }
176 }
G4VPhysicalVolume * GetDaughter(const G4int i) const
const XML_Char * target
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
G4int GetNoDaughters() const
G4LogicalVolume * GetLogicalVolume() const

The documentation for this class was generated from the following files: