File indexing completed on 2026-04-10 07:50:29
0001
0002 usage(){ cat << EOU
0003 U4TreeCreateTest.sh : loads geometry, runs U4Tree::Create populating stree.h, saves to FOLD
0004 ==============================================================================================
0005
0006 The geometry may be loaded by various means including from GDML or j/PMTSim via U4VolumeMaker::
0007
0008 ~/o/u4/tests/U4TreeCreateTest.sh
0009
0010 To update the stree impl used by U4TreeCreateTest it is necessary to
0011 build and install both sysrap and u4::
0012
0013 sy;om;u4;om
0014
0015 See also U4Polycone_test.sh which avoids slow rebuild after changing WITH macros
0016 by directly compiling the needed SysRap sources and not using the full SysRap library.
0017
0018 EOU
0019 }
0020
0021 cd $(dirname $(realpath $BASH_SOURCE))
0022 SDIR=$PWD
0023
0024 bin=U4TreeCreateTest
0025 script=$bin.py
0026
0027 export TMP=${TMP:-/tmp/$USER/opticks}
0028 export FOLD=$TMP/$bin
0029
0030
0031
0032 defarg="info_run_ana"
0033 arg=${1:-$defarg}
0034
0035 logging()
0036 {
0037 type $FUNCNAME
0038 export U4VolumeMaker=INFO
0039 export U4Solid=INFO
0040
0041 export DUMMY=INFO
0042 }
0043 [ -n "$LOG" ] && logging
0044
0045
0046
0047
0048 export U4Solid__IsFlaggedLVID=0
0049
0050
0051
0052 source $HOME/.opticks/GEOM/GEOM.sh
0053
0054 _CFB=${GEOM}_CFBaseFromGEOM
0055 CFB=${!_CFB}
0056 xgdmlpath=$CFB/origin.gdml
0057
0058 if [ -n "$CFB" -a -d "$CFB" -a -f "$CFB/origin.gdml" ]; then
0059 note="binary $bin is expected to load $xgdmlpath"
0060 else
0061 note="NOT using CFBaseFromGEOM resolution"
0062 fi
0063
0064
0065 vars="BASH_SOURCE SDIR defarg arg bin GEOM _CFB CFB xgdmlpath note TMP FOLD script"
0066
0067
0068 if [ "${arg/info}" != "$arg" ]; then
0069 for var in $vars ; do printf "%30s : %s \n" "$var" "${!var}" ; done
0070 fi
0071
0072 if [ "${arg/clean}" != "$arg" ]; then
0073 cd $TMP && rm -rf U4TreeCreateTest
0074 [ $? -ne 0 ] && echo $BASH_SOURCE clean error && exit 1
0075 cd $SDIR
0076 fi
0077
0078 if [ "${arg/run}" != "$arg" ]; then
0079 $bin
0080 [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 1
0081 fi
0082
0083 if [ "${arg/load}" != "$arg" ]; then
0084 $bin load
0085 [ $? -ne 0 ] && echo $BASH_SOURCE load error && exit 2
0086 fi
0087
0088 if [ "${arg/dbg}" != "$arg" ]; then
0089 source dbg__.sh
0090 dbg__ $bin
0091 [ $? -ne 0 ] && echo $BASH_SOURCE dbg error && exit 3
0092 fi
0093
0094 if [ "${arg/ana}" != "$arg" ]; then
0095 ${PYTHON:-python} $script
0096 [ $? -ne 0 ] && echo $BASH_SOURCE ana error && exit 4
0097 fi
0098
0099 if [ "${arg/pdb}" != "$arg" ]; then
0100 ${IPYTHON:-ipython} --pdb -i $script
0101 [ $? -ne 0 ] && echo $BASH_SOURCE pdb error && exit 5
0102 fi
0103
0104 exit 0