Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:54

0001 #!/bin/bash -l 
0002 
0003 default=remote
0004 arg=${1:-$default}
0005 
0006 opticks-switch-key $arg 
0007 
0008 
0009 
0010 msg="=== $BASH_SOURCE :"
0011 usage(){ cat << EOU
0012 csg.sh : using test/CSGIntersectSolidTest.cc tests/CSGIntersectSolidTest.py without GEOM envvar 
0013 =================================================================================================
0014 
0015 TODO: factor off common parts of csg_geochain.sh and this script csg.sh 
0016 
0017 
0018 
0019 Dumping geometry::
0020 
0021    DUMP=1 DEBUG=1 ./csg.sh
0022 
0023 
0024 EOU
0025 }
0026 
0027 
0028 dx=0
0029 dy=0
0030 dz=0
0031 pho=${PHO:--100} 
0032 
0033 case $pho in
0034   -*)  echo $msg using regular bicycle spoke photon directions ;; 
0035    *)  echo $msg using random photon directions                ;;
0036 esac
0037 
0038 
0039 #sopr=0:0_YZ
0040 #sopr=0:0_XYZ
0041 #sopr=0:3_XY
0042 #sopr=0:3_XYZ
0043 #sopr=0:3_XZ
0044 sopr=0:3_YZ
0045 
0046 export VERBOSE=1
0047 export SOPR=${SOPR:-$sopr}
0048 
0049 
0050 case $SOPR in  
0051    *_XZ) cegs=16:0:9:$dx:$dy:$dz:$pho  ;;  
0052    *_YZ) cegs=0:16:9:$dx:$dy:$dz:$pho  ;;  
0053    *_XY) cegs=16:9:0:$dx:$dy:$dz:$pho  ;;  
0054    *_ZX) cegs=9:0:16:$dx:$dy:$dz:$pho  ;;  
0055    *_ZY) cegs=0:9:16:$dx:$dy:$dz:$pho  ;;  
0056    *_YX) cegs=9:16:0:$dx:$dy:$dz:$pho  ;;  
0057    *_XYZ) cegs=9:16:9:$dx:$dy:$dz:$pho ;;  
0058        *) echo $msg UNEXPECTED SUFFIX FOR SOPR $SOPR WHICH DOES NOT END WITH ONE OF : _XZ _YZ _XY _ZX _ZY _YX _XYZ  && exit 1   ;; 
0059 esac
0060 
0061 export CEGS=${CEGS:-$cegs}
0062 
0063 bin=CSGIntersectSolidTest
0064 script=tests/CSGIntersectSolidTest.py 
0065 arg=${1:-run_ana}
0066 
0067 
0068 if [ "${arg/run}" != "$arg" ]; then
0069 
0070     if [ -n "$DEBUG" ]; then 
0071         echo $msg running binary $bin under debugger
0072         if [ "$(uname)" == "Darwin" ]; then
0073             lldb__ $bin
0074         else
0075             gdb $bin
0076         fi 
0077         [ $? -ne 0 ] && echo $msg error while running binary $bin under debugger  && exit 1
0078     else
0079         echo $msg running binary $bin
0080         $bin
0081         [ $? -ne 0 ] && echo $msg error while running binary $bin  && exit 1
0082     fi 
0083 fi
0084 
0085 [ -n "$DUMP" ] && echo $msg early exit as DUMP defined && exit 0 
0086 
0087 if [ "${arg/ana}" != "$arg" ]; then
0088 
0089     cfbase_sh=/tmp/CFBASE.sh
0090     source $cfbase_sh
0091 
0092     [ -z "$CFBASE" ] && echo $msg ERROR no CFBASE && exit 1 
0093     [ -n "$CFBASE" ] && echo $msg using CFBASE $CFBASE from cfbase_sh $cfbase_sh 
0094 
0095     echo $msg running script $script
0096     ${IPYTHON:-ipython} --pdb -i $script
0097     [ $? -ne 0 ] && echo $msg script error && exit 2
0098 fi
0099 
0100 echo 0 
0101