Skip to content

Commit 5c3d530

Browse files
author
RaulRPrado
committed
Adding scripts for compressing
1 parent f1d801f commit 5c3d530

File tree

9 files changed

+185
-14
lines changed

9 files changed

+185
-14
lines changed

compressCARE

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash
2+
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o pipefail # don't hide errors within pipes
5+
6+
SECONDS=0
7+
8+
echo "Starting mergeCARE"
9+
10+
show_help() {
11+
echo ""
12+
echo "Syntax: ./mergeCARE [ -arg value ]"
13+
echo "Options:"
14+
echo "-src (source directory)"
15+
echo "-zenith (zenith angle)"
16+
echo "-wobble (wobble)"
17+
echo "-atm (summer/62 or winter/61)"
18+
echo "-nsb (list of NSB levels)"
19+
echo "-mode (std or rhv)"
20+
echo "-n_max ()"
21+
echo "-n_min ()"
22+
echo ""
23+
}
24+
25+
atm="winter"
26+
zenith="20"
27+
wobble="1.0"
28+
mode="std"
29+
nsb="200"
30+
31+
while :; do
32+
case $1 in
33+
-h|-\?|--help)
34+
show_help
35+
exit
36+
;;
37+
-src)
38+
source_dir=$2
39+
shift
40+
;;
41+
-zenith)
42+
zenith=$2
43+
shift
44+
;;
45+
-wobble)
46+
wobble=$2
47+
shift
48+
;;
49+
-atm)
50+
atm=$2
51+
shift
52+
;;
53+
-nsb)
54+
nsb=$2
55+
shift
56+
;;
57+
-mode)
58+
mode=$2
59+
shift
60+
;;
61+
*)
62+
break
63+
esac
64+
shift
65+
done
66+
67+
echo "Source:${source_dir}"
68+
69+
# shellcheck disable=SC1091,SC1090
70+
source "${source_dir}/util.sh"
71+
# shellcheck disable=SC1091,SC1090
72+
source "${source_dir}/setupMC.sh"
73+
# shellcheck disable=SC1091,SC1090
74+
source "${source_dir}/loadVBF.sh"
75+
# shellcheck disable=SC1091,SC1090
76+
source "${source_dir}/loadRoot.sh"
77+
78+
atm=$(validate_atm "${atm}")
79+
zenith=$(validate_zenith "${zenith}")
80+
wobble=$(validate_wobble "${wobble}")
81+
mode=$(validate_mode "${mode}")
82+
83+
merged_care_file=$(merged_care_file "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
84+
compressed_care_file=$(compressed_care_file "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
85+
86+
merged_dir=$(merged_root_name "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
87+
88+
mkdir -p "${merged_dir}"
89+
90+
mv "${merged_care_file}" "${merged_dir}"
91+
92+
tar -czvf "${compressed_care_file}" "${merged_dir}"
93+
94+
print_runtime "${SECONDS}"
95+

mergeCARE

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ printf "%s\n" "${merged_care_file}"
113113
# shellcheck disable=SC2086
114114
${SW_DIR}/eventDisplay/v501_rd/bin/mergeVBF "${files_to_merge}" "${merged_care_file}" 1
115115

116-
# time_file="merging_time.dat"
117-
# number_file="merging_number.dat"
118-
119-
# echo "${SECONDS}" >> "${time_file}"
120-
# echo "${n_max}" >> "${number_file}"
121-
122116
rm "${files_to_merge}"
123117

124118
print_runtime "${SECONDS}"

setupMC.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ ! -z "${LD_LIBRARY_PATH}" ]; then
88
fi
99

1010
# shellcheck disable=SC1091
11-
source /afs/ifh.de/group/cta/scratch/prado/MC-VERITAS/loadROOT.sh
11+
source /afs/ifh.de/group/cta/scratch/prado/MC-DESY/loadRoot.sh
1212

1313
export SW_DIR="/afs/ifh.de/group/cta/scratch/prado/sw"
1414

subCARE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ for n in ${all_n}; do
8181

8282
if [ "${do_submit}" = "true" ]; then
8383
# shellcheck disable=SC2086
84-
qsub -P veritas -l s_cpu=12:00:00 -l h_rss=2G ${send_mail} -N "care_${wobble}" -e "${log_err}" -o "${log_out}" "${source_dir}/runCARE" -run "${runs}" -zenith "${zenith}" -atm "${atm}" -wobble "${wobble}" -mode "${mode}" -nsb "${nsb_list}" -src "${source_dir}"
84+
qsub -P veritas -l s_cpu=24:00:00 -l h_rss=2G ${send_mail} -N "care_${wobble}" -e "${log_err}" -o "${log_out}" "${source_dir}/runCARE" -run "${runs}" -zenith "${zenith}" -atm "${atm}" -wobble "${wobble}" -mode "${mode}" -nsb "${nsb_list}" -src "${source_dir}"
8585
fi
8686

8787
nruns=0

subCompress

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
set -o errexit # abort on nonzero exitstatus
4+
set -o pipefail # don't hide errors within pipes
5+
6+
echo "Starting subCompress"
7+
8+
# shellcheck disable=SC1090,SC1091
9+
source "util.sh"
10+
11+
atm="winter"
12+
zenith="20"
13+
wobble="0.5"
14+
mode="std"
15+
nsb_group="all"
16+
source_dir=${PWD}
17+
18+
# shellcheck disable=SC2068
19+
collect_arguments 5 atm zenith wobble mode nsb_group $@
20+
21+
atm=$(validate_atm "${atm}")
22+
zenith=$(validate_zenith "${zenith}")
23+
wobble=$(validate_wobble "${wobble}")
24+
mode=$(validate_mode "${mode}")
25+
nsb_list=$(nsb_list_from_group "${nsb_group}")
26+
27+
for nsb in ${nsb_list}; do
28+
send_mail="-m ae" # splitting is necessary
29+
log_err=$(compressed_care_log "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}" "err")
30+
log_out=$(compressed_care_log "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}" "out")
31+
remove_file "${log_err}" "${log_out}" || true
32+
mkdir -p "$(dirname "${log_out}")"
33+
34+
# shellcheck disable=SC2086
35+
qsub -P veritas -l s_cpu=48:00:00 -l h_rss=4G ${send_mail} -N "comp_${wobble}" -e "${log_err}" -o "${log_out}" "${source_dir}/compressCARE" -zenith "${zenith}" -atm "${atm}" -wobble "${wobble}" -mode "${mode}" -nsb "${nsb}" -src "${source_dir}"
36+
done

subGrOptics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ source_dir=${PWD}
1717
readonly runs_per_job=20
1818
readonly do_submit="true"
1919
readonly force="false"
20-
readonly n_mail=10
20+
readonly n_mail=5
2121

2222
# shellcheck disable=SC2068
2323
collect_arguments 4 atm zenith wobble n_max $@

subManyGeneric

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
./subCARE -zenith 20 -wobble 0.5 -nsb_group a
4-
./subCARE -zenith 20 -wobble 0.5 -nsb_group b
5-
./subCARE -zenith 20 -wobble 0.5 -nsb_group c
3+
./subCARE -zenith 20 -wobble 1.75 -nsb_group a
4+
./subCARE -zenith 20 -wobble 1.75 -nsb_group b
5+
./subCARE -zenith 20 -wobble 1.75 -nsb_group c

subMerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ atm="winter"
1212
zenith="20"
1313
wobble="0.5"
1414
mode="std"
15-
nsb_group="a"
15+
nsb_group="b"
1616
n_max=100001
1717
source_dir=${PWD}
1818

util.sh

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,21 @@ care_log()
496496
echo "/lustre/fs23/group/veritas/V6_DESY/${atm_dir}/${zenith_dir}/care_${mode}/wobble${wobble}/Log/NSB${nsb}/log_${run}.${label}"
497497
}
498498

499+
merged_root_name()
500+
{
501+
local zenith=$1
502+
local atm=$2
503+
local wobble=$3
504+
local nsb=$4
505+
local mode=$5
506+
local atm_dir
507+
atm_dir=$(atm_directory "${atm}")
508+
local zenith_dir
509+
zenith_dir=$(zenith_directory "${zenith}")
510+
511+
echo "/lustre/fs23/group/veritas/V6_DESY/${atm_dir}/${zenith_dir}/merged/Data/gamma_V6_CARE_${mode}_${atm_dir}_zen${zenith}deg_${wobble}wob_${nsb}MHz"
512+
}
513+
499514
merged_care_file()
500515
{
501516
local zenith=$1
@@ -507,8 +522,23 @@ merged_care_file()
507522
atm_dir=$(atm_directory "${atm}")
508523
local zenith_dir
509524
zenith_dir=$(zenith_directory "${zenith}")
525+
name=$(merged_root_name "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
526+
echo "${name}.vbf"
527+
}
510528

511-
echo "/lustre/fs23/group/veritas/V6_DESY/${atm_dir}/${zenith_dir}/merged/Data/gamma_V6_CARE_${mode}_${atm_dir}_zen${zenith}deg_${wobble}wob_${nsb}MHz.vbf"
529+
compressed_care_file()
530+
{
531+
local zenith=$1
532+
local atm=$2
533+
local wobble=$3
534+
local nsb=$4
535+
local mode=$5
536+
local atm_dir
537+
atm_dir=$(atm_directory "${atm}")
538+
local zenith_dir
539+
zenith_dir=$(zenith_directory "${zenith}")
540+
name=$(merged_root_name "${zenith}" "${atm}" "${wobble}" "${nsb}" "${mode}")
541+
echo "${name}.tar.gz"
512542
}
513543

514544
merged_care_log()
@@ -526,3 +556,19 @@ merged_care_log()
526556

527557
echo "/lustre/fs23/group/veritas/V6_DESY/${atm_dir}/${zenith_dir}/merged/Log/log_V6_CARE_${mode}_${atm_dir}_zen${zenith}deg_${wobble}wob_${nsb}MHz.${label}"
528558
}
559+
560+
compressed_care_log()
561+
{
562+
local zenith=$1
563+
local atm=$2
564+
local wobble=$3
565+
local nsb=$4
566+
local mode=$5
567+
local label=$6
568+
local atm_dir
569+
atm_dir=$(atm_directory "${atm}")
570+
local zenith_dir
571+
zenith_dir=$(zenith_directory "${zenith}")
572+
573+
echo "/lustre/fs23/group/veritas/V6_DESY/${atm_dir}/${zenith_dir}/merged/Log/compressed_V6_CARE_${mode}_${atm_dir}_zen${zenith}deg_${wobble}wob_${nsb}MHz.${label}"
574+
}

0 commit comments

Comments
 (0)