Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/bin/bash -l 
0002 usage(){ cat << EOU
0003 mct.sh : intersection and plotting of multiple solids/volumes
0004 ===================================================================
0005 
0006 See also ct.sh that loads and plots single geometries. 
0007 
0008 Workflow:
0009 
0010 1. configure GEOM list with *geomlist_* bash function
0011 2. check status of the listed GEOM names::
0012 
0013    ~/opticks/CSG/mct.sh status  
0014 
0015 3. if any GEOM are listed as NO-CSGFoundry do translations to create them::
0016 
0017    ~/opticks/CSG/mct.sh translate
0018 
0019 4. if any GEOM are listed as NO-Intersect run the intersects::
0020 
0021    ~/opticks/CSG/mct.sh run
0022 
0023 5. present the intersects with python plots::
0024 
0025    ~/opticks/CSG/mct.sh ana
0026 
0027 
0028 Alternatively do all the above with::
0029 
0030     ~/opticks/CSG/mct.sh translate_run_ana 
0031 
0032 
0033 Manual "fitting" ellipses to the NNVT PMT::
0034 
0035     ELLIPSE0=249,179 ./mct.sh ## NNVT pmt_in
0036     ELLIPSE0=254,184 ./mct.sh ## NNVT pmt_out  +5
0037     ELLIPSE0=256,186 ./mct.sh ## NNVT mask_in  +5+2
0038     ELLIPSE0=264,194 ./mct.sh ## NNVT mask_out +5+2+8
0039 
0040 HAMA PMT top hemi::
0041 
0042     ELLIPSE0=249,185      ELLIPSE0_OPT=top ./mct.sh  ##        HAMA pmt_in   
0043     ELLIPSE0=254,190      ELLIPSE0_OPT=top ./mct.sh  ## +5     HAMA pmt_out 
0044     ELLIPSE0=256,192      ELLIPSE0_OPT=top ./mct.sh  ## +5+2   HAMA mask_in  
0045     ELLIPSE0=264,200      ELLIPSE0_OPT=top ./mct.sh  ## +5+2+8 HAMA mask_out
0046 
0047 HAMA PMT bot hemi::
0048 
0049     ELLIPSE0=249,185,0,-5 ELLIPSE0_OPT=bot ./mct.sh  ## HAMA pmt_in 
0050     ELLIPSE0=254,190,0,-5 ELLIPSE0_OPT=bot ./mct.sh  ## HAMA pmt_out 
0051     ELLIPSE0=256,192      ELLIPSE0_OPT=bot ./mct.sh  ## HAMA mask_in 
0052     ELLIPSE0=264,200      ELLIPSE0_OPT=bot ./mct.sh  ## HAMA mask_out 
0053 
0054 
0055 EOU
0056 }
0057 
0058 arg=${1:-ana}
0059 bin=CSGSimtraceTest
0060 log=$bin.log
0061 
0062 geomlist_FOLD=/tmp/$USER/opticks/GEOM/%s/$bin/ALL
0063 geomlist_OPT=U1
0064 source $(dirname $BASH_SOURCE)/../bin/geomlist.sh export
0065 
0066 #export FOCUS=257,-39,7
0067 #export FOCUS=100,-180,40
0068 
0069 export TOPLINE="CSG/mct.sh $geomlist_LABEL $SYMBOLS"
0070 export BOTLINE="FOCUS $FOCUS"
0071 
0072 
0073 if [ "${arg/translate}" != "$arg" ]; then 
0074     $(dirname $BASH_SOURCE)/../GeoChain/mtranslate.sh 
0075 fi 
0076 
0077 if [ "${arg/info}" != "$arg" ]; then 
0078     vars="BASH_SOURCE arg bin S_LABEL T_LABEL S_FOLD T_FOLD"
0079     for var in $vars ; do printf "%30s : %s \n" $var ${!var} ; done 
0080 fi
0081 
0082 if [ "${arg/status}"  != "$arg" ]; then 
0083     names=$(source $(dirname $BASH_SOURCE)/../bin/geomlist.sh names)
0084     for geom in $names 
0085     do  
0086          echo $geom 
0087     done
0088 fi 
0089 
0090 if [ "${arg/run}"  != "$arg" ]; then 
0091     names=$(source $(dirname $BASH_SOURCE)/../bin/geomlist.sh names)
0092     for geom in $names 
0093     do  
0094        export GEOM=$geom 
0095        export ${GEOM}_CFBaseFromGEOM=/tmp/$USER/opticks/GEOM/$geom    
0096        # doing what bin/GEOM_.sh normally does
0097        # could source GEOM_.sh with GEOM defined but its simpler to duplicate this little thing  
0098        $bin
0099     done 
0100 fi 
0101 
0102 if [ "${arg/ana}"  != "$arg" ]; then 
0103     ${IPYTHON:-ipython} --pdb -i $(dirname $BASH_SOURCE)/tests/$bin.py 
0104     [ $? -ne 0 ] && echo $BASH_SOURCE ana interactive error && exit 3
0105 fi 
0106 
0107 if [ "$arg" == "mpcap" -o "$arg" == "mppub" ]; then
0108     FOLD=$S_FOLD
0109     if [ -n "$geomlist_LABEL" ]; then 
0110         LABEL=${geomlist_LABEL}
0111     else
0112         LABEL=${S_LABEL}
0113     fi  
0114     export CAP_BASE=$FOLD/figs
0115     export CAP_REL=mct
0116     export CAP_STEM=${LABEL}_${SYMBOLS}
0117     case $arg in  
0118        mpcap) source mpcap.sh cap  ;;  
0119        mppub) source mpcap.sh env  ;;  
0120     esac
0121 
0122     if [ "$arg" == "mppub" ]; then 
0123         source epub.sh 
0124     fi  
0125 fi 
0126 
0127