Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/bin/bash
0002 usage(){ cat << EOU
0003 CSGFoundry_MakeCenterExtentGensteps_Test.sh
0004 ===============================================
0005 
0006 ::
0007 
0008    ~/o/CSG/tests/CSGFoundry_MakeCenterExtentGensteps_Test.sh
0009    LOG=1 ~/o/CSG/tests/CSGFoundry_MakeCenterExtentGensteps_Test.sh
0010 
0011 This checks the center-extent-gensteps used in CSGOptiX/cxs.sh
0012 by generating some photons on CPU from them and loading into python.
0013 
0014 EOU
0015 }
0016 
0017 
0018 cd $(dirname $(realpath $BASH_SOURCE))
0019 tmp=/tmp/$USER/opticks
0020 TMP=${TMP:-$tmp}
0021 
0022 name="CSGFoundry_MakeCenterExtentGensteps_Test"
0023 script=$name.py
0024 
0025 #export PYVISTA_KILL_DISPLAY=1
0026 export FOLD=$TMP/$name
0027 
0028 
0029 customgeom()
0030 {
0031     #local geom=HamaXZ_0
0032     local geom=HamaXZ_1000
0033     #local geom=XJfixtureConstruction_0
0034     #local geom=sWorld_XZ
0035 
0036     export GEOM=${GEOM:-$geom}
0037     ce_offset=0,0,0
0038     #ce_scale=1
0039     gridscale=0.10
0040 
0041     if [ "$GEOM" == "sWorld_XZ" ]; then
0042 
0043         moi=sWorld
0044         cegs=16:0:9:-24
0045 
0046     elif [ "$GEOM" == "HamaXZ_0" ]; then
0047 
0048         moi=Hama
0049         cegs=16:0:9:-24
0050 
0051     elif [ "$GEOM" == "HamaXZ_1000" ]; then
0052 
0053         moi=Hama:0:1000
0054         cegs=16:0:9:-24
0055         #gridscale=0.10
0056         ce_offset=0,-666.6,0
0057 
0058     elif [ "$GEOM" == "XJfixtureConstruction_0" ]; then
0059 
0060 
0061         ## see CSGTarget::getCenterExtent
0062 
0063         #gord=0       # default
0064         #gord=-1
0065         #gord=-2
0066         gord=-3       # model2world_rtpw = translate * scale * rotate
0067         #gord=-4
0068         #gord=-5
0069 
0070         moi="solidXJfixture:10:$gord"
0071 
0072         #cegs=16:0:9:100                # XZ/RP     (XYZ)->(RTP)
0073         cegs=0:16:9:-24                 # YZ/TP
0074         #gridscale=0.05
0075     fi
0076 }
0077 
0078 source $HOME/.opticks/GEOM/GEOM.sh
0079 
0080 
0081 moi=sChimneySteel:0:0
0082 cegs=16:0:9:100
0083 #ce_offset=CE
0084 
0085 
0086 export MOI=${MOI:-$moi}
0087 export CEGS=${CEGS:-$cegs}
0088 
0089 export GRIDSCALE=${GRIDSCALE:-$gridscale}
0090 
0091 
0092 # THESE SHOULDNT BE NEEDED
0093 #export CE_OFFSET=${CE_OFFSET:-$ce_offset}
0094 #export CE_SCALE=${CE_SCALE:-$ce_scale}
0095 
0096 
0097 
0098 
0099 logging(){
0100    export SFrameGenstep=INFO
0101 }
0102 [ -n "$LOG" ] && logging
0103 
0104 
0105 
0106 defarg="into_run_ana"
0107 arg=${1:-$defarg}
0108 
0109 vars="BASH_SOURCE SDIR MOI CEGS CE_OFFSET CE_SCALE GRIDSCALE"
0110 
0111 if [ "${arg/info}" != "$arg" ]; then
0112    for var in $vars ; do printf "%25s : %s \n" "$var" "${!var}" ; done
0113 fi
0114 
0115 if [ "${arg/run}" != "$arg" ]; then
0116    $name
0117    [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 1
0118 fi
0119 
0120 if [ "${arg/dbg}" != "$arg" ]; then
0121    source dbg__.sh
0122    dbg__ $name
0123    [ $? -ne 0 ] && echo $BASH_SOURCE dbg error && exit 2
0124 fi
0125 
0126 if [ "${arg/pdb}" != "$arg" ]; then
0127    ${IPYTHON:-ipython} --pdb -i $script
0128    [ $? -ne 0 ] && echo $BASH_SOURCE pdb error && exit 3
0129 fi
0130 
0131 if [ "${arg/ana}" != "$arg" ]; then
0132    ${PYTHON:-python} $script
0133    [ $? -ne 0 ] && echo $BASH_SOURCE ana error && exit 4
0134 fi
0135 
0136 exit 0
0137