File indexing completed on 2026-04-09 07:48:58
0001
0002 usage(){ cat << EOU
0003 CSGSimtraceRerunTest.sh
0004 ================================
0005
0006 CSGSimtraceRerunTest requires a CSGFoundry geometry and corresponding
0007 simtrace intersect array. Create these with::
0008
0009 geom_
0010
0011 gc
0012 ./translate.sh
0013
0014 gx
0015
0016 ./gxt.sh
0017 ./gxt.sh grab
0018 ./gxt.sh ana
0019
0020
0021 SELECTION envvar
0022 provides simtrace indices to rerun on CPU using CSGQuery which runs
0023 the CUDA compatible intersect code on the CPU.
0024 Without this envvar all the simtrace items ate rerun.
0025
0026 When using a rerun selection of a few intersects only it is
0027 possible to switch on full debug verbosity after
0028 recompilinh the CSG package with two non-standard preprocessor macros,
0029 that are not intended to ever be committed::
0030
0031 DEBUG
0032 DEBUG_RECORD
0033
0034 ::
0035
0036 c
0037 ./CSGSimtraceRerunTest.sh
0038 ./CSGSimtraceRerunTest.sh info
0039 ./CSGSimtraceRerunTest.sh run
0040 ./CSGSimtraceRerunTest.sh ana
0041
0042 EOU
0043 }
0044
0045
0046 arg=${1:-run}
0047
0048 bin=CSGSimtraceRerunTest
0049 log=$bin.log
0050 source $(dirname $BASH_SOURCE)/../bin/COMMON.sh
0051
0052 UGEOMDIR=${GEOMDIR//$HOME\/}
0053 BASE=$GEOMDIR/$bin
0054 UBASE=${BASE//$HOME\/}
0055 FOLD=$BASE/ALL
0056
0057 export CSGFoundry=INFO
0058
0059
0060 T_FOLD=${FOLD/$bin/G4CXSimtraceTest}
0061 export T_FOLD
0062
0063 if [ "info" == "$arg" ]; then
0064 vars="BASH_SOURCE arg bin GEOM GEOMDIR UGEOMDIR BASE UBASE FOLD T_FOLD"
0065 for var in $vars ; do printf "%30s : %s \n" $var ${!var} ; done
0066 fi
0067
0068 if [ "run" == "$arg" ]; then
0069 [ -f "$log" ] && rm $log
0070 $bin
0071 [ $? -ne 0 ] && echo $BASH_SOURCE run error $bin && exit 1
0072 fi
0073
0074 if [ "dbg" == "$arg" ]; then
0075 [ -f "$log" ] && rm $log
0076 case $(uname) in
0077 Darwin) lldb__ $bin ;;
0078 Linux) gdb__ $bin ;;
0079 esac
0080 [ $? -ne 0 ] && echo $BASH_SOURCE dbg error $bin && exit 1
0081 fi
0082
0083 if [ "ana" == "$arg" ]; then
0084 ${IPYTHON:-ipython} --pdb -i $(dirname $BASH_SOURCE)/tests/$bin.py
0085 [ $? -ne 0 ] && echo $BASH_SOURCE ana error $bin && exit 2
0086 fi
0087
0088 exit 0