1 |
mangano |
1.1 |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
######################################################
|
4 |
|
|
# heds 0 (create new directories)
|
5 |
|
|
# heds 1 (query runregistry)
|
6 |
|
|
# heds 2 (create crab task)
|
7 |
|
|
# heds 3 (get and publish jobs)
|
8 |
|
|
# heds 4 (create all the html tables and store logs)
|
9 |
|
|
# heds 5* (event display stuff)
|
10 |
|
|
######################################################
|
11 |
|
|
|
12 |
|
|
choice=$1
|
13 |
|
|
|
14 |
|
|
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
case $choice in
|
19 |
mangano |
1.5 |
######### "public functions" which are meant to be called by the users ################
|
20 |
|
|
up) ### bootstrap for heds job submission. It creates the intial configuration file
|
21 |
mangano |
1.11 |
whoami=`whoami`
|
22 |
mangano |
1.5 |
cat > ./heds.cfg <<EOF
|
23 |
mangano |
1.7 |
### insert a day of data-taking in the format DD.MM.YYYY
|
24 |
mangano |
1.5 |
HEDS_LABEL=18.04.2010
|
25 |
mangano |
1.7 |
|
26 |
|
|
### name of the local folder containing the configuration and output of your heds task
|
27 |
|
|
HEDS_LOCALSTORE=""
|
28 |
|
|
|
29 |
|
|
### input sample
|
30 |
|
|
#HEDS_INPUTDATASET=/MinimumBias/Commissioning10-Apr20ReReco-v1/RECO #up to run 133532
|
31 |
|
|
HEDS_INPUTDATASET=/MinimumBias/Commissioning10-PromptReco-v9/RECO #starting from run 133532
|
32 |
|
|
|
33 |
|
|
|
34 |
mangano |
1.11 |
HEDS_SKIMVERSION=99
|
35 |
mangano |
1.5 |
HEDS_TASKATTEMPT=1
|
36 |
|
|
|
37 |
mangano |
1.11 |
HEDS_USERID=$whoami
|
38 |
mangano |
1.5 |
HEDS_T2SITE=T2_US_UCSD
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
### TO BE FIXED. THESE VARIABLE COULD BE RETRIEVED FROM A QUERY TO PHEDEX ###
|
42 |
|
|
HEDS_STORAGEPATH=/srm/v2/server?SFN=/hadoop/cms
|
43 |
|
|
HEDS_STORAGEPORT=8443
|
44 |
|
|
EOF
|
45 |
|
|
echo -e "+++ Bootstrap of \"heds\" scripts peformed"
|
46 |
|
|
echo -e "+++ The configuration file \"heds.cfg\" has been created in the current folder:"
|
47 |
|
|
echo -e " "$PWD "\n"
|
48 |
|
|
echo "+++ Edit the heds.cfg according to your needs and then execute: "
|
49 |
|
|
echo -e " ""heds.sh create heds.cfg"
|
50 |
|
|
;;
|
51 |
|
|
|
52 |
|
|
create) ### create local heds taskFolder
|
53 |
|
|
configFile=$2
|
54 |
|
|
if [ -z "$configFile" ]; then
|
55 |
|
|
echo "+++ ERROR: you have to specify the configuration file as in:"
|
56 |
|
|
echo " heds.sh create <heds.cfg>"
|
57 |
|
|
exit 1
|
58 |
|
|
fi
|
59 |
|
|
|
60 |
|
|
if [ -z "$CMSSW_BASE" ]; then
|
61 |
|
|
echo "+++ ERROR: you have to setup CMSSW environment first. Run cmsenv";
|
62 |
|
|
(exit 1;)
|
63 |
|
|
fi
|
64 |
|
|
|
65 |
|
|
if [ ! -d $CMSSW_BASE/src/HiggsAnalysis/EarlyDataStudy/scripts ]; then
|
66 |
|
|
echo "+++ ERROR: you have to checkout and compile \"HiggsAnalysis/EarlyDataStudy\" first.";
|
67 |
|
|
(exit 1;)
|
68 |
|
|
fi
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
# get rid of lines with comments
|
73 |
|
|
grep -v '^#' $configFile > tmpFile
|
74 |
|
|
mv tmpFile ${configFile}
|
75 |
|
|
|
76 |
|
|
# add export lines
|
77 |
|
|
grep -v '^$' ${configFile}| awk '{print "export "$0}' > tmpFile
|
78 |
|
|
mv tmpFile ${configFile}
|
79 |
|
|
|
80 |
|
|
# define default taskFolder if it is not defined in the cfg file
|
81 |
|
|
autoString=heds_taskFolder_`date '+%d_%m_%Y_%H_%M'`
|
82 |
|
|
source ${configFile}
|
83 |
|
|
if [ -z "$HEDS_LOCALSTORE" ]; then
|
84 |
|
|
sed "s#HEDS_LOCALSTORE=\"\"#HEDS_LOCALSTORE=$autoString#" ${configFile} > tmpFile
|
85 |
|
|
mv tmpFile ${configFile}
|
86 |
|
|
fi
|
87 |
|
|
|
88 |
|
|
# make taskFolder path absolute
|
89 |
|
|
tmpString="HEDS_LOCALSTORE=`pwd`/"
|
90 |
|
|
sed "s#HEDS_LOCALSTORE=#$tmpString#" ${configFile} > tmpFile
|
91 |
|
|
mv tmpFile ${configFile}
|
92 |
|
|
|
93 |
|
|
source ${configFile}
|
94 |
|
|
|
95 |
|
|
cat >> ${configFile} <<EOF
|
96 |
mangano |
1.6 |
###### this part was not set by the user. It was automatically generated ########
|
97 |
mangano |
1.5 |
export HEDS_NAMEPREFIX=HiggsSimpleSkimV${HEDS_SKIMVERSION}\_
|
98 |
|
|
export HEDS_CASTORFOLDER=/castor/cern.ch/user/${HEDS_USERID:0:1}/$HEDS_USERID/HEDS
|
99 |
|
|
export HEDS_WWWAREA_TMP=${HEDS_LOCALSTORE}/wwwPagesInPreliminaryShape
|
100 |
|
|
export HEDS_WWWAREA=/afs/cern.ch/cms/Physics/Higgs/HiggsDQM/HiggsEDS
|
101 |
mangano |
1.6 |
export HEDSPATH=$CMSSW_BASE/src/HiggsAnalysis/EarlyDataStudy
|
102 |
mangano |
1.5 |
EOF
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
if [ -d $HEDS_LOCALSTORE ]; then
|
107 |
|
|
echo "ERROR: the folder" $HEDS_LOCALSTORE "already exists." \
|
108 |
|
|
"Plese specify a different one in your .cfg file"
|
109 |
|
|
exit 1
|
110 |
|
|
else
|
111 |
|
|
mkdir $HEDS_LOCALSTORE
|
112 |
|
|
mv ./${configFile} $HEDS_LOCALSTORE/configuration
|
113 |
|
|
fi
|
114 |
|
|
|
115 |
mangano |
1.6 |
cat > $HEDS_LOCALSTORE/status <<EOF
|
116 |
|
|
create
|
117 |
|
|
EOF
|
118 |
|
|
|
119 |
mangano |
1.5 |
|
120 |
|
|
;;
|
121 |
|
|
|
122 |
|
|
submit) ### start doing something serious using the settings stored in the hedsTaskFolder
|
123 |
|
|
hedsTaskFolder=$2
|
124 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
125 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
126 |
|
|
echo " heds.sh submit <hedsTaskFolder>"
|
127 |
|
|
exit 1
|
128 |
|
|
fi
|
129 |
|
|
|
130 |
|
|
echo -e "+++ Your heds task is going to use the following settings: \n"
|
131 |
|
|
|
132 |
|
|
source ./$hedsTaskFolder/configuration
|
133 |
|
|
env |grep -i heds
|
134 |
|
|
echo -e "\n"
|
135 |
|
|
|
136 |
|
|
echo -e "+++ Are you Ok with such settings? [y/n] "
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
read -p "$prompt" answer
|
140 |
|
|
case "$answer" in
|
141 |
|
|
[yY1] )
|
142 |
mangano |
1.10 |
echo -e "\n"
|
143 |
|
|
;;
|
144 |
|
|
[nN0] )
|
145 |
|
|
exit
|
146 |
|
|
;;
|
147 |
|
|
*)
|
148 |
|
|
echo -e "Incorrect answer. Run \"heds submit\" again and type [y/n]"
|
149 |
|
|
exit
|
150 |
|
|
;;
|
151 |
|
|
esac
|
152 |
|
|
|
153 |
|
|
echo -e "+++ Have you also checked HEDS_STORAGEPATH and HEDS_STORAGEPORT values ? "
|
154 |
|
|
echo -e "+++ This values have still to be set by hand. Please consult the settings of your T2's SE"
|
155 |
|
|
echo -e " as described here:"
|
156 |
|
|
echo " https://twiki.cern.ch/twiki/bin/view/CMS/AnalysisOpsPriorityuser#Tier_2_Sites_Responsibility"
|
157 |
|
|
echo "Please insert the final confirmation [y/n]"
|
158 |
|
|
read -p "$prompt" answer
|
159 |
|
|
case "$answer" in
|
160 |
|
|
[yY1] )
|
161 |
mangano |
1.5 |
echo "you said you are happy"
|
162 |
|
|
;;
|
163 |
|
|
[nN0] )
|
164 |
|
|
exit
|
165 |
|
|
;;
|
166 |
|
|
*)
|
167 |
|
|
echo -e "Incorrect answer. Run \"heds submit\" again and type [y/n]"
|
168 |
|
|
exit
|
169 |
|
|
;;
|
170 |
|
|
esac
|
171 |
|
|
|
172 |
mangano |
1.10 |
|
173 |
|
|
|
174 |
mangano |
1.5 |
initialFolder=`pwd`
|
175 |
|
|
cd $HEDS_LOCALSTORE
|
176 |
|
|
heds.sh 0 #create setup
|
177 |
|
|
heds.sh 1 #query runregistry, create crab cfg
|
178 |
|
|
heds.sh 2 #submit crab jobs
|
179 |
mangano |
1.7 |
|
180 |
mangano |
1.5 |
cd $initialFolder
|
181 |
|
|
;;
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
status) ### check status
|
185 |
|
|
hedsTaskFolder=$2
|
186 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
187 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
188 |
|
|
echo " heds.sh status <hedsTaskFolder>"
|
189 |
|
|
exit 1
|
190 |
|
|
fi
|
191 |
|
|
source ./$hedsTaskFolder/configuration
|
192 |
mangano |
1.6 |
|
193 |
|
|
initialFolder=`pwd`
|
194 |
|
|
cd $HEDS_LOCALSTORE
|
195 |
|
|
status=`tail -n1 status`
|
196 |
|
|
|
197 |
|
|
case $status in
|
198 |
|
|
create)
|
199 |
|
|
echo "+++ Last step successfully execute was: "
|
200 |
|
|
echo -e " heds create <taskFolder>\n"
|
201 |
|
|
echo "+++ Next step to run is: "
|
202 |
|
|
echo -e " heds submit <taskFolder>"
|
203 |
|
|
;;
|
204 |
|
|
submit)
|
205 |
|
|
echo "+++ Last step execute was: "
|
206 |
|
|
echo -e " heds submit <taskFolder>\n"
|
207 |
|
|
|
208 |
|
|
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
209 |
mangano |
1.9 |
crab -status -c $HEDS_LOCALSTORE/$dailySkim >& crab.status.log
|
210 |
|
|
jobsOK=`grep "Wrapper Exit Code : 0" crab.status.log| awk '{print $2}'`
|
211 |
|
|
jobsDone=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Done"| awk '{print $2}'`
|
212 |
|
|
jobsRunning=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Running"| awk '{print $2}'`
|
213 |
|
|
jobsAborted=`grep ">>>>>>>>>" crab.status.log |grep "Jobs Aborted"| awk '{print $2}'`
|
214 |
|
|
jobsTotal=`grep "crab:" crab.status.log |grep "Total Jobs"| awk '{print $2}'`
|
215 |
|
|
|
216 |
|
|
if [ -n "$jobsTotal" ]; then echo "# jobs Total: " $jobsTotal; else jobsTotal=0; fi
|
217 |
|
|
if [ -n "$jobsDone" ]; then echo "# jobs Done: " $jobsDone; else jobsDone=0; fi
|
218 |
|
|
if [ -n "$jobsRunning" ]; then echo "# jobs Running: " $jobsRunning; else jobsRunning=0; fi
|
219 |
|
|
if [ -n "$jobsAborted" ]; then echo "# jobs Aborted: " $jobsAborted; else jobsAborted=0; fi
|
220 |
|
|
if [ -n "$jobsOK" ]; then echo "# jobs Retrieved OK: " $jobsOK; else jobsOK=0; fi
|
221 |
|
|
|
222 |
|
|
if(($jobsDone)); then
|
223 |
|
|
echo "There are jobs in DONE status. Retrieving them"
|
224 |
|
|
crab -get -c $HEDS_LOCALSTORE/$dailySkim > /dev/null
|
225 |
|
|
|
226 |
|
|
echo "+++ Run the following command again: "
|
227 |
|
|
echo " heds status <taskFolder>"
|
228 |
mangano |
1.10 |
exit 0
|
229 |
mangano |
1.6 |
fi
|
230 |
mangano |
1.9 |
|
231 |
|
|
if [ "$jobsTotal" == "$jobsOK" ];
|
232 |
|
|
then
|
233 |
|
|
echo "+++ all the crab jobs has been correctly retrieved."
|
234 |
mangano |
1.6 |
echo "+++ You can now run:"
|
235 |
|
|
echo " heds get <taskFolder>"
|
236 |
|
|
cat >> $HEDS_LOCALSTORE/status <<EOF
|
237 |
|
|
crab_done
|
238 |
|
|
EOF
|
239 |
|
|
else
|
240 |
mangano |
1.9 |
if(($jobsAborted)); then
|
241 |
|
|
echo "+++ Some crab jobs aborted. You need to resubmit them directly using:"
|
242 |
|
|
echo " crab -resubmit <job-interval> -c $HEDS_LOCALSTORE/$dailySkim"
|
243 |
|
|
|
244 |
|
|
else
|
245 |
|
|
echo "+++ There are still crab jobs running. Try again later."
|
246 |
|
|
echo "+++ You can directly handle your crab jobs with:"
|
247 |
|
|
echo " crab -<command> -c $HEDS_LOCALSTORE/$dailySkim"
|
248 |
|
|
fi
|
249 |
mangano |
1.6 |
fi
|
250 |
|
|
;;
|
251 |
|
|
|
252 |
mangano |
1.7 |
submit_empty)
|
253 |
|
|
echo "+++ Last step execute was: "
|
254 |
|
|
echo -e " heds submit <taskFolder>\n"
|
255 |
|
|
|
256 |
|
|
echo "+++ No good runs were found, so no crab jobs were submitted."
|
257 |
|
|
echo " You can directly go to the step:"
|
258 |
|
|
echo " heds tables <taskFolder>"
|
259 |
|
|
;;
|
260 |
|
|
|
261 |
mangano |
1.6 |
crab_done)
|
262 |
|
|
echo "+++ All you crab jobs are DONE."
|
263 |
|
|
echo " You can now run:"
|
264 |
|
|
echo " heds get <taskFolder>"
|
265 |
|
|
;;
|
266 |
|
|
|
267 |
|
|
get)
|
268 |
|
|
echo "+++ Last step successfully execute was: "
|
269 |
|
|
echo -e " heds get <taskFolder>\n"
|
270 |
|
|
echo "+++ Next step to run is: "
|
271 |
mangano |
1.9 |
echo -e " heds merge <taskFolder>"
|
272 |
|
|
;;
|
273 |
|
|
|
274 |
|
|
merge)
|
275 |
|
|
echo "+++ Last step successfully execute was: "
|
276 |
|
|
echo -e " heds merge <taskFolder>\n"
|
277 |
|
|
echo "+++ Next step to run is: "
|
278 |
mangano |
1.6 |
echo -e " heds tables <taskFolder>"
|
279 |
|
|
;;
|
280 |
|
|
|
281 |
|
|
tables)
|
282 |
|
|
echo "+++ Last step successfully execute was: "
|
283 |
|
|
echo -e " heds tables <taskFolder>\n"
|
284 |
|
|
echo "+++ Next step to run is: "
|
285 |
|
|
echo -e " heds preview <taskFolder>"
|
286 |
|
|
;;
|
287 |
mangano |
1.9 |
|
288 |
|
|
preview)
|
289 |
|
|
echo "+++ Last step successfully execute was: "
|
290 |
|
|
echo -e " heds preview <taskFolder>\n"
|
291 |
|
|
echo "+++ Next step to run is: "
|
292 |
|
|
echo -e " heds add2Web <taskFolder>"
|
293 |
|
|
;;
|
294 |
|
|
|
295 |
|
|
add2Web)
|
296 |
|
|
echo "+++ Last step successfully execute was: "
|
297 |
|
|
echo -e " heds add2Web <taskFolder>\n"
|
298 |
|
|
echo "+++ You are done "
|
299 |
|
|
;;
|
300 |
mangano |
1.6 |
|
301 |
|
|
*)
|
302 |
|
|
echo "+++ ERROR: undefined heds status."
|
303 |
|
|
echo "+++ Restart from scratch running:"
|
304 |
|
|
echo " heds up"
|
305 |
|
|
echo " heds create heds.cfg"
|
306 |
|
|
;;
|
307 |
|
|
esac
|
308 |
|
|
cd $initialFolder
|
309 |
mangano |
1.5 |
;;
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
get) ### get output from crab
|
313 |
|
|
hedsTaskFolder=$2
|
314 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
315 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
316 |
|
|
echo " heds.sh status <hedsTaskFolder>"
|
317 |
|
|
exit 1
|
318 |
|
|
fi
|
319 |
|
|
|
320 |
mangano |
1.6 |
source ./$hedsTaskFolder/configuration
|
321 |
mangano |
1.5 |
cd $HEDS_LOCALSTORE
|
322 |
mangano |
1.6 |
status=`tail -n1 status`
|
323 |
|
|
if [ ! "$status" == "crab_done" ];then
|
324 |
|
|
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
325 |
|
|
echo " heds status <taskFolder>"
|
326 |
|
|
exit 1
|
327 |
|
|
fi
|
328 |
mangano |
1.9 |
|
329 |
mangano |
1.10 |
echo "Crab job's output is going to be published in DBS. This step is going to take a long while (up to 1hr)."
|
330 |
|
|
echo "Do you have time for that? [y/n]"
|
331 |
|
|
|
332 |
|
|
read -p "$prompt" answer
|
333 |
|
|
case "$answer" in
|
334 |
|
|
[yY1] )
|
335 |
|
|
echo "Ok. Proceding with crab -publish step"
|
336 |
|
|
;;
|
337 |
|
|
[nN0] )
|
338 |
|
|
echo "Exiting heds.."
|
339 |
|
|
exit 0
|
340 |
|
|
;;
|
341 |
|
|
*)
|
342 |
|
|
echo -e "Incorrect answer. Run your heds get command again and then answer [y/n]"
|
343 |
|
|
exit
|
344 |
|
|
;;
|
345 |
|
|
esac
|
346 |
|
|
|
347 |
|
|
|
348 |
mangano |
1.9 |
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
349 |
|
|
crab -publish -c $HEDS_LOCALSTORE/$dailySkim
|
350 |
mangano |
1.10 |
if((! $?)); then
|
351 |
|
|
heds.sh 4c #copy file from the SE
|
352 |
|
|
else
|
353 |
|
|
exit 1
|
354 |
|
|
fi
|
355 |
mangano |
1.8 |
#heds.sh 4c_temp #copy file from the SE manually using scp
|
356 |
mangano |
1.9 |
|
357 |
|
|
if ((! $?));
|
358 |
|
|
then
|
359 |
|
|
cat >> status <<EOF
|
360 |
mangano |
1.6 |
get
|
361 |
|
|
EOF
|
362 |
mangano |
1.9 |
fi
|
363 |
mangano |
1.5 |
cd $initialFolder
|
364 |
|
|
;;
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
tables) ### produce html tables
|
368 |
|
|
hedsTaskFolder=$2
|
369 |
mangano |
1.10 |
rawLocation=$3
|
370 |
mangano |
1.5 |
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
371 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
372 |
|
|
echo " heds.sh tables <hedsTaskFolder>"
|
373 |
|
|
exit 1
|
374 |
|
|
fi
|
375 |
mangano |
1.6 |
source ./$hedsTaskFolder/configuration
|
376 |
mangano |
1.5 |
cd $HEDS_LOCALSTORE
|
377 |
mangano |
1.6 |
status=`tail -n1 status`
|
378 |
mangano |
1.9 |
echo "status: " $status
|
379 |
|
|
if [[ !("$status" == "merge") && !("$status" == "submit_empty") ]];then
|
380 |
|
|
echo "+++ ERROR: you may have to retrieve crab jobs first. Try:"
|
381 |
mangano |
1.6 |
echo " heds status <taskFolder>"
|
382 |
|
|
exit 1
|
383 |
|
|
fi
|
384 |
|
|
|
385 |
mangano |
1.7 |
|
386 |
|
|
if [ -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
387 |
|
|
echo "Warning: " logs.SkimV$HEDS_SKIMVERSION " already exist in final WWW_AREA."
|
388 |
|
|
echo "Copying base html tables from there."
|
389 |
|
|
|
390 |
|
|
##TO BE FIXED. Check that files exist before copy
|
391 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
392 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
393 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
394 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
395 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
396 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
397 |
|
|
fi
|
398 |
|
|
|
399 |
mangano |
1.10 |
if [ -z "$rawLocation" ];then
|
400 |
|
|
rawLocation=below
|
401 |
|
|
fi
|
402 |
mangano |
1.7 |
|
403 |
mangano |
1.9 |
if [ "$status" == "merge" ]; then
|
404 |
mangano |
1.7 |
heds.sh 4a #copy all logs file
|
405 |
mangano |
1.9 |
heds.sh store . #copy zipped edm file and crab logs
|
406 |
mangano |
1.7 |
heds.sh 4b #making skim report
|
407 |
|
|
heds.sh 4f #list of skimmed events
|
408 |
|
|
heds.sh 4g #copy logs about run selection
|
409 |
|
|
heds.sh 4h #preparing event dumps
|
410 |
mangano |
1.10 |
heds.sh 4i $rawLocation #preparing final html tables
|
411 |
mangano |
1.7 |
fi
|
412 |
|
|
|
413 |
|
|
if [ "$status" == "submit_empty" ]; then
|
414 |
|
|
heds.sh 4g #copy logs about run selection
|
415 |
mangano |
1.10 |
heds.sh 4i2 $rawLocation #preparing final html tables
|
416 |
mangano |
1.7 |
fi
|
417 |
|
|
|
418 |
mangano |
1.6 |
cat >> status <<EOF
|
419 |
|
|
tables
|
420 |
|
|
EOF
|
421 |
mangano |
1.5 |
cd $initialFolder
|
422 |
|
|
;;
|
423 |
|
|
|
424 |
mangano |
1.7 |
merge) ### merge files before copying them to castor area
|
425 |
|
|
hedsTaskFolder=$2
|
426 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
427 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
428 |
|
|
echo " heds.sh tables <hedsTaskFolder>"
|
429 |
|
|
exit 1
|
430 |
|
|
fi
|
431 |
|
|
source ./$hedsTaskFolder/configuration
|
432 |
|
|
cd $HEDS_LOCALSTORE
|
433 |
|
|
status=`grep "crab_done" status`
|
434 |
|
|
if [ -z "$status" ];then
|
435 |
|
|
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
436 |
|
|
echo " heds status <taskFolder>"
|
437 |
|
|
exit 1
|
438 |
|
|
fi
|
439 |
|
|
|
440 |
|
|
heds.sh 4d #merging edm files
|
441 |
|
|
|
442 |
mangano |
1.9 |
cat >> status <<EOF
|
443 |
|
|
merge
|
444 |
|
|
EOF
|
445 |
mangano |
1.7 |
cd $initialFolder
|
446 |
|
|
;;
|
447 |
|
|
|
448 |
|
|
|
449 |
mangano |
1.5 |
|
450 |
|
|
store) ### produce html tables
|
451 |
|
|
hedsTaskFolder=$2
|
452 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
453 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
454 |
|
|
echo " heds.sh tables <hedsTaskFolder>"
|
455 |
|
|
exit 1
|
456 |
|
|
fi
|
457 |
mangano |
1.6 |
source ./$hedsTaskFolder/configuration
|
458 |
mangano |
1.5 |
cd $HEDS_LOCALSTORE
|
459 |
mangano |
1.6 |
status=`grep "crab_done" status`
|
460 |
|
|
if [ -z "$status" ];then
|
461 |
|
|
echo "+++ ERROR: crab jobs are not done yet. Try:"
|
462 |
|
|
echo " heds status <taskFolder>"
|
463 |
|
|
exit 1
|
464 |
|
|
fi
|
465 |
|
|
|
466 |
|
|
### create CASTOR folder
|
467 |
|
|
nsls -d $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION >& tmp
|
468 |
|
|
check=`cat tmp |grep "No such" |wc -w`
|
469 |
|
|
rm tmp
|
470 |
|
|
if [ $check == 0 ]
|
471 |
|
|
then echo "directory " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION "already exists"
|
472 |
|
|
else
|
473 |
|
|
echo "making " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION " directory"
|
474 |
|
|
rfmkdir -p $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
475 |
|
|
fi
|
476 |
|
|
|
477 |
mangano |
1.5 |
heds.sh 6 #copy merged log files in CASTOR
|
478 |
|
|
heds.sh 4e #copy merged edm files in CASTOR
|
479 |
mangano |
1.9 |
# cat >> status <<EOF
|
480 |
|
|
#store
|
481 |
|
|
#EOF
|
482 |
mangano |
1.5 |
cd $initialFolder
|
483 |
|
|
;;
|
484 |
|
|
|
485 |
|
|
preview) ### produce html tables
|
486 |
|
|
hedsTaskFolder=$2
|
487 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
488 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
489 |
|
|
echo " heds.sh tables <hedsTaskFolder>"
|
490 |
|
|
exit 1
|
491 |
|
|
fi
|
492 |
mangano |
1.7 |
source ./$hedsTaskFolder/configuration
|
493 |
|
|
|
494 |
|
|
initialFolder=`pwd`
|
495 |
mangano |
1.5 |
cd $HEDS_LOCALSTORE
|
496 |
|
|
heds.sh 4j #
|
497 |
mangano |
1.9 |
php $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php > FirstPage.html
|
498 |
|
|
mv FirstPage.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
499 |
|
|
cp $HEDS_WWWAREA/fromGiovanni.css $HEDS_WWWAREA_TMP
|
500 |
|
|
cat >> status <<EOF
|
501 |
|
|
preview
|
502 |
|
|
EOF
|
503 |
mangano |
1.5 |
cd $initialFolder
|
504 |
|
|
;;
|
505 |
mangano |
1.7 |
|
506 |
|
|
add2Web) ### produce html tables
|
507 |
|
|
hedsTaskFolder=$2
|
508 |
|
|
if [ -z "$hedsTaskFolder" -o ! -d ./$hedsTaskFolder ]; then
|
509 |
|
|
echo -e "+++ ERROR: you have to specify a \"hedsTaskFolder\" as in: "
|
510 |
|
|
echo " heds.sh tables <hedsTaskFolder>"
|
511 |
|
|
exit 1
|
512 |
|
|
fi
|
513 |
|
|
source ./$hedsTaskFolder/configuration
|
514 |
|
|
|
515 |
|
|
initialFolder=`pwd`
|
516 |
|
|
cd $HEDS_LOCALSTORE
|
517 |
|
|
heds.sh final #
|
518 |
mangano |
1.9 |
cat >> status <<EOF
|
519 |
|
|
add2Web
|
520 |
|
|
EOF
|
521 |
mangano |
1.7 |
cd $initialFolder
|
522 |
|
|
;;
|
523 |
mangano |
1.5 |
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
########## internal "functions" which are not meant to be used by users ###############
|
528 |
mangano |
1.1 |
0)
|
529 |
mangano |
1.5 |
echo "=== Setting up directories and one-time things ==="
|
530 |
mangano |
1.1 |
echo ""
|
531 |
|
|
|
532 |
mangano |
1.3 |
### create WWW folders
|
533 |
mangano |
1.2 |
if [ -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION ]
|
534 |
mangano |
1.3 |
then echo "directory " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION \
|
535 |
|
|
" already exists. Then skipping \"mkdir\" "
|
536 |
|
|
|
537 |
|
|
if [ ! -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
538 |
|
|
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
539 |
|
|
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
540 |
|
|
fi
|
541 |
|
|
|
542 |
mangano |
1.1 |
else
|
543 |
mangano |
1.2 |
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION " directory"
|
544 |
mangano |
1.3 |
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
545 |
|
|
|
546 |
|
|
if [ -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
547 |
|
|
echo "Warning: " logs.SkimV$HEDS_SKIMVERSION " already exist in final WWW_AREA."
|
548 |
|
|
echo "Copying base html tables from there."
|
549 |
mangano |
1.4 |
|
550 |
|
|
##TO BE FIXED. Check that files exist before copy
|
551 |
mangano |
1.3 |
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
552 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
553 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
554 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
555 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
556 |
|
|
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
557 |
|
|
fi
|
558 |
|
|
|
559 |
|
|
if [ ! -d $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
560 |
|
|
echo "making " $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
561 |
|
|
mkdir -p $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
562 |
|
|
fi
|
563 |
mangano |
1.1 |
fi
|
564 |
|
|
;;
|
565 |
|
|
|
566 |
|
|
1)
|
567 |
|
|
echo "=== you selected option 1. Querying RunRegistry, select good runs and submit crab jobs ==="
|
568 |
|
|
echo ""
|
569 |
|
|
|
570 |
|
|
dateForDbsSearch=`echo $HEDS_LABEL|awk -F\. '{print $3"-"$2"-"$1}'`
|
571 |
mangano |
1.10 |
#echo "dateForDbsSearch: " $dateForDbsSearch
|
572 |
mangano |
1.1 |
dbs search --query="find run where dataset=$HEDS_INPUTDATASET and run.createdate=$dateForDbsSearch" \
|
573 |
|
|
> tmpRunList.txt
|
574 |
|
|
lastRun=`cat tmpRunList.txt |grep [0-9][0-9][0-9][0-9][0-9][0-9] |head -n1`
|
575 |
mangano |
1.10 |
firstRun=`cat tmpRunList.txt|grep [0-9][0-9][0-9][0-9][0-9][0-9] |tail -n1`
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
if((!${#lastRun}));then
|
579 |
|
|
rm tmpRunList.txt
|
580 |
|
|
echo "no runs" > $HEDS_LABEL.runinterval
|
581 |
|
|
|
582 |
|
|
echo "No input runs for"
|
583 |
|
|
echo "HEDS_LABEL=" $HEDS_LABEL
|
584 |
|
|
echo "and"
|
585 |
|
|
echo "HEDS_INPUTDATASET=" $HEDS_INPUTDATASET
|
586 |
|
|
echo ""
|
587 |
|
|
|
588 |
|
|
echo "No CRAB cfg will be created."
|
589 |
|
|
cat >> status <<EOF
|
590 |
|
|
runselection_empty
|
591 |
|
|
EOF
|
592 |
|
|
exit 0
|
593 |
|
|
fi
|
594 |
|
|
|
595 |
mangano |
1.1 |
rm tmpRunList.txt
|
596 |
|
|
echo "first,last runs: " $firstRun $lastRun
|
597 |
|
|
|
598 |
|
|
|
599 |
|
|
runselection="runselection="
|
600 |
|
|
cat $HEDSPATH/scripts/runreg.cfg | sed s/SET_RUNMIN/$firstRun/ | \
|
601 |
|
|
sed s/SET_RUNMAX/$lastRun/ > runreg.cfg
|
602 |
|
|
python $HEDSPATH/scripts/runregparse.py > tmp.log
|
603 |
|
|
rm runreg.cfg
|
604 |
|
|
echo "here we have the good run list"
|
605 |
|
|
|
606 |
|
|
IFS=$'\n'
|
607 |
|
|
found=0
|
608 |
|
|
lastGoodRun=0
|
609 |
|
|
for line in $(cat tmp.log);
|
610 |
|
|
do
|
611 |
|
|
if [ $found == 0 ]
|
612 |
|
|
then
|
613 |
|
|
found=`echo $line |grep lumisToProcess|wc |awk '{print $1}'`
|
614 |
|
|
continue;
|
615 |
|
|
fi
|
616 |
|
|
if [ $line == ")" ]
|
617 |
|
|
then
|
618 |
|
|
break;
|
619 |
|
|
fi
|
620 |
|
|
thisRun=`echo $line | sed s/\'//g | sed s/,//g |awk -F: '{print $1}'`
|
621 |
|
|
if [ $thisRun != $lastGoodRun ]
|
622 |
|
|
then
|
623 |
|
|
runselection=$runselection$thisRun\,
|
624 |
|
|
fi
|
625 |
|
|
lastGoodRun=$thisRun
|
626 |
|
|
done
|
627 |
|
|
#echo "========= THE FOLLOWING LINE TO YOUR crab.cfg FILE ========="
|
628 |
|
|
echo $runselection
|
629 |
|
|
#echo "================================================================"
|
630 |
|
|
echo $runselection > $HEDS_LABEL.runselection
|
631 |
|
|
echo $firstRun-$lastRun > $HEDS_LABEL.runinterval
|
632 |
|
|
rm tmp.log
|
633 |
|
|
|
634 |
|
|
check=`echo $runselection | sed s/runselection=// |wc -w`
|
635 |
|
|
|
636 |
|
|
if [ $check == 0 ]
|
637 |
|
|
then
|
638 |
|
|
echo "No good runs have been selected. No CRAB cfg will be created."
|
639 |
mangano |
1.7 |
cat >> status <<EOF
|
640 |
|
|
runselection_empty
|
641 |
|
|
EOF
|
642 |
mangano |
1.1 |
else
|
643 |
|
|
echo "Some good runs have been selected. CRAB cfg will be created."
|
644 |
mangano |
1.7 |
cat >> status <<EOF
|
645 |
|
|
runselection_done
|
646 |
|
|
EOF
|
647 |
mangano |
1.1 |
cat $HEDSPATH/scripts/crab.template.cfg |sed "s#SET_DATASET#$HEDS_INPUTDATASET#" | \
|
648 |
mangano |
1.3 |
# sed "s#SET_REMOTEDIR#$HEDS_USERID/HEDS/#" | \
|
649 |
|
|
sed "s#SET_REMOTEDIR#$HEDS_USERID/#" | \
|
650 |
mangano |
1.1 |
sed "s#SET_T2#$HEDS_T2SITE#" | \
|
651 |
|
|
sed "s/SET_RUNSELECTION/$runselection/" > tmp.cfg
|
652 |
|
|
pset=$HEDSPATH/python/earlyDataInterestingEvents_cfg.py
|
653 |
|
|
echo "pset: " $pset
|
654 |
|
|
cat tmp.cfg |sed s#SET_PSET#$pset# | sed "s#SET_TASK_NAME#$dailySkim#" > tmp2.cfg; rm tmp.cfg
|
655 |
|
|
mv tmp2.cfg $HEDS_LABEL.crab.cfg
|
656 |
|
|
fi
|
657 |
|
|
;;
|
658 |
|
|
2)
|
659 |
mangano |
1.7 |
status=`tail -n1 status`
|
660 |
|
|
if [ ! "$status" == "runselection_done" ];then
|
661 |
|
|
#no crab jobs to be submitted
|
662 |
|
|
cat >> status <<EOF
|
663 |
|
|
submit_empty
|
664 |
|
|
EOF
|
665 |
|
|
exit 0
|
666 |
|
|
fi
|
667 |
|
|
|
668 |
mangano |
1.1 |
echo "creating and submitting CRAB jobs for " $dailySkim
|
669 |
|
|
if [ -e $HEDS_LABEL.crab.cfg ]
|
670 |
|
|
then
|
671 |
|
|
crab -create -submit -cfg $HEDS_LABEL.crab.cfg
|
672 |
|
|
if ((! $?)); then rm $HEDS_LABEL.crab.cfg; fi
|
673 |
mangano |
1.7 |
cat >> status <<EOF
|
674 |
|
|
submit
|
675 |
|
|
EOF
|
676 |
mangano |
1.1 |
else
|
677 |
|
|
echo "ERROR: " $HEDS_LABEL.crab.cfg " doesn't exist"
|
678 |
|
|
fi
|
679 |
|
|
;;
|
680 |
|
|
3)
|
681 |
|
|
echo "getting output and publishing crab jobs"
|
682 |
mangano |
1.6 |
crab -status -c $dailySkim &> /dev/null
|
683 |
mangano |
1.1 |
crab -get -c $dailySkim
|
684 |
mangano |
1.6 |
crab -status -c $dailySkim &> /dev/null
|
685 |
mangano |
1.1 |
crab -publish -c $dailySkim
|
686 |
|
|
;;
|
687 |
|
|
|
688 |
|
|
|
689 |
|
|
4)
|
690 |
|
|
echo "option 4 "
|
691 |
|
|
if [ -d $dailySkim ] #the crab job was run on at least 1 run
|
692 |
|
|
then
|
693 |
|
|
heds 4a
|
694 |
|
|
heds 4b
|
695 |
|
|
heds 4c
|
696 |
|
|
heds 4d
|
697 |
|
|
heds 4e
|
698 |
|
|
heds 4f
|
699 |
|
|
heds 4g
|
700 |
|
|
heds 4h
|
701 |
|
|
heds 4i
|
702 |
|
|
else
|
703 |
|
|
echo "copying only the log files about runs and selected-runs"
|
704 |
|
|
heds 4g
|
705 |
mangano |
1.7 |
heds 4i2
|
706 |
mangano |
1.1 |
fi
|
707 |
|
|
;;
|
708 |
|
|
|
709 |
|
|
4a)
|
710 |
mangano |
1.3 |
#### echo "...copying log files"
|
711 |
mangano |
1.1 |
if [ ! -d $HEDS_LOCALSTORE/$dailySkim/logs ]; then
|
712 |
|
|
mkdir -p $HEDS_LOCALSTORE/$dailySkim/logs
|
713 |
|
|
fi
|
714 |
|
|
cp $dailySkim/res/*.std* $HEDS_LOCALSTORE/$dailySkim/logs
|
715 |
|
|
if (($?)); then
|
716 |
|
|
echo "ERROR: failed to copy log files in " $HEDS_LOCALSTORE/$dailySkim/logs;
|
717 |
|
|
else
|
718 |
|
|
echo "copied all logs file in " $HEDS_LOCALSTORE/$dailySkim/logs
|
719 |
|
|
fi
|
720 |
|
|
|
721 |
mangano |
1.5 |
###
|
722 |
mangano |
1.1 |
tarName=$HEDS_LABEL.log.tgz
|
723 |
|
|
cd $HEDS_LOCALSTORE/$dailySkim/logs/
|
724 |
|
|
if (($?));then
|
725 |
|
|
echo "ERROR: failed to go to " $HEDS_LOCALSTORE/$dailySkim/logs/
|
726 |
|
|
else
|
727 |
mangano |
1.3 |
echo "compriming log files... "
|
728 |
|
|
tar czvf $tarName *.std* >& /dev/null
|
729 |
|
|
echo -e "done \n"
|
730 |
mangano |
1.1 |
cd -
|
731 |
|
|
fi
|
732 |
|
|
;;
|
733 |
|
|
|
734 |
|
|
4b)
|
735 |
|
|
###
|
736 |
mangano |
1.3 |
echo -e "creating skimReport..."
|
737 |
mangano |
1.1 |
logName=$HEDS_LABEL.log
|
738 |
|
|
$HEDSPATH/scripts/skimreport $HEDS_LOCALSTORE/$dailySkim/logs/*.stdout > $logName
|
739 |
mangano |
1.7 |
cp $logName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/
|
740 |
mangano |
1.3 |
echo -e "done \n"
|
741 |
mangano |
1.1 |
;;
|
742 |
|
|
|
743 |
|
|
4c)
|
744 |
|
|
###
|
745 |
|
|
echo "...coping files from the T2's SE"
|
746 |
|
|
echo "dataset to retreive: " $dailySkim
|
747 |
|
|
dbs search --url=https://cmsdbsprod.cern.ch:8443/cms_dbs_ph_analysis_02_writer/servlet/DBSServlet \
|
748 |
|
|
--query="find file,site where dataset=*$dailySkim*" |grep .root >listFiles
|
749 |
|
|
|
750 |
|
|
IFS=$'\n'
|
751 |
|
|
for j in $(cat listFiles)
|
752 |
|
|
do
|
753 |
|
|
echo "going to copy file: $j"
|
754 |
|
|
fileName=`echo $j |awk '{print$1}'| awk -F$dailySkim/ '{print $2}' | awk -F/ '{print $2}'`
|
755 |
|
|
|
756 |
|
|
storage_elem=`echo $j |awk '{print $2}'`
|
757 |
|
|
remote_path=`echo $j|awk '{print $1}'`
|
758 |
|
|
lcg-cp -b -D srmv2 srm://$storage_elem:$HEDS_STORAGEPORT$HEDS_STORAGEPATH$remote_path file://$HEDS_LOCALSTORE/$dailySkim/$fileName
|
759 |
|
|
done
|
760 |
|
|
rm listFiles
|
761 |
mangano |
1.6 |
#nFiles=`ls $HEDS_LOCALSTORE/$dailySkim/*.root|wc -l`
|
762 |
|
|
#nJobs=`ls $HEDS_LOCALSTORE/$dailySkim/logs/CMSSW_*.stdout |wc -l`
|
763 |
mangano |
1.7 |
;;
|
764 |
mangano |
1.1 |
|
765 |
mangano |
1.7 |
4c_temp)
|
766 |
|
|
echo "copying manually files from SE.. "
|
767 |
|
|
scp bmangano@uaf-6.t2.ucsd.edu:/hadoop/cms/store/user/mangano/MinimumBias/$dailySkim/*/*.root $HEDS_LOCALSTORE/$dailySkim/
|
768 |
mangano |
1.1 |
;;
|
769 |
|
|
|
770 |
mangano |
1.7 |
|
771 |
mangano |
1.1 |
4d)
|
772 |
|
|
###
|
773 |
mangano |
1.3 |
echo -e "Merging files edm files..."
|
774 |
mangano |
1.1 |
cp $HEDSPATH/scripts/prepareMerging.sh $HEDS_LOCALSTORE/$dailySkim
|
775 |
|
|
cp $HEDSPATH/scripts/merge.py $HEDS_LOCALSTORE/$dailySkim
|
776 |
|
|
cd $HEDS_LOCALSTORE/$dailySkim
|
777 |
|
|
|
778 |
mangano |
1.6 |
mergedName=$HEDS_LABEL.root
|
779 |
|
|
mergedName=merged_$mergedName
|
780 |
|
|
|
781 |
mangano |
1.1 |
./prepareMerging.sh
|
782 |
|
|
numberFilesToMerge=`ls *.root|wc -l`
|
783 |
|
|
echo "numberFilesToMerge: " $numberFilesToMerge
|
784 |
|
|
cmsRun merge.py >& merging.log
|
785 |
mangano |
1.6 |
mv merged.root $HEDS_LOCALSTORE/$mergedName
|
786 |
mangano |
1.3 |
echo -e "done \n"
|
787 |
mangano |
1.1 |
cd -
|
788 |
|
|
;;
|
789 |
|
|
|
790 |
|
|
4e)
|
791 |
|
|
###
|
792 |
mangano |
1.3 |
echo -e "Storing merged edm file in CASTOR..."
|
793 |
mangano |
1.1 |
mergedName=$HEDS_LABEL.root
|
794 |
|
|
mergedName=merged_$mergedName
|
795 |
|
|
echo "mergedName: " $mergedName
|
796 |
|
|
cd $HEDS_LOCALSTORE/$dailySkim
|
797 |
|
|
if ((! $?)); then
|
798 |
|
|
echo "going to copy the merged file into: " $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
799 |
mangano |
1.6 |
rfcp $HEDS_LOCALSTORE/$mergedName $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/
|
800 |
mangano |
1.1 |
cd -
|
801 |
|
|
fi
|
802 |
mangano |
1.3 |
echo -e "done \n"
|
803 |
mangano |
1.1 |
;;
|
804 |
|
|
|
805 |
|
|
4f)
|
806 |
|
|
###
|
807 |
mangano |
1.3 |
echo "Preparing detailed list of skimmed events..."
|
808 |
mangano |
1.1 |
cp $HEDSPATH/scripts/listSkimmedEvent.C $HEDS_LOCALSTORE
|
809 |
|
|
cd $HEDS_LOCALSTORE
|
810 |
mangano |
1.7 |
forRootExecution="listSkimmedEvent.C++(\"${HEDS_LABEL}\")"
|
811 |
|
|
|
812 |
|
|
root.exe -b -q $forRootExecution >& /dev/null
|
813 |
mangano |
1.2 |
listSkimmedEventsPath=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
814 |
mangano |
1.1 |
if [ ! -d $listSkimmedEventsPath ]
|
815 |
|
|
then
|
816 |
|
|
mkdir $listSkimmedEventsPath
|
817 |
|
|
fi
|
818 |
mangano |
1.7 |
listDetailedLogs=`ls ${HEDS_LABEL}_Skim_*`
|
819 |
mangano |
1.1 |
for j in $listDetailedLogs
|
820 |
|
|
do
|
821 |
|
|
echo "preparing log " $j
|
822 |
|
|
# sort entries by date
|
823 |
|
|
cat $j |sort -k7 > tmp
|
824 |
|
|
mv tmp $j
|
825 |
|
|
mv $j $listSkimmedEventsPath
|
826 |
|
|
done
|
827 |
mangano |
1.3 |
echo -e "done \n"
|
828 |
mangano |
1.1 |
cd -
|
829 |
|
|
;;
|
830 |
|
|
|
831 |
|
|
4g)
|
832 |
|
|
###
|
833 |
mangano |
1.3 |
echo "Copying logs about run selection..."
|
834 |
mangano |
1.7 |
cp $HEDS_LABEL.runselection $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
835 |
|
|
cp $HEDS_LABEL.runinterval $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
836 |
mangano |
1.3 |
echo -e "done \n"
|
837 |
mangano |
1.1 |
;;
|
838 |
|
|
|
839 |
|
|
4h)
|
840 |
|
|
###
|
841 |
mangano |
1.3 |
echo "Preparing event dumps..."
|
842 |
mangano |
1.1 |
input=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
843 |
|
|
echo "input: " $input
|
844 |
|
|
sed s#INPUT#$input# $HEDSPATH/scripts/dumpEvent.py > dumpEvent.py
|
845 |
|
|
cmsRun dumpEvent.py >& $HEDS_LABEL.dumperLog
|
846 |
mangano |
1.7 |
|
847 |
mangano |
1.1 |
$HEDSPATH/scripts/parseDumperOutput.sh 1 >& $HEDS_LABEL.dump
|
848 |
|
|
$HEDSPATH/scripts/parseDumperOutput.sh 2
|
849 |
|
|
rm dumpEvent.py
|
850 |
|
|
rm $HEDS_LABEL.dumperLog
|
851 |
|
|
rm $HEDS_LABEL.dump
|
852 |
mangano |
1.3 |
echo -e "done \n"
|
853 |
mangano |
1.1 |
;;
|
854 |
|
|
4i)
|
855 |
|
|
###
|
856 |
mangano |
1.10 |
rawLocation=$2
|
857 |
mangano |
1.3 |
echo "Preparing html tables..."
|
858 |
mangano |
1.2 |
if [ ! -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ];then
|
859 |
mangano |
1.1 |
echo "create first version of FirstTable.sh"
|
860 |
|
|
$HEDSPATH/scripts/editFirstTable.sh create
|
861 |
mangano |
1.3 |
$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
862 |
|
|
$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
863 |
mangano |
1.10 |
$HEDSPATH/scripts/editFirstTable.sh add $rawLocation ; echo "level-1 table modified"
|
864 |
mangano |
1.3 |
else
|
865 |
|
|
$HEDSPATH/scripts/createTableSkimDetails.sh clean; echo "clean up old html tables"
|
866 |
|
|
$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
867 |
|
|
$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
868 |
mangano |
1.10 |
$HEDSPATH/scripts/editFirstTable.sh add $rawLocation ; echo "level-1 table modified"
|
869 |
mangano |
1.3 |
fi
|
870 |
|
|
echo -e "done \n"
|
871 |
|
|
;;
|
872 |
|
|
|
873 |
mangano |
1.7 |
4i2)
|
874 |
|
|
###
|
875 |
mangano |
1.10 |
rawLocation=$2
|
876 |
mangano |
1.7 |
echo "Preparing html tables..."
|
877 |
|
|
if [ ! -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ];then
|
878 |
|
|
echo "create first version of FirstTable.sh"
|
879 |
|
|
$HEDSPATH/scripts/editFirstTable.sh create
|
880 |
|
|
#$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
881 |
|
|
#$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
882 |
mangano |
1.10 |
$HEDSPATH/scripts/editFirstTable.sh addSpecial $rawLocation ; echo "level-1 table modified"
|
883 |
mangano |
1.7 |
else
|
884 |
|
|
#$HEDSPATH/scripts/createTableSkimDetails.sh clean; echo "clean up old html tables"
|
885 |
|
|
#$HEDSPATH/scripts/createTableSkimDetails.sh add ; echo "level-3 tables produced"
|
886 |
|
|
#$HEDSPATH/scripts/createTableSkimSummary.sh ; echo "level-2 tables produced"
|
887 |
mangano |
1.10 |
$HEDSPATH/scripts/editFirstTable.sh addSpecial $rawLocation ; echo "level-1 table modified"
|
888 |
mangano |
1.7 |
fi
|
889 |
|
|
echo -e "done \n"
|
890 |
|
|
;;
|
891 |
|
|
|
892 |
|
|
|
893 |
mangano |
1.3 |
4j) ###
|
894 |
|
|
echo -e "Your preliminary table is available at the following URL: "
|
895 |
mangano |
1.6 |
url="file://"
|
896 |
mangano |
1.9 |
url=$url$HEDS_WWWAREA_TMP"/logs.SkimV$HEDS_SKIMVERSION/FirstPage.html"
|
897 |
mangano |
1.3 |
echo -e $url "\n"
|
898 |
mangano |
1.10 |
|
899 |
mangano |
1.3 |
echo -e "After you verified that all the tables have been correctly produced, " \
|
900 |
mangano |
1.9 |
"they can be moved to the final repository using:"
|
901 |
mangano |
1.10 |
echo -e " heds add2Web <taskFolder> \n"
|
902 |
|
|
|
903 |
|
|
|
904 |
|
|
echo "WARNING: if some php pages are not opened corretly, it may be because apache server is not"
|
905 |
|
|
echo " running on the machine hosting your HEDS_WWWAREA_TMP area."
|
906 |
|
|
echo "In such a case, copy the whole HEDS_WWWAREA_TMP where "
|
907 |
|
|
echo "php can be interpreted correctly: e.g. your personal webSite hosted at CERN "
|
908 |
|
|
echo ""
|
909 |
|
|
echo "To remind you, currently your HEDS_WWWAREA_TMP folder is: "
|
910 |
|
|
echo $HEDS_WWWAREA_TMP
|
911 |
mangano |
1.3 |
|
912 |
mangano |
1.1 |
;;
|
913 |
mangano |
1.3 |
|
914 |
mangano |
1.5 |
|
915 |
|
|
6) ### copying stuff to castor
|
916 |
|
|
tarName=$HEDS_LABEL.log.tgz
|
917 |
|
|
cd $HEDS_LOCALSTORE/$dailySkim/logs/
|
918 |
|
|
if (($?));then
|
919 |
|
|
echo "ERROR: failed to go to " $HEDS_LOCALSTORE/$dailySkim/logs/
|
920 |
|
|
else
|
921 |
|
|
echo "copying " $tarName " file to CASTOR area.."
|
922 |
|
|
rfcp $tarName $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION
|
923 |
|
|
echo -e "done \n"
|
924 |
|
|
cd -
|
925 |
|
|
fi
|
926 |
|
|
;;
|
927 |
|
|
|
928 |
mangano |
1.1 |
5a)
|
929 |
|
|
echo ".... preparing event display server"
|
930 |
|
|
mkdir $HEDS_LABEL.shots
|
931 |
|
|
port=3005
|
932 |
|
|
$HEDSPATH/scripts/eventDisplayServer.sh $port &
|
933 |
|
|
;;
|
934 |
|
|
5b)
|
935 |
|
|
echo "getting snapshots"
|
936 |
|
|
port=3005
|
937 |
|
|
file=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
938 |
|
|
echo "$file" | nc -w 10 localhost $port
|
939 |
|
|
;;
|
940 |
|
|
5c)
|
941 |
|
|
echo "moving snapshots"
|
942 |
mangano |
1.2 |
mv $HEDS_LABEL.shots $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/
|
943 |
mangano |
1.1 |
cp $HEDSPATH/scripts/indexFileForDetailedSnapShots.php \
|
944 |
mangano |
1.2 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.shots/index.php
|
945 |
mangano |
1.1 |
;;
|
946 |
|
|
|
947 |
|
|
|
948 |
mangano |
1.3 |
final)
|
949 |
|
|
#TO BE FIXED. this call could written in a much more compact way
|
950 |
|
|
echo "WWW pages are going to be moved from the temporary repository"
|
951 |
|
|
echo -e "("$HEDS_WWWAREA_TMP")\n"
|
952 |
|
|
echo "to the permanent one"
|
953 |
|
|
echo -e "("$HEDS_WWWAREA")\n"
|
954 |
|
|
|
955 |
|
|
if [ ! -d $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION ]; then
|
956 |
|
|
mkdir $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION
|
957 |
|
|
fi
|
958 |
|
|
|
959 |
|
|
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php ]; then
|
960 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php \
|
961 |
|
|
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php.BAK
|
962 |
|
|
fi
|
963 |
|
|
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm ]; then
|
964 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm \
|
965 |
|
|
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableBody.shtm.BAK
|
966 |
|
|
fi
|
967 |
|
|
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.php ]; then
|
968 |
|
|
cp $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm \
|
969 |
|
|
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/tableHeader.shtm.BAK
|
970 |
|
|
fi
|
971 |
|
|
|
972 |
mangano |
1.7 |
cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/*.php \
|
973 |
mangano |
1.3 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/
|
974 |
mangano |
1.7 |
cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/*.shtm \
|
975 |
mangano |
1.3 |
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/
|
976 |
|
|
|
977 |
mangano |
1.7 |
if [ -e $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
978 |
|
|
if [ -e $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents ]; then
|
979 |
mangano |
1.10 |
echo "WARNING: replacing folder in the official AFS area of the HiggsDQM."
|
980 |
|
|
|
981 |
|
|
echo "Do you know what you are doing? And is this what you really want to do? [y/n]"
|
982 |
|
|
read -p "$prompt" answer
|
983 |
|
|
case "$answer" in
|
984 |
|
|
[yY1] )
|
985 |
|
|
echo "proceeding with the update of the table.."
|
986 |
|
|
;;
|
987 |
|
|
[nN0] )
|
988 |
|
|
exit 0
|
989 |
|
|
;;
|
990 |
|
|
*)
|
991 |
|
|
echo -e "Incorrect answer. Assuming you meant to type \"No\" "
|
992 |
|
|
exit
|
993 |
|
|
;;
|
994 |
|
|
esac
|
995 |
mangano |
1.7 |
rm -r -i $HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
996 |
|
|
fi
|
997 |
|
|
cp -r $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents \
|
998 |
|
|
$HEDS_WWWAREA/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
999 |
|
|
fi
|
1000 |
mangano |
1.3 |
|
1001 |
|
|
|
1002 |
mangano |
1.7 |
url="https://cms-project-higgsdqm.web.cern.ch/cms-project-higgsdqm/HiggsEDS"
|
1003 |
mangano |
1.3 |
url=$url"/logs.SkimV$HEDS_SKIMVERSION/FirstPage.php"
|
1004 |
|
|
|
1005 |
|
|
echo "The new tables created by you are accessible through the following URL: "
|
1006 |
|
|
echo $url
|
1007 |
|
|
;;
|
1008 |
|
|
|
1009 |
mangano |
1.1 |
##################### after the crab part is done ###################
|
1010 |
mangano |
1.2 |
99) echo "Doing bakcup of $HEDS_WWWAREA_TMP"
|
1011 |
mangano |
1.1 |
date=`date +%k\.%M\.%S_%e\.%m\.%Y`
|
1012 |
|
|
fileName="HiggsIES.BAK."$date".tgz"
|
1013 |
|
|
echo "file name: " $fileName
|
1014 |
mangano |
1.2 |
tar -czvf $fileName $HEDS_WWWAREA_TMP
|
1015 |
|
|
mv $fileName $HEDS_WWWAREA_TMP/..
|
1016 |
mangano |
1.1 |
;;
|
1017 |
|
|
|
1018 |
|
|
|
1019 |
|
|
*)
|
1020 |
|
|
echo "option not defined"
|
1021 |
|
|
;;
|
1022 |
|
|
esac |