HOWTO Quickly access Geometry Information using hd geom query
A utility exists for quickly accessing geometry information for a given point (X,Y,Z) in lab coordinates. The program is called hd_geom_query and the source is in:
This utility may not be built be default (at the time of this writing, it is not.) To build the tool, simply go to the source directory and type "make".
Running hd_geom_query with no arguments will give a usage statement:
Usage: hd_geom_query [options] X Y Z Print the material properties for the specified point in lab coordinates. Units of X,Y, and Z are cm. By default, this uses the geometry in $HDDS/src/hddsroot.h that was used to link this executable. The -xml switch may be used to dynamically compile and link code generated from the XML at run time. If an equals sign "=" follows the -xml switch then the main_HDDS.xml file is taken from the remainder of that argument. If the -xml switch is specified, then a file named "tmp_hddsroot.so" is searched for in the current directory. If found, it is opened and the geometry checksum is read from it and compared to that of the XML specified (which may be the default of $HDDS_HOME/main_HDDS.xml). If the two match, then that shared object is used, bypassing the (expensive) compilation phase. If the file is not present, is unreadable, or the checksums don't match, then the shared object is automatically (re)generated. options: -h or --help Print this usage statement -xml[=main_HDDS.xml] Dynamically generate geometry -checksum Print the MD5 checksum of the geometry and exit If the -xml option is given and no file is specified, then a value of: $HDDS_HOME/main_HDDS.xml is used.
By default, the program uses geometry from $HDDS_HOME/src/hddsroot.h. An option exists to have it dynamically generate geometry info from the XML using external HDDS tools (see the -xml option). If this is specified, code is generated and compiled into a shared object named tmp_hddsroot.so in the current directory. The file is left in case subsequent invocations of hd_geom_query are done using that same geometry. A MD5 checksum is used to decide if the tmp_hddsroot.so file needs to be regenerated. Therefore, the shared object file should be generated only one time so long as the XML does not change. If it does, the tool will detect this via the changed checksum and will regenerate the shared object.
As indicated in the Usage statement, the tool requires 3 arguments for the X, Y, and Z components of the desired point. All values are in cm and in lab coordinates. An example for a point at the center of the target is:
>hd_geom_query 0 0 65 Location: (X, Y, Z) = (0, 0, 65) =============================================== Volume: LIH2 material: LiqHydrogen density: 0.0708 g/cm^3 rad. length: 816.933 cm A: 1.00797 Z: 1 ancestory: LIH2 -> TGTV -> TARG -> HALL -> SITE