Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:50:28

0001 #!/bin/bash
0002 usage(){ cat << EOU
0003 U4SimtraceSimpleTest.sh
0004 =========================
0005 
0006 Split from U4SimtraceTest.sh as that has PMTSim_standalone complications
0007 
0008 Uses U4SimtraceSimpleTest.cc which creates Geant4 geometry
0009 with U4VolumeMaker::PV depending on GEOM envvar
0010 and scans the geometry using U4SimtraceSimpleTest::scan
0011 saving the intersects into the folder configured with FOLD envvar.
0012 
0013 
0014 Commands
0015 -----------
0016 
0017 run/dbg
0018     simtrace intersects against geometry
0019 ana
0020     presentation of simtrace intersects using python matplotlib OR pyvista
0021 mpcap/pvcap
0022     screenshot current matplotlib/pyvista window with chrome cropped
0023 mppub/pvpub
0024     publication by copying matplotlib/pyvista screenshot png into presentation tree
0025 
0026 
0027 
0028 P[blyth@localhost tests]$ l $TMP/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/*_solid/B000/simtrace.npy
0029 198752 -rw-rw-r--. 1 blyth blyth 203520128 Apr  3 17:26 /data/blyth/opticks/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/VACUUM_solid/B000/simtrace.npy
0030 198752 -rw-rw-r--. 1 blyth blyth 203520128 Apr  3 17:26 /data/blyth/opticks/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/G4_Pb_solid/B000/simtrace.npy
0031 198752 -rw-rw-r--. 1 blyth blyth 203520128 Apr  3 17:26 /data/blyth/opticks/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/G4_AIR_solid/B000/simtrace.npy
0032 198752 -rw-rw-r--. 1 blyth blyth 203520128 Apr  3 17:26 /data/blyth/opticks/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/G4_WATER_solid/B000/simtrace.npy
0033 P[blyth@localhost tests]$ 
0034 
0035 P[blyth@localhost tests]$ cat /data/blyth/opticks/GEOM/RaindropRockAirWater/U4SimtraceSimpleTest/0/trs_names.txt 
0036 VACUUM_solid
0037 G4_Pb_solid
0038 G4_AIR_solid
0039 G4_WATER_solid
0040 
0041 
0042 EOU
0043 }
0044 
0045 cd $(dirname $(realpath $BASH_SOURCE))
0046 
0047 DIR=$PWD
0048 bin=U4SimtraceSimpleTest
0049 geom=RaindropRockAirWater
0050 evt=000
0051 eye=0,1000,0   # +Y 1000mm
0052 
0053 #cegs=16:0:9:1000   # default used from SFrameGenstep::MakeCenterExtentGensteps
0054 cegs=16:0:9:5000    # increase photon count for more precise detail
0055 
0056 #export GEOM=${GEOM:-$geom}
0057 export GEOM=$geom
0058 
0059 tmp=/tmp/$USER/opticks
0060 export TMP=${TMP:-$tmp}
0061 
0062 export BASE=$TMP/GEOM/$GEOM/$bin
0063 export FOLD=$BASE   ## controls where the U4SimtraceSimpleTest.cc writes trs
0064 
0065 export EVT=${EVT:-$evt}
0066 export EYE=${EYE:-$eye}       # not extent scaled, just mm
0067 export CEGS=${CEGS:-$cegs}
0068 export CEHIGH_0=-1:1:0:0:7:8:1000:4
0069 
0070 
0071 logging()
0072 {
0073    type $FUNCNAME
0074    export U4VolumeMaker=INFO
0075 }
0076 [ -n "$LOG" ] && logging
0077 
0078 
0079 log=$bin.log
0080 
0081 defarg="run_ana"
0082 arg=${1:-$defarg}
0083 
0084 
0085 if [ "${arg/info}" != "$arg" ]; then
0086     vv="arg defarg GEOM FOLD"
0087     for v in $vv ; do printf "%20s : %s \n" "$v" "${!v}" ; done
0088 fi 
0089 
0090 if [ "${arg/run}" != "$arg" ]; then
0091     [ -f "$log" ] && rm $log
0092     $bin
0093     [ $? -ne 0 ] && echo $BASH_SOURCE run error && exit 1
0094     [ -f "$log" ] && echo $BASH_SOURCE rename log $log to logN $logN && mv $log $logN
0095 fi
0096 
0097 if [ "${arg/dbg}" != "$arg" ]; then
0098     [ -f "$log" ] && rm $log
0099     source $DIR/../../bin/dbg__.sh
0100     dbg__ $bin
0101     [ $? -ne 0 ] && echo $BASH_SOURCE dbg error && exit 2
0102 fi
0103 
0104 if [ "${arg/ana}" != "$arg"  ]; then
0105     [ "$arg" == "nana" ] && export MODE=0
0106     ${IPYTHON:-ipython} --pdb -i $DIR/$bin.py
0107     [ $? -ne 0 ] && echo $BASH_SOURCE ana error && exit 3
0108 fi
0109 
0110 if [ "$arg" == "pvcap" -o "$arg" == "pvpub" -o "$arg" == "mpcap" -o "$arg" == "mppub" ]; then
0111     export CAP_BASE=$FOLD/figs
0112     export CAP_REL=U4SimtraceSimpleTest
0113     export CAP_STEM=$GEOM
0114     case $arg in
0115        pvcap) source pvcap.sh cap  ;;
0116        mpcap) source mpcap.sh cap  ;;
0117        pvpub) source pvcap.sh env  ;;
0118        mppub) source mpcap.sh env  ;;
0119     esac
0120     if [ "$arg" == "pvpub" -o "$arg" == "mppub" ]; then
0121         source epub.sh
0122     fi
0123 fi
0124 
0125 exit 0