From ff7a02027cd3d7073a65c07ec5aeadeb900b011d Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Wed, 5 May 2021 19:08:47 +0000 Subject: [PATCH] Add optional event views --- .gitlab-ci.yml | 6 +- scripts/view14/generate_eps | 38 ++++----- scripts/view15/generate_eps | 166 ++++++++++++++++++++++++++++++++++++ views/config.yml | 44 ++-------- views/view1.yml | 13 ++- views/view11.yml | 56 ++++++++++++ views/view12.yml | 15 ++++ views/view13.yml | 15 ++++ views/view14.yml | 15 ++++ views/view15.yml | 15 ++++ views/view2.yml | 22 ++++- views/view3.yml | 14 ++- views/view6.yml | 30 ++++++- views/view7.yml | 21 ++++- 14 files changed, 407 insertions(+), 63 deletions(-) create mode 100755 scripts/view15/generate_eps create mode 100644 views/view11.yml create mode 100644 views/view12.yml create mode 100644 views/view13.yml create mode 100644 views/view14.yml create mode 100644 views/view15.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e411837d..2ddb4c50 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -84,7 +84,11 @@ include: - local: 'views/view3.yml' - local: 'views/view6.yml' - local: 'views/view7.yml' - - local: 'views/config.yml' + - local: 'views/view11.yml' + - local: 'views/view12.yml' + - local: 'views/view13.yml' + - local: 'views/view14.yml' + - local: 'views/view15.yml' report: stage: finalize diff --git a/scripts/view14/generate_eps b/scripts/view14/generate_eps index c9fa6485..492bd3f3 100755 --- a/scripts/view14/generate_eps +++ b/scripts/view14/generate_eps @@ -1,25 +1,25 @@ #!/bin/bash #trignometry -sin () -{ - echo "scale=5;s($1)" | bc -l -} - -add () -{ - echo "scale=5;$1 + $2" | bc -l -} - -cos () -{ - echo "scale=5;c($1)" | bc -l -} - -tan () -{ - echo "scale=5;s($1)/c($1)" | bc -l -} +#sin () +#{ +# echo "scale=5;s($1)" | bc -l +#} +# +#add () +#{ +# echo "scale=5;$1 + $2" | bc -l +#} +# +#cos () +#{ +# echo "scale=5;c($1)" | bc -l +#} +# +#tan () +#{ +# echo "scale=5;s($1)/c($1)" | bc -l +#} function print_the_help { diff --git a/scripts/view15/generate_eps b/scripts/view15/generate_eps new file mode 100755 index 00000000..09ac01ad --- /dev/null +++ b/scripts/view15/generate_eps @@ -0,0 +1,166 @@ +#!/bin/bash + +#trignometry +#sin () +#{ +# echo "scale=5;s($1)" | bc -l +#} +# +#add () +#{ +# echo "scale=5;$1 + $2" | bc -l +#} +# +#cos () +#{ +# echo "scale=5;c($1)" | bc -l +#} +# +#tan () +#{ +# echo "scale=5;s($1)/c($1)" | bc -l +#} + + +function print_the_help { + echo "USAGE: $0 -i <PRIM_FILE> " + echo " OPTIONS: " + echo " -t,--tag filename tag (default: view1)" + exit +} + +FILE_TAG="view15" +INPUT_FILE="../../g4_0000.prim" + + +POSITIONAL=() +while [[ $# -gt 0 ]] +do + key="$1" + + case $key in + -h|--help) + shift # past argument + print_the_help + ;; + -t|--tag) + FILE_TAG="$2" + shift # past argument + shift # past value + ;; + -i|--input) + INPUT_FILE="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + #POSITIONAL+=("$1") # save it in an array for later + echo "unknown option $1" + print_the_help + shift # past argument + ;; + esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +# units are mm + +echo "view15 produces a series of slightly rotated XY slices a different z locations. Along beamline" + +# slice at z = 2m +# note the offset has to change with sign of the direction to cut in the opposite direction. +#dawncut 0 0 1 10005 ${INPUT_FILE} ${FILE_TAG}b_temp0.prim +#dawncut 0 0 -1 -1000 ${FILE_TAG}b_temp0.prim ${FILE_TAG}b.prim +#dawn ${FILE_TAG}b.prim +#ps2pdf ${FILE_TAG}b.eps ${FILE_TAG}b_full.pdf +#gs -o ${FILE_TAG}b.pdf -sDEVICE=pdfwrite \ +# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \ +# -f ${FILE_TAG}b_full.pdf +#pdftoppm ${FILE_TAG}b.pdf ${FILE_TAG}b -png -singlefile -cropbox + +echo "done ..." + + +original_file_tag="${FILE_TAG}" + +make_slice(){ + local zpos="$1" + local tagnum=$(printf "%04d" ${zpos}) + local FILE_TAG="${original_file_tag}a${tagnum}" + local z1=$(add ${zpos} 100) + local z2=$(add ${zpos} -100) + #dawncut 0 0 1 ${z1}1 ${INPUT_FILE} ${FILE_TAG}_temp0.prim + #dawncut 0 0 -1 -${z2}0 ${FILE_TAG}_temp0.prim ${FILE_TAG}.prim + ../../bin/dawn_tweak -z ${zpos}0 --draw 5 + #cp ${INPUT_FILE} ${FILE_TAG}.prim + dawncut -1 0 0 0 ${INPUT_FILE} ${FILE_TAG}.prim + dawn -d ${FILE_TAG}.prim + ps2pdf ${FILE_TAG}.eps ${FILE_TAG}_full.pdf + gs -o ${FILE_TAG}.pdf -sDEVICE=pdfwrite \ + -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \ + -f ${FILE_TAG}_full.pdf + pdftoppm ${FILE_TAG}.pdf ${FILE_TAG} -png -singlefile -cropbox + rm "${FILE_TAG}_temp0.prim" + rm "${FILE_TAG}.prim" +} + +for zzz in $(seq 150 50 2000) ; +do + make_slice ${zzz} +done + +wait + + + +#dawncut 0 1 0 10 ${INPUT_FILE} ${FILE_TAG}c_temp0.prim +#dawncut 0 -1 0 0 ${FILE_TAG}c_temp0.prim ${FILE_TAG}c.prim +#dawn -d ${FILE_TAG}c.prim +#ps2pdf ${FILE_TAG}c.eps ${FILE_TAG}c_full.pdf +#gs -o ${FILE_TAG}c.pdf -sDEVICE=pdfwrite \ +# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \ +# -f ${FILE_TAG}c_full.pdf +#pdftoppm ${FILE_TAG}c.pdf ${FILE_TAG}c -png -singlefile -cropbox +# +## slice at z = -1m +#dawncut 0 0 1 -1000 ${INPUT_FILE} ${FILE_TAG}d_temp0.prim +#dawncut 0 0 -1 1001 ${FILE_TAG}d_temp0.prim ${FILE_TAG}d.prim +#dawn -d ${FILE_TAG}d.prim +#ps2pdf ${FILE_TAG}d.eps ${FILE_TAG}d_full.pdf +#gs -o ${FILE_TAG}d.pdf -sDEVICE=pdfwrite \ +# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \ +# -f ${FILE_TAG}d_full.pdf +#pdftoppm ${FILE_TAG}d.pdf ${FILE_TAG}d -png -singlefile -cropbox +# +## slice at z = -2m +#dawncut 0 0 1 -2000 ${INPUT_FILE} ${FILE_TAG}e_temp0.prim +#dawncut 0 0 -1 2001 ${FILE_TAG}e_temp0.prim ${FILE_TAG}e.prim +#dawn -d ${FILE_TAG}e.prim +#ps2pdf ${FILE_TAG}e.eps ${FILE_TAG}e_full.pdf +#gs -o ${FILE_TAG}e.pdf -sDEVICE=pdfwrite \ +# -c "[/CropBox [50 175 550 675] /PAGES pdfmark" \ +# -f ${FILE_TAG}e_full.pdf +#pdftoppm ${FILE_TAG}e.pdf ${FILE_TAG}e -png -singlefile -cropbox + + +#https://geant4.kek.jp/~tanaka/DAWN/About_DAWNCUT.html +# % dawncut a b c d input-file [output-file] +# +# input-file : Source DAWN-format file describing a 3D scene. +# +# output-file: Output DAWN-format file describing a plane-clipped +# 3D scene. The default output stream is stdout. +# +# a, b, c, d : Parameters a, b, c, and d are double values to +# define a clipping plane described with the following +# equation: +# +# ax + by + cz + d = 0. +# +# Vector (a,b,c) defines the normal vector of +# the clipping plane. +# 3D scene data in the half space at the front side +# of the clipping plane are clipped out and erased. +# The normal vector (a,b,c) needs not be a unit vector. +# If it is a unit vector, parameter "d" gives distance +# between the clipping plane and origin (0,0,0). diff --git a/views/config.yml b/views/config.yml index 21d6d1e8..2650bcce 100644 --- a/views/config.yml +++ b/views/config.yml @@ -1,36 +1,8 @@ -dawn_view_11:detector: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -D -dawn_view_11:ev000: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -dawn_view_11:ev001: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 1 -dawn_view_11:ev002: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 2 -dawn_view_11:ev003: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 3 -dawn_view_11:ev004: - extends: .views - script: - - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 4 -dawn_view_12:detector: - extends: .views - script: - - ./bin/make_dawn_views -t view12 -d scripts/view12 -D -dawn_view_13:detector: - extends: .views - script: - - ./bin/make_dawn_views -t view13 -d scripts/view13 -D -dawn_view_14:detector: - extends: .views - script: - - ./bin/make_dawn_views -t view14 -d scripts/view14 -D +#dawn_view_13:detector: +# extends: .views +# script: +# - ./bin/make_dawn_views -t view13 -d scripts/view13 -D +#dawn_view_14:detector: +# extends: .views +# script: +# - ./bin/make_dawn_views -t view14 -d scripts/view14 -D diff --git a/views/view1.yml b/views/view1.yml index 9f92c437..75475fa9 100644 --- a/views/view1.yml +++ b/views/view1.yml @@ -4,17 +4,28 @@ dawn_view_01:detector: - ./bin/make_dawn_views -t view01 -d scripts/view1 -D dawn_view_01:ev001: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - ./bin/make_dawn_views -t view01_ev001 -d scripts/view1 -s 1 dawn_view_01:ev002: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - ./bin/make_dawn_views -t view01_ev001 -d scripts/view1 -s 2 view_01: stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' needs: - - ["dawn_view_01:detector", "dawn_view_01:ev001","dawn_view_01:ev002"] + - job: dawn_view_01:detector + optional: false + - job: dawn_view_01:ev001 + optional: true + - job: dawn_view_01:ev002 + optional: true script: - ls -lrth * - ls -lrth images/* diff --git a/views/view11.yml b/views/view11.yml new file mode 100644 index 00000000..9b3b384f --- /dev/null +++ b/views/view11.yml @@ -0,0 +1,56 @@ +dawn_view_11:detector: + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 -D +dawn_view_11:ev000: + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 +dawn_view_11:ev001: + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 1 +dawn_view_11:ev002: + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 2 +dawn_view_11:ev003: + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 3 +dawn_view_11:ev004: + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + extends: .views + script: + - ./bin/make_dawn_views -t view11 -d scripts/view11 -s 4 + +view_11: + stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: + - job: compile + optional: false + - job: dawn_view_11:detector + optional: false + - job: dawn_view_11:ev001 + optional: true + - job: dawn_view_11:ev002 + optional: true + - job: dawn_view_11:ev003 + optional: true + - job: dawn_view_11:ev004 + optional: true + script: + - ls -lrth * + - ls -lrth images/* + diff --git a/views/view12.yml b/views/view12.yml new file mode 100644 index 00000000..4f7d6ccd --- /dev/null +++ b/views/view12.yml @@ -0,0 +1,15 @@ +dawn_view_12:detector: + extends: .views + script: + - ./bin/make_dawn_views -t view12 -d scripts/view12 -D + +view_12: + stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: + - ["dawn_view_12:detector"] + script: + - ls -lrth * + - ls -lrth images/* + diff --git a/views/view13.yml b/views/view13.yml new file mode 100644 index 00000000..c5d4f486 --- /dev/null +++ b/views/view13.yml @@ -0,0 +1,15 @@ +dawn_view_13:detector: + extends: .views + script: + - ./bin/make_dawn_views -t view13 -d scripts/view13 -D + +view_13: + stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: + - ["dawn_view_13:detector"] + script: + - ls -lrth * + - ls -lrth images/* + diff --git a/views/view14.yml b/views/view14.yml new file mode 100644 index 00000000..9cd9a365 --- /dev/null +++ b/views/view14.yml @@ -0,0 +1,15 @@ +dawn_view_14:detector: + extends: .views + script: + - ./bin/make_dawn_views -t view14 -d scripts/view14 -D + +view_14: + stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: + - ["dawn_view_14:detector"] + script: + - ls -lrth * + - ls -lrth images/* + diff --git a/views/view15.yml b/views/view15.yml new file mode 100644 index 00000000..124ca01b --- /dev/null +++ b/views/view15.yml @@ -0,0 +1,15 @@ +dawn_view_15:detector: + extends: .views + script: + - ./bin/make_dawn_views -t view15 -d scripts/view15 -D + +view_15: + stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' + needs: + - ["dawn_view_15:detector"] + script: + - ls -lrth * + - ls -lrth images/* + diff --git a/views/view2.yml b/views/view2.yml index 047e51db..1c9fc241 100644 --- a/views/view2.yml +++ b/views/view2.yml @@ -2,15 +2,35 @@ dawn_view_02:detector: extends: .views script: - ./bin/make_dawn_views -t view02 -d scripts/view2 -D +#dawn_view_02:ev001: +# extends: .views +# script: +# - ./bin/make_dawn_views -t view02_ev001 -d scripts/view2 -s 1 dawn_view_02:ev002: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - ./bin/make_dawn_views -t view02_ev002 -d scripts/view2 -s 2 +dawn_view_02:ev003: + extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + script: + - ./bin/make_dawn_views -t view02_ev003 -d scripts/view2 -s 3 view_02: stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' needs: - - ["dawn_view_02:detector", "dawn_view_02:ev002"] + - job: dawn_view_02:detector + optional: false + - job: dawn_view_02:ev002 + optional: true + - job: dawn_view_02:ev003 + optional: true + #- ["dawn_view_02:detector", "dawn_view_02:ev001", "dawn_view_02:ev002", "dawn_view_02:ev003"] script: - ls -lrth * - ls -lrth images/* diff --git a/views/view3.yml b/views/view3.yml index 69f11876..4aef66f3 100644 --- a/views/view3.yml +++ b/views/view3.yml @@ -2,15 +2,27 @@ dawn_view_03:detector: extends: .views script: - ./bin/make_dawn_views -t view02 -d scripts/view2 -D +#dawn_view_03:ev001: +# extends: .views +# script: +# - ./bin/make_dawn_views -t view02_ev001 -d scripts/view2 -s 1 dawn_view_03:ev002: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - ./bin/make_dawn_views -t view02_ev002 -d scripts/view2 -s 2 view_03: stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' needs: - - ["dawn_view_03:detector", "dawn_view_03:ev002"] + - job: dawn_view_03:detector + optional: false + - job: dawn_view_03:ev002 + optional: true + #- ["dawn_view_03:detector", "dawn_view_03:ev001", "dawn_view_03:ev002"] script: - ls -lrth * - ls -lrth images/* diff --git a/views/view6.yml b/views/view6.yml index f0fda5c5..1ad761c1 100644 --- a/views/view6.yml +++ b/views/view6.yml @@ -2,15 +2,43 @@ dawn_view_06:detector: extends: .views script: - ./bin/make_dawn_views -t view02 -d scripts/view2 -D +#dawn_view_06:ev001: +# extends: .views +# script: +# - ./bin/make_dawn_views -t view02_ev001 -d scripts/view2 -s 1 +dawn_view_06:ev002: + extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + script: + - ./bin/make_dawn_views -t view02_ev002 -d scripts/view2 -s 2 +dawn_view_06:ev003: + extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + script: + - ./bin/make_dawn_views -t view02_ev003 -d scripts/view2 -s 3 dawn_view_06:ev004: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - ./bin/make_dawn_views -t view02_ev004 -d scripts/view2 -s 4 view_06: stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' needs: - - ["dawn_view_06:detector", "dawn_view_06:ev004"] + - job: dawn_view_06:detector + optional: false + - job: dawn_view_06:ev002 + optional: true + - job: dawn_view_06:ev003 + optional: true + - job: dawn_view_06:ev004 + optional: true + #- ["dawn_view_06:detector", "dawn_view_06:ev001", "dawn_view_06:ev002", "dawn_view_06:ev003", "dawn_view_06:ev004"] script: - ls -lrth * - ls -lrth images/* diff --git a/views/view7.yml b/views/view7.yml index 0e308a3e..c59d1a42 100644 --- a/views/view7.yml +++ b/views/view7.yml @@ -1,16 +1,31 @@ dawn_view_07:detector: extends: .views script: - - ./bin/make_dawn_views -t view02 -d scripts/view2 -D + - ./bin/make_dawn_views -t view07 -d scripts/view2 -D dawn_view_07:ev002: extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' script: - - ./bin/make_dawn_views -t view02_ev002 -d scripts/view2 -s 2 + - ./bin/make_dawn_views -t view07_ev002 -d scripts/view2 -s 2 +dawn_view_07:ev003: + extends: .views + rules: + - if: '$DETECTOR_EVENT_VIEWS == "ON"' + script: + - ./bin/make_dawn_views -t view07_ev003 -d scripts/view2 -s 3 view_07: stage: test + rules: + - if: '$CI_SERVER_HOST == "eicweb.phy.anl.gov"' needs: - - ["dawn_view_07:detector", "dawn_view_07:ev002"] + - job: dawn_view_07:detector + optional: false + - job: dawn_view_07:ev002 + optional: true + - job: dawn_view_07:ev003 + optional: true script: - ls -lrth * - ls -lrth images/* -- GitLab