-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploadAllPedRuns.sh
executable file
·152 lines (131 loc) · 3.75 KB
/
uploadAllPedRuns.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash -e
#
# uploadAllPedRuns.sh
# This script will upload all pedestals runs to the database.
# Input:
# - $1: CMSSW version
# - $2: log directory
#
# Set the input variables
CMSSW_VERSION="$1"
LOG_DIR="$2"
# Get the directories of interest
CURRENT_DIR=$(pwd)
export WORK_DIR="${CURRENT_DIR}"
SCRIPT_DIR="$(dirname "$0")"
cd "${SCRIPT_DIR}"
# Set up the environment
# shellcheck source=/dev/null
source envSetup.sh
# Initial settings
localRunsDir=/data/hcaldqm/DQMIO/LOCAL
referenceFile=${SCRIPT_DIR}/data/pedRuns_uploaded.dat
outputFile=${SCRIPT_DIR}/data/pedsForUpload.dat
parameterFile=${SCRIPT_DIR}/DBUtils/pedestals.par
ctlFile=${SCRIPT_DIR}/DBUtils/pedestals.ctl
logFile=${SCRIPT_DIR}/DBUtils/pedestals.log
badFile=${SCRIPT_DIR}/DBUtils/pedestals.bad
DEBUG="false"
# Help statement
usage(){
EXIT=$1
echo -e "uploadAllPedRuns.sh [options]\n"
echo "-d dry run option for testing. Runs the code without uploading to DB."
echo "-h display this message."
exit "$EXIT"
}
# Process options
while getopts "dh" opt; do
case "$opt" in
d) DEBUG="true"
;;
h | *)
usage 0
;;
esac
done
# Set up CMSSW
echo -n "Setting up CMSSW: "
cd "${SCRIPT_DIR}"
# shellcheck source=/dev/null
source /opt/offline/cmsset_default.sh
CMSSW_PATH="../../CMSSW/${CMSSW_VERSION}"
cd "${CMSSW_PATH}/src"
eval "$(scramv1 runtime -sh)"
cd "${CURRENT_DIR}"