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_CreateFromSimTest.sh testing CSGFoundry::CreateFromSim
0004 =====================================================================
0005 
0006 This is a technical test that are able to copy one CSGFoundry
0007 to another, rather than a comparison of two routes.
0008 This is because when using U4TreeCreate start from gdml
0009 and create SSim that creates the CSGFoundry.
0010 So will need to go upwards to gxt/G4CXOpticks_setGeometry_Test.sh
0011 for a more complete test.
0012 
0013 EOU
0014 }
0015 
0016 cd $(dirname $(realpath $BASH_SOURCE))
0017 bin=CSGFoundry_CreateFromSimTest
0018 
0019 script=CSGFoundryAB.py
0020 
0021 
0022 
0023 srcd=$HOME/.opticks/GEOM
0024 
0025 External_CFBaseFromGEOM=${GEOM}_CFBaseFromGEOM
0026 if [ -z "$NOXGEOM" -a -n "$GEOM" -a -n "${!External_CFBaseFromGEOM}" -a -d "${!External_CFBaseFromGEOM}" -a -f "${!External_CFBaseFromGEOM}/CSGFoundry/prim.npy" ]; then
0027     GEOM_METHOD="External GEOM setup : use NOXGEOM=1 to disable externally configured GEOM"
0028 else
0029     source $srcd/GEOM.sh  ## sets GEOM envvar, use GEOM bash function to setup/edit
0030     GEOM_METHOD="local sourcing of ~/.opticks/GEOM/GEOM.sh"
0031 fi
0032 
0033 CFB=${GEOM}_CFBaseFromGEOM  ## cannot use External_CFBaseFromGEOM because GEOM not defined up there
0034 export A_CFBASE=${!CFB}
0035 
0036 export FOLD=/tmp/$USER/opticks/$bin
0037 mkdir -p $FOLD
0038 
0039 # env for CSGFoundryAB comparison
0040 export B_CFBASE=$FOLD
0041 
0042 lvid=119
0043 ndid=0
0044 export LVID=${LVID:-$lvid}
0045 export NDID=${NDID:-$ndid}
0046 #export scsg_level=1
0047 
0048 vv="GEOM_METHOD GEOM NOXGEOM External_CFBaseFromGEOM ${External_CFBaseFromGEOM} A_CFBASE B_CFBASE"
0049 
0050 vv="$vv BASH_SOURCE bin GEOM BASE FOLD check script LVID NDID scsg_level"
0051 
0052 loglevel(){
0053    export CSGFoundry=INFO
0054    #export CSGImport=INFO
0055 }
0056 loglevel
0057 
0058 
0059 defarg=info_run_ana
0060 arg=${1:-$defarg}
0061 
0062 
0063 
0064 if [ "${arg/info}" != "$arg" ]; then
0065     for v in $vv ; do printf "%20s : %s \n" "$v" "${!v}" ; done
0066 fi
0067 
0068 if [ "${arg/run}" != "$arg" ]; then
0069     $bin
0070     [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 1
0071 fi
0072 
0073 if [ "${arg/dbg}" != "$arg" ]; then
0074     dbg__ $bin
0075     [ $? -ne 0 ] && echo $BASH_SOURCE dbg error && exit 2
0076 fi
0077 
0078 if [ "${arg/pdb}" != "$arg" ]; then
0079    ${IPYTHON:-ipython} --pdb -i $script
0080    [ $? -ne 0 ] && echo $BASH_SOURCE : pdb error && exit 1
0081 fi
0082 
0083 if [ "${arg/ana}" != "$arg" ]; then
0084    ${PYTHON:-python} $script
0085    [ $? -ne 0 ] && echo $BASH_SOURCE : ana error && exit 1
0086 fi
0087 
0088 exit 0
0089