SLAC PEP-II
BABAR
SLAC <-> RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Computing Search
Environment
Online SW
Offline
Simulation:
  Help needed
News
  Discussions
  Meetings
  Releases
Production
  MDC1, 2, '96
  Batch, stage
  Tapes
Simu codes
  BBSIM
  Trigger simu
  Aslund
  Bogus/G4
  Digitization
Subsystems
  PEP SVT DCH
  DRC EMC IFR
Generators
  Beget
QA/QC
  REMEDY
Development
  Requirements
  Geant4
  Schedule
  People
  Programming
  Porting lab
Tools
  dbio, dbin
  Euclid
  McFIO
Reviews
Doc index
Archive
Subscribe to page
Powered by NetMind

Using Geometry Tests in Bogus


Algorithm

Built into BgsApp (BgsFwkModule V00-03-18 or greater) is code designed to test for geometry errors. It is based on generic geant4 testing code in BgsG4Extension (V00-00-22 or greater) that uses the intersection of solids with linear trajectories to uncover problems. For example, consider the following:

|Geometry Example|

Here we have a line intersecting some physical volume (large, black rectangle). Belonging to the volume are four daughters: A, B, C, and D. Indicated by the dots are the intersections of the line with the mother volume and the four daughters.

This example has two geometry errors. First, volume A sticks outside its mother volume (this practice, sometimes used in geant3, is not supported in geant4). This can be noticed because the intersection point (leftmost magenta dot) lies outside the mother volume, as defined by the space between the two black dots.

The second error is that daughter volumes A and B overlap. This is noticable because one of the intersections with A (rightmost magenta dot) is inside the volume B, as defined as the space between the red dots. Alternatively, one of the intersections with B (leftmost red dot) is inside the volume A, as defined as the space between the magenta dots.

Each of these two types of errors is represented by a line segment, which has a start point, an end point, and, alternately, a length. Depending on the type of error, the points are most clearly recognized in either the coordinate system of the volume, the global (BaBar) coordinate system, or the coordinate system of the daughters involved.

Also notice that certain errors will be missed unless a line is supplied in precisely the correct path. Unfortunately, it is hard to predict which lines are best at uncovering potential geometry errors. Instead, the geometry testing code uses a grid of lines, in the hope of at least uncovering gross geometry errors. More subtle errors could easily be missed.

Another difficult issue is roundoff error. For example, daughters C and D lie precisely next to each other. It is possible, due to roundoff, that one of the intersections points will lie just slightly inside the space of the other. In addition, a volume that lies tightly up against the outside of its mother may have an intersection point that just slightly lies outside the mother.

To avoid spurious errors caused by roundoff, a rather generous tolerance of 0.1 micron is used. At the moment, this tolerance is fixed, but if you believe that some adjustment would be useful, let me know, and it can be added.

Finally, notice that I made no mention of the possible daughter volumes of A, B, C, and D. To keep the code simple, 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, the geometry testing code has a recursive algorithm that firsts test a target volume, and then loops over all daughter volumes and calls itself.

For a complex geometry, checking the entire volume heirachy can be extremely time consuming. You have been warned!

Usage

The geometry checking code in BgsG4Extension is implemented in class BfmGeomTest belonging to package BgsFwkModule. To control testing, the following tcl parameters have been added to the Bogus module in BgsApp:

  • geomTestMother: (boolean) If "true", the immediate daughter volumes of the BaBar mother volume are checked. These are the daughter volumes that are commonly refered to as the "subsystem mother" volumes.
  • geomTestAll: (boolean) If "true", a recursive check of all volumes in the entire detector are checked. Very time consuming.
  • geomTestMesh: (int) The size of the mesh of lines used in the recursive test of volumes. To make sure that the recursive test would not take hours, the default value is 20. For a more exhaustive test, increase this value. Be careful, though: the CPU time will go as the square of this value.
  • geomTestSubject: (string list) Set this tcl parameter to the name of any physical volume you wished checked. Make sure you use the (case sensitive) name of the physical volume (and not the name of the logical volume). This tcl parameter may be set any number of times to check multiple volumes.
  • geomTestAllSubject (string list) As in the above, except each volume specified is tested recursively. The size of the mesh used is controlled by the geomTestMesh parameter.

Here is an example:

module talk Bogus
#
#  Test all subsystem mother volumes for problems
#
   geomTestMother set true
#
#  Test some specific volumes for problems with their
#  immediate daughters
#
   geomTestSubject set Dch
   geomTestSubject set EMCA
   geomTestSubject set DCO5_phys
#
#  Test the SVT recursively, using a fine mesh
#  Be prepared to wait!
#
   geomTestMesh set 100
   geomTestAllSubject set Svt
exit

The tests are run after the first event. If no problems are found, there will be no output. Otherwise, you will get something like the following for each error:


GeomTest Error: Overshooting daughter volume
    The volume DCO5_phys[0] appears to extend outside the mother volume DCHO_phys[0]
    at the following points in global coordinates: (list truncated)
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
          0.014002          -57.7882        -56.63       -124.38         -57.7742        -56.63       -124.38
         0.0124996          -64.7325        -48.54         27.64           -64.72        -48.54         27.64
         0.0109108           74.1461        -32.36       -110.56           74.157        -32.36       -110.56
         0.0109108           74.1461        -32.36         96.74           74.157        -32.36         96.74
         0.0102062          -79.2757        -16.18        -41.46         -79.2655        -16.18        -41.46
         0.0100504          -80.5045         -8.09        110.56         -80.4945         -8.09        110.56
         0.0100504          -80.5045          8.09   5.68434e-15         -80.4945          8.09   5.68434e-15
         0.0115468           -70.073         40.45       -110.56         -70.0615         40.45       -110.56
          0.014002          -57.7882         56.63         41.46         -57.7742         56.63         41.46
         0.0115468            -40.45       -70.073       -124.38           -40.45      -70.0615       -124.38
         0.0229355             72.81      -35.2864       -110.56            72.81      -35.2635       -110.56
         0.0102062             16.18      -79.2757        -82.92            16.18      -79.2655        -82.92
         0.0115468            -40.45       -70.073        -55.28           -40.45      -70.0615        -55.28
         0.0229355             72.81      -35.2864        -41.46            72.81      -35.2635        -41.46
         0.0102062             16.18      -79.2757        -13.82            16.18      -79.2655        -13.82
         0.0115468            -40.45       -70.073         13.82           -40.45      -70.0615         13.82
         0.0229355             72.81      -35.2864         27.64            72.81      -35.2635         27.64
         0.0102062             16.18      -79.2757         55.28            16.18      -79.2655         55.28
         0.0115468            -40.45       -70.073         82.92           -40.45      -70.0615         82.92
         0.0229355             72.81      -35.2864         96.74            72.81      -35.2635         96.74
    Which in the mother coordinate system are:
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
          0.014002          -57.7882        -56.63       -124.38         -57.7742        -56.63       -124.38
         0.0124996          -64.7325        -48.54         27.64           -64.72        -48.54         27.64
         0.0109108           74.1461        -32.36       -110.56           74.157        -32.36       -110.56
         0.0109108           74.1461        -32.36         96.74           74.157        -32.36         96.74
         0.0102062          -79.2757        -16.18        -41.46         -79.2655        -16.18        -41.46
         0.0100504          -80.5045         -8.09        110.56         -80.4945         -8.09        110.56
         0.0100504          -80.5045          8.09   5.68434e-15         -80.4945          8.09   5.68434e-15
         0.0115468           -70.073         40.45       -110.56         -70.0615         40.45       -110.56
          0.014002          -57.7882         56.63         41.46         -57.7742         56.63         41.46
         0.0115468            -40.45       -70.073       -124.38           -40.45      -70.0615       -124.38
         0.0229355             72.81      -35.2864       -110.56            72.81      -35.2635       -110.56
         0.0102062             16.18      -79.2757        -82.92            16.18      -79.2655        -82.92
         0.0115468            -40.45       -70.073        -55.28           -40.45      -70.0615        -55.28
         0.0229355             72.81      -35.2864        -41.46            72.81      -35.2635        -41.46
         0.0102062             16.18      -79.2757        -13.82            16.18      -79.2655        -13.82
         0.0115468            -40.45       -70.073         13.82           -40.45      -70.0615         13.82
         0.0229355             72.81      -35.2864         27.64            72.81      -35.2635         27.64
         0.0102062             16.18      -79.2757         55.28            16.18      -79.2655         55.28
         0.0115468            -40.45       -70.073         82.92           -40.45      -70.0615         82.92
         0.0229355             72.81      -35.2864         96.74            72.81      -35.2635         96.74
    Which in the coordinate system of DCO5_phys[0] are:
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
          0.014002          -57.7882        -56.63       -124.38         -57.7742        -56.63       -124.38
         0.0124996          -64.7325        -48.54         27.64           -64.72        -48.54         27.64
         0.0109108           74.1461        -32.36       -110.56           74.157        -32.36       -110.56
         0.0109108           74.1461        -32.36         96.74           74.157        -32.36         96.74
         0.0102062          -79.2757        -16.18        -41.46         -79.2655        -16.18        -41.46
         0.0100504          -80.5045         -8.09        110.56         -80.4945         -8.09        110.56
         0.0100504          -80.5045          8.09   5.68434e-15         -80.4945          8.09   5.68434e-15
         0.0115468           -70.073         40.45       -110.56         -70.0615         40.45       -110.56
          0.014002          -57.7882         56.63         41.46         -57.7742         56.63         41.46
         0.0115468            -40.45       -70.073       -124.38           -40.45      -70.0615       -124.38
         0.0229355             72.81      -35.2864       -110.56            72.81      -35.2635       -110.56
         0.0102062             16.18      -79.2757        -82.92            16.18      -79.2655        -82.92
         0.0115468            -40.45       -70.073        -55.28           -40.45      -70.0615        -55.28
         0.0229355             72.81      -35.2864        -41.46            72.81      -35.2635        -41.46
         0.0102062             16.18      -79.2757        -13.82            16.18      -79.2655        -13.82
         0.0115468            -40.45       -70.073         13.82           -40.45      -70.0615         13.82
         0.0229355             72.81      -35.2864         27.64            72.81      -35.2635         27.64
         0.0102062             16.18      -79.2757         55.28            16.18      -79.2655         55.28
         0.0115468            -40.45       -70.073         82.92           -40.45      -70.0615         82.92
         0.0229355             72.81      -35.2864         96.74            72.81      -35.2635         96.74

Page author: David C. Williams
Last significant update: Jan-04-2001 $Id: GeomTest.html,v 1.1 2001/01/04 22:00:52 davidw Exp $