Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:02:32

0001 #!/bin/bash
0002 
0003 #trignometry
0004 #sin ()
0005 #{
0006 #    echo "scale=5;s($1)" | bc -l
0007 #}
0008 #
0009 #add ()
0010 #{
0011 #    echo "scale=5;$1 + $2" | bc -l
0012 #}
0013 #
0014 #cos ()
0015 #{
0016 #    echo "scale=5;c($1)" | bc -l
0017 #}
0018 #
0019 #tan ()
0020 #{
0021 #    echo "scale=5;s($1)/c($1)" | bc -l
0022 #}
0023 
0024 
0025 function print_the_help {
0026   echo "USAGE: $0 -i <PRIM_FILE> <slices ...> "
0027   echo "  OPTIONS: "
0028   echo "            -t,--tag           filename tag (default: view1)"
0029   exit 
0030 }
0031 
0032 FILE_TAG="view14"
0033 INPUT_FILE="../../g4_0000.prim"
0034 
0035 
0036 POSITIONAL=()
0037 while [[ $# -gt 0 ]]
0038 do
0039   key="$1"
0040 
0041   case $key in
0042     -h|--help)
0043       shift # past argument
0044       print_the_help
0045       ;;
0046     -t|--tag)
0047       FILE_TAG="$2"
0048       shift # past argument
0049       shift # past value
0050       ;;
0051     -i|--input)
0052       INPUT_FILE="$2"
0053       shift # past argument
0054       shift # past value
0055       ;;
0056     -[a-zA-Z]*) # unknown option
0057       POSITIONAL+=("$1") # save it in an array for later
0058       echo "unknown option $1"
0059       print_the_help
0060       shift # past argument
0061       ;;
0062     *)     # positional options
0063       POSITIONAL+=("$1") # save it in an array for later
0064       shift # past argument
0065       ;;
0066   esac
0067 done
0068 set -- "${POSITIONAL[@]}" # restore positional parameters
0069 
0070 # units are mm
0071 
0072 original_file_tag="${FILE_TAG}"
0073 
0074 make_slice(){
0075   local zpos="$1"
0076   local tagnum=$(printf "%04d" ${zpos})
0077   local FILE_TAG="${original_file_tag}a${tagnum}"
0078   local z1=$(add ${zpos} 100)
0079   local z2=$(add ${zpos} -100)
0080   #dawncut 0 0 1 ${z1}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim 
0081   #dawncut 0 0 -1 -${z2}0  ${FILE_TAG}_temp0.prim  ${FILE_TAG}.prim
0082   ../../bin/dawn_tweak -z ${zpos}0
0083   cp ${INPUT_FILE} ${FILE_TAG}.prim
0084   dawn -d ${FILE_TAG}.prim 
0085   ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf
0086   gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \
0087     -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0088     -f ${FILE_TAG}_full.pdf
0089       pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox
0090   rm "${FILE_TAG}_temp0.prim"
0091   rm "${FILE_TAG}.prim"
0092 }
0093 
0094 for zzz in $@ ;
0095 do
0096   make_slice ${zzz} 
0097 done
0098 
0099 wait
0100 
0101 
0102 
0103 #dawncut 0  1 0 10 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim 
0104 #dawncut 0 -1 0 0 ${FILE_TAG}c_temp0.prim  ${FILE_TAG}c.prim
0105 #dawn -d ${FILE_TAG}c.prim 
0106 #ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf
0107 #gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \
0108 #  -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0109 #  -f ${FILE_TAG}c_full.pdf
0110 #pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox
0111 #
0112 ## slice at z = -1m
0113 #dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim 
0114 #dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim  ${FILE_TAG}d.prim
0115 #dawn -d ${FILE_TAG}d.prim 
0116 #ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf
0117 #gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \
0118 #  -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0119 #  -f ${FILE_TAG}d_full.pdf
0120 #pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox
0121 #
0122 ## slice at z = -2m
0123 #dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim 
0124 #dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim  ${FILE_TAG}e.prim
0125 #dawn -d ${FILE_TAG}e.prim 
0126 #ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf
0127 #gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \
0128 #  -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \
0129 #  -f ${FILE_TAG}e_full.pdf
0130 #pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox
0131 
0132 
0133 #https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html
0134 # % dawncut a b c d input-file [output-file]
0135 #
0136 #       input-file : Source DAWN-format file describing a 3D scene.
0137 #
0138 #       output-file: Output DAWN-format file describing a plane-clipped 
0139 #                    3D scene.  The default output stream is stdout.
0140 #
0141 #       a, b, c, d : Parameters  a, b, c, and d  are double values to
0142 #                    define a clipping plane described with the following 
0143 #                    equation: 
0144 #
0145 #                       ax + by + cz + d = 0. 
0146 #
0147 #                    Vector (a,b,c) defines the normal vector of 
0148 #                    the clipping plane.  
0149 #                    3D scene data in the half space at the front side 
0150 #                    of the clipping plane are clipped out and erased. 
0151 #                    The normal vector (a,b,c) needs not be a unit vector. 
0152 #                    If it is a unit vector, parameter "d" gives distance 
0153 #                    between the clipping plane and origin (0,0,0).