Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:02

0001 #!/bin/bash -l 
0002 source $PWD/../bin/GEOM.sh trim   ## sets GEOM envvar based on GEOM.txt file 
0003 
0004 msg="=== $BASH_SOURCE :"
0005 
0006 case $(uname) in 
0007    Linux)  argdef=run  ;;
0008    Darwin) argdef=ana  ;;
0009 esac
0010 arg=${1:-$argdef}
0011 
0012 usage(){ cat << EOU
0013 cxsimulate.sh : CSGOptiXSimulateTest combining CFBASE_LOCAL simple test geometry with standard CFBASE basis geometry  
0014 ======================================================================================================================
0015 
0016 Create the geometry, at CSG level::
0017 
0018    c
0019    ./CSGMakerTest.sh   
0020    ## TODO: confusingly this writes into GeoChain directory, switch to CSGMakerTest     
0021    ## OR change to a more appropriately named location for test geometries
0022 
0023 OR translate from G4 using the GeoChain::
0024 
0025    gc
0026    ./translate.sh 
0027 
0028 Run the sim::
0029 
0030    cx
0031    ./cxsimulate.sh 
0032 
0033 Grab from remote::
0034 
0035     cx
0036     ./tmp_grab.sh 
0037     ./cf_grab.sh 
0038 
0039 
0040 Laptop analysis::
0041 
0042    cx
0043    ./cxsimulate.sh ana
0044   
0045 EOU
0046 }
0047 
0048 export CFBASE_LOCAL=/tmp/$USER/opticks/GeoChain/$GEOM
0049 unset GEOM   # MUST unset GEOM for CSGFoundry::Load_ to load OPTICKS_KEY basis geometry 
0050 export OPTICKS_MAX_RECORD=10   # change from default of 0, see sysrap/SEventConfig.cc
0051 
0052 if [ "${arg/run}" != "$arg" -o "${arg/dbg}" != "$arg" ]; then 
0053     logdir=/tmp/$USER/opticks/CSGOptiXSimulateTest 
0054     mkdir -p $logdir
0055     iwd=$PWD
0056     cd $logdir
0057 
0058     if [ "${arg/run}" != "$arg" ] ; then
0059         CSGOptiXSimulateTest 
0060     elif [ "${arg/dbg}" != "$arg" ] ; then
0061         gdb CSGOptiXSimulateTest 
0062     fi  
0063 
0064     [ $? -ne 0 ] && echo $msg RUN ERROR && exit 1 
0065     echo $msg logdir $logdir 
0066     cd $iwd
0067 fi 
0068 
0069 if [ "${arg/ana}" != "$arg" ]; then 
0070 
0071     if [ "$(uname)" == "Darwin" ]; then
0072         opticks-switch-key remote   ## cx;cf_grab.sh to update local copy of the remote CSGFoundry for analysis consistency  
0073     fi 
0074     export FOLD=$CFBASE_LOCAL/CSGOptiXSimulateTest
0075     ${IPYTHON:-ipython} --pdb -i tests/CSGOptiXSimulateTest.py  
0076 fi 
0077 
0078 
0079 exit 0