12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Detector Definition and ResponseTo avoid spurious errors caused by roundoff, a rather generous tolerance of 0.1 micron is used by default. Thistolerance can be adjusted as needed by the application through the run-time command:geometry/test/tolerance Finally, notice that no mention is made of the possible daughter volumes of A, B, C, and D. To keep the codesimple, only the immediate daughters of a volume are checked at one pass. To test these "granddaughter" volumes,the daughters A, B, C, and D each have to be tested themselves in turn. To make this more automatic, an optionalrecursive algorithm is included; it first tests a target volume, then it loops over all daughter volumes and calls itself.Pay attention! For a complex geometry, checking the entire volume hierarchy can be extremely time consuming.4.1.11.3. Detecting overlaps at constructionSince release 8.0, the <strong>Geant4</strong> geometry modeler provides the ability to detect overlaps of placed volumes (normalplacements or parameterised) at the time of construction. This check is optional and can be activated wheninstantiating a placement (see G4PVPlacement constructor in Section 4.1.4.1) or a parameterised volume (seeG4PVParameterised constructor in Section 4.1.4.2).The positioning of that specific volume will be checked against all volumes in the same hierarchy level and itsmother volume. Depending on the complexity of the geometry being checked, the check may require considerableCPU time; it is there<strong>for</strong>e suggested to use it only <strong>for</strong> debugging the geometry setup and to apply it only to the partof the geometry setup which requires debugging.The classes G4PVPlacement and G4PVParameterised also provide a method:G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true)which will <strong>for</strong>ce the check <strong>for</strong> the specified volume, and can be there<strong>for</strong>e used to verify <strong>for</strong> overlaps also oncethe geometry is fully built. The check verifies if each placed or parameterised instance is overlapping with otherinstances or with its mother volume. A default resolution <strong>for</strong> the number of points to be generated and verifiedis provided. The method returns true if an overlap occurs. It is also possible to specify a "tolerance" by whichoverlaps not exceeding such quantity will not be reported; by default, all overlaps are reported.Using the visualization driver: DAVIDThe <strong>Geant4</strong> visualization offers a powerful debugging tool <strong>for</strong> detecting potential intersections of physical volumes.The <strong>Geant4</strong> DAVID visualization tool can infact automatically detect the overlaps between the volumesdefined in <strong>Geant4</strong> and converted to a graphical representation <strong>for</strong> visualization purposes. The accuracy of thegraphical representation can be tuned onto the exact geometrical description. In the debugging, physical-volumesurfaces are automatically decomposed into 3D polygons, and intersections of the generated polygons are investigated.If a polygon intersects with another one, physical volumes which these polygons belong to are visualized incolor (red is the default). The Figure 4.5 below is a sample visualization of a detector geometry with intersectingphysical volumes highlighted:Figure 4.5. A geometry with overlapping volumes highlighted by DAVID.110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!