1 |
mangano |
1.1 |
#!/bin/bash
|
2 |
|
|
################################################
|
3 |
|
|
#possible options:
|
4 |
|
|
# choice:
|
5 |
|
|
# backup --> does backup
|
6 |
|
|
# create --> create new page
|
7 |
|
|
# add($1) below/above($2) --> add new entry to the table
|
8 |
|
|
# addSpecial below/above($2) --> add special entry for daily-skim from 0 runs
|
9 |
|
|
# remove($1) below/above($2) --> remove first or last entry in the table
|
10 |
|
|
|
11 |
|
|
################################################
|
12 |
|
|
|
13 |
|
|
############# preliminary part ################
|
14 |
|
|
choice=$1
|
15 |
mangano |
1.3 |
#echo "choice: " $choice
|
16 |
mangano |
1.1 |
|
17 |
|
|
pageName=FirstPage.php
|
18 |
|
|
tableHeaderName=tableHeader.shtm
|
19 |
|
|
tableBodyName=tableBody.shtm
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
dailySkim=$HEDS_NAMEPREFIX$HEDS_LABEL-v$HEDS_TASKATTEMPT
|
23 |
|
|
|
24 |
|
|
case $choice in
|
25 |
|
|
|
26 |
|
|
backup)
|
27 |
|
|
echo "option $choice. Copying the whole area into a tmp one"
|
28 |
mangano |
1.4 |
cp -r -T $HEDS_WWWAREA_TMP $HEDS_WWWAREA_TMP.tmp
|
29 |
mangano |
1.1 |
;;
|
30 |
|
|
|
31 |
|
|
create)
|
32 |
|
|
echo "option $choice. Create the $pageName, $tableHeaderName and $tableBodyName from scratch"
|
33 |
|
|
cat > $tableHeaderName <<EOF
|
34 |
|
|
<table class='selectedEventsSummary'>
|
35 |
|
|
<tr>
|
36 |
mangano |
1.3 |
<th> day of data taking </th> <th> run interval </th> <th> analyzed runs </th> <th> input datasets </th> <th> #events analyzed </th> <th> skim configuration</th> <th> output on castor</th> <th> DBS entry</th> <th> #events output</th> <th>event type breaking</th>
|
37 |
mangano |
1.1 |
</tr>
|
38 |
|
|
|
39 |
|
|
<!--
|
40 |
|
|
<tr>
|
41 |
|
|
<td> day of data taking </td> <td> run interval </td> <td> analyzed runs </td> <td> #events analyzed </td> <td> output on castor</td> <td> DBS entry</td> <td> #events output</td> <td>event type breaking</td>
|
42 |
|
|
</tr>
|
43 |
|
|
-->
|
44 |
|
|
EOF
|
45 |
|
|
|
46 |
|
|
cat > $tableBodyName <<EOF
|
47 |
|
|
EOF
|
48 |
|
|
|
49 |
|
|
|
50 |
mangano |
1.3 |
#fileRevision=$(cat $HEDSPATH/python/CVS/Entries |grep earlyDataInterestingEvents_cff|awk -F/ '{print $3}')
|
51 |
mangano |
1.1 |
|
52 |
|
|
cat > $pageName <<EOF
|
53 |
|
|
<html>
|
54 |
|
|
<head>
|
55 |
|
|
<!-- <title>First Summary Table</title>
|
56 |
|
|
<meta http-equiv="refresh" content="60" /> -->
|
57 |
|
|
<link rel="stylesheet" type="text/css" href="../fromGiovanni.css" />
|
58 |
|
|
</head>
|
59 |
|
|
<body>
|
60 |
|
|
|
61 |
|
|
<?php include("$tableHeaderName"); ?>
|
62 |
|
|
<?php include("$tableBodyName"); ?>
|
63 |
|
|
<!-- should I define a table footer??? -->
|
64 |
|
|
</table>
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
<p></p>
|
68 |
|
|
<p></p>
|
69 |
|
|
<big>
|
70 |
|
|
<b>Notes:</b>
|
71 |
|
|
<ul>
|
72 |
|
|
<li> All skimmed file are copied in the castor folder: <b> $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION </b></li>
|
73 |
|
|
<li> All logs from CRAB jobs are compressed in tgz files and copied in the same castor folder.
|
74 |
mangano |
1.3 |
<!-- <li> The events of the files listed in the table have been selected using the skim configuration revision $fileRevision in: <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/HiggsAnalysis/EarlyDataStudy/python/earlyDataInterestingEvents_cff.py?revision=$fileRevision&view=markup"> link </a> </li> -->
|
75 |
mangano |
1.1 |
</ul>
|
76 |
|
|
</big>
|
77 |
|
|
</body>
|
78 |
|
|
</html>
|
79 |
|
|
|
80 |
|
|
EOF
|
81 |
mangano |
1.2 |
mv $pageName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
|
82 |
|
|
mv $tableHeaderName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
|
83 |
|
|
mv $tableBodyName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
|
84 |
mangano |
1.1 |
;;
|
85 |
|
|
|
86 |
|
|
add)
|
87 |
|
|
echo "option $choice. Add entry to table"
|
88 |
mangano |
1.2 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
89 |
mangano |
1.3 |
simpleSummaryFile=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.log
|
90 |
mangano |
1.1 |
nInputEvts=`cat $simpleSummaryFile |grep "Skim_" | awk '{print $2}'|head -n 1`
|
91 |
|
|
mergedFileCastor="rfio:$HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/merged_$HEDS_LABEL.root"
|
92 |
mangano |
1.5 |
mergedFile=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
93 |
|
|
|
94 |
|
|
nOutputEvents=`edmEventSize -v $mergedFile |grep Events |awk '{print $4}'`
|
95 |
mangano |
1.1 |
|
96 |
mangano |
1.2 |
listSkimmedEventsPath=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
97 |
mangano |
1.1 |
skimmedEventPath=$HEDS_LABEL.listSkimmedEvents
|
98 |
|
|
|
99 |
mangano |
1.3 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
100 |
mangano |
1.1 |
|
101 |
|
|
|
102 |
|
|
linkToDBS="https://cmsweb.cern.ch/dbs_discovery/aSearch?caseSensitive=on&userMode=user&sortOrder=desc&sortName=&grid=0&method=dbsapi&dbsInst=cms_dbs_ph_analysis_02&userInput=find+dataset+where+dataset+like+*$HEDS_USERID*HiggsSimpleSkimV$HEDS_SKIMVERSION*$HEDS_LABEL*+and+dataset.status+like+VALID*"
|
103 |
|
|
|
104 |
mangano |
1.3 |
fileRevision=$(cat $HEDSPATH/python/CVS/Entries |grep earlyDataInterestingEvents_cff|awk -F/ '{print $3}')
|
105 |
|
|
linkToSkimRevision="<a href=\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/HiggsAnalysis/EarlyDataStudy/python/earlyDataInterestingEvents_cff.py?revision=$fileRevision&view=markup\"> rev $fileRevision </a>"
|
106 |
mangano |
1.1 |
cat >> extension.html <<EOF
|
107 |
|
|
<tr>
|
108 |
mangano |
1.3 |
<td> $HEDS_LABEL </td> <td> $runList </td> <td><a href="$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runselection"> link </a></td> <td> na </td> <td> $nInputEvts </td> <td> $linkToSkimRevision </td> <td> merged_$HEDS_LABEL.root</td>
|
109 |
mangano |
1.1 |
<td><a href="$linkToDBS"> DBS entry </a> </td> <td> $nOutputEvents</td> <td><a href="$skimmedEventPath/summary.html"> link </a></td>
|
110 |
|
|
</tr>
|
111 |
|
|
EOF
|
112 |
|
|
case $2 in
|
113 |
|
|
below)
|
114 |
|
|
cat tmp.html extension.html >> new.html
|
115 |
|
|
;;
|
116 |
|
|
above)
|
117 |
|
|
cat extension.html tmp.html >> new.html
|
118 |
|
|
;;
|
119 |
|
|
*)
|
120 |
|
|
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
121 |
|
|
exit
|
122 |
|
|
esac
|
123 |
|
|
rm extension.html
|
124 |
|
|
rm tmp.html
|
125 |
|
|
|
126 |
mangano |
1.2 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
127 |
mangano |
1.1 |
;;
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
addSpecial)
|
131 |
|
|
echo "option $choice. Add special entry to table"
|
132 |
mangano |
1.2 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
133 |
mangano |
1.3 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
134 |
mangano |
1.1 |
|
135 |
|
|
cat >> extension.html <<EOF
|
136 |
|
|
<tr>
|
137 |
|
|
<td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> na </td> <td> na </td>
|
138 |
|
|
<td> na </td> <td> na </td> <td> na </td>
|
139 |
|
|
</tr>
|
140 |
|
|
EOF
|
141 |
|
|
case $2 in
|
142 |
|
|
below)
|
143 |
|
|
cat tmp.html extension.html >> new.html
|
144 |
|
|
;;
|
145 |
|
|
above)
|
146 |
|
|
cat extension.html tmp.html >> new.html
|
147 |
|
|
;;
|
148 |
|
|
*)
|
149 |
|
|
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
150 |
|
|
exit
|
151 |
|
|
esac
|
152 |
|
|
rm extension.html
|
153 |
|
|
rm tmp.html
|
154 |
|
|
|
155 |
mangano |
1.2 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
156 |
mangano |
1.1 |
;;
|
157 |
|
|
|
158 |
|
|
addComment)
|
159 |
|
|
echo "option $choice. Add Comment entry to table"
|
160 |
mangano |
1.2 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
161 |
mangano |
1.3 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
162 |
mangano |
1.1 |
|
163 |
|
|
cat >> extension.html <<EOF
|
164 |
|
|
<tr>
|
165 |
|
|
<td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> na </td> <td> na </td>
|
166 |
|
|
<td> na </td> <td> na </td> <td> na </td>
|
167 |
|
|
</tr>
|
168 |
|
|
EOF
|
169 |
|
|
case $2 in
|
170 |
|
|
below)
|
171 |
|
|
cat tmp.html extension.html >> new.html
|
172 |
|
|
;;
|
173 |
|
|
above)
|
174 |
|
|
cat extension.html tmp.html >> new.html
|
175 |
|
|
;;
|
176 |
|
|
*)
|
177 |
|
|
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
178 |
|
|
exit
|
179 |
|
|
esac
|
180 |
|
|
rm extension.html
|
181 |
|
|
rm tmp.html
|
182 |
|
|
|
183 |
mangano |
1.2 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
184 |
mangano |
1.1 |
;;
|
185 |
|
|
|
186 |
|
|
remove)
|
187 |
|
|
echo "option $choice. Remove entry to table"
|
188 |
|
|
case $2 in
|
189 |
|
|
below)
|
190 |
mangano |
1.2 |
head -n -4 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
191 |
|
|
mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
192 |
mangano |
1.1 |
;;
|
193 |
|
|
above)
|
194 |
mangano |
1.2 |
tail -n +5 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
195 |
|
|
mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
196 |
mangano |
1.1 |
;;
|
197 |
|
|
*)
|
198 |
|
|
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
199 |
|
|
exit
|
200 |
|
|
esac
|
201 |
|
|
;;
|
202 |
|
|
|
203 |
|
|
*)
|
204 |
|
|
echo "option not defined"
|
205 |
|
|
;;
|
206 |
|
|
esac
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
#if [ $choice == 3 ]
|
210 |
|
|
#then
|
211 |
|
|
## --- loop over daily-skims ---
|
212 |
mangano |
1.2 |
# cat $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName | grep -v "</body>"| grep -v "</html>" > tmp.html
|
213 |
mangano |
1.1 |
|
214 |
|
|
### HERE YOU WANT TO PUT YOUR COMMENTS (BY HAND)
|
215 |
|
|
# cat >> tmp.html <<EOF
|
216 |
|
|
|
217 |
|
|
#EOF
|
218 |
mangano |
1.2 |
# mv tmp.html $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName
|
219 |
mangano |
1.1 |
#fi
|
220 |
|
|
|
221 |
|
|
#if [ $choice == 4 ]
|
222 |
|
|
#then
|
223 |
|
|
# echo "boh"
|
224 |
mangano |
1.2 |
# cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName.BAK
|
225 |
|
|
# cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tmpName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName
|
226 |
mangano |
1.1 |
#fi |