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 |
#echo "choice: " $choice
|
16 |
|
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 |
cp -r -T $HEDS_WWWAREA_TMP $HEDS_WWWAREA_TMP.tmp
|
29 |
;;
|
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 |
<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 |
</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 |
#fileRevision=$(cat $HEDSPATH/python/CVS/Entries |grep earlyDataInterestingEvents_cff|awk -F/ '{print $3}')
|
51 |
|
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 as the merged edm output files.
|
74 |
<!-- <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 |
</ul>
|
76 |
</big>
|
77 |
</body>
|
78 |
</html>
|
79 |
|
80 |
EOF
|
81 |
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 |
;;
|
85 |
|
86 |
add)
|
87 |
echo "option $choice. Add entry to table"
|
88 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
89 |
simpleSummaryFile=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.log
|
90 |
nInputEvts=`cat $simpleSummaryFile |grep "Skim_" | awk '{print $2}'|head -n 1`
|
91 |
mergedFileCastor="rfio:$HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/merged_$HEDS_LABEL.root"
|
92 |
mergedFile=$HEDS_LOCALSTORE/merged_$HEDS_LABEL.root
|
93 |
|
94 |
nOutputEvents=`edmEventSize -v $mergedFile |grep Events |awk '{print $4}'`
|
95 |
|
96 |
listSkimmedEventsPath=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
|
97 |
skimmedEventPath=$HEDS_LABEL.listSkimmedEvents
|
98 |
|
99 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
100 |
echo "$HEDS_INPUTDATASET" > \
|
101 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.inputDataset
|
102 |
urlInput="<a href=\"$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.inputDataset\"> input </a>"
|
103 |
|
104 |
echo "$HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/merged_$HEDS_LABEL.root" > \
|
105 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.outputMergedEDM
|
106 |
urlOutput="<a href=\"$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.outputMergedEDM\"> output </a>"
|
107 |
|
108 |
|
109 |
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*"
|
110 |
|
111 |
fileRevision=$(cat $HEDSPATH/python/CVS/Entries |grep earlyDataInterestingEvents_cff|awk -F/ '{print $3}')
|
112 |
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>"
|
113 |
cat >> extension.html <<EOF
|
114 |
<tr>
|
115 |
<td> $HEDS_LABEL </td> <td> $runList </td> <td><a href="$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runselection"> link </a></td> <td> $urlInput </td> <td> $nInputEvts </td> <td> $linkToSkimRevision </td> <td> $urlOutput </td>
|
116 |
<td><a href="$linkToDBS"> DBS entry </a> </td> <td> $nOutputEvents</td> <td><a href="$skimmedEventPath/summary.html"> link </a></td>
|
117 |
</tr>
|
118 |
EOF
|
119 |
case $2 in
|
120 |
below)
|
121 |
cat tmp.html extension.html >> new.html
|
122 |
;;
|
123 |
above)
|
124 |
cat extension.html tmp.html >> new.html
|
125 |
;;
|
126 |
*)
|
127 |
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
128 |
exit
|
129 |
esac
|
130 |
rm extension.html
|
131 |
rm tmp.html
|
132 |
|
133 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
134 |
;;
|
135 |
|
136 |
|
137 |
addSpecial)
|
138 |
echo "option $choice. Add special entry to table"
|
139 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
140 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
141 |
echo "$HEDS_INPUTDATASET" > \
|
142 |
$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.inputDataset
|
143 |
urlInput="<a href=\"$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.inputDataset\"> input </a>"
|
144 |
cat >> extension.html <<EOF
|
145 |
<tr>
|
146 |
<td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> $urlInput </td> <td> na </td> <td> na </td>
|
147 |
<td> na </td> <td> na </td> <td> na </td> <td> na </td>
|
148 |
</tr>
|
149 |
EOF
|
150 |
case $2 in
|
151 |
below)
|
152 |
cat tmp.html extension.html >> new.html
|
153 |
;;
|
154 |
above)
|
155 |
cat extension.html tmp.html >> new.html
|
156 |
;;
|
157 |
*)
|
158 |
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
159 |
exit
|
160 |
esac
|
161 |
rm extension.html
|
162 |
rm tmp.html
|
163 |
|
164 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
165 |
;;
|
166 |
|
167 |
addComment)
|
168 |
echo "option $choice. Add Comment entry to table"
|
169 |
cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
170 |
runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
|
171 |
|
172 |
cat >> extension.html <<EOF
|
173 |
<tr>
|
174 |
<td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> na </td> <td> na </td>
|
175 |
<td> na </td> <td> na </td> <td> na </td>
|
176 |
</tr>
|
177 |
EOF
|
178 |
case $2 in
|
179 |
below)
|
180 |
cat tmp.html extension.html >> new.html
|
181 |
;;
|
182 |
above)
|
183 |
cat extension.html tmp.html >> new.html
|
184 |
;;
|
185 |
*)
|
186 |
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
187 |
exit
|
188 |
esac
|
189 |
rm extension.html
|
190 |
rm tmp.html
|
191 |
|
192 |
mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
193 |
;;
|
194 |
|
195 |
remove)
|
196 |
echo "option $choice. Remove entry to table"
|
197 |
case $2 in
|
198 |
below)
|
199 |
head -n -4 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
200 |
mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
201 |
;;
|
202 |
above)
|
203 |
tail -n +5 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
|
204 |
mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
|
205 |
;;
|
206 |
*)
|
207 |
echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
|
208 |
exit
|
209 |
esac
|
210 |
;;
|
211 |
|
212 |
*)
|
213 |
echo "option not defined"
|
214 |
;;
|
215 |
esac
|
216 |
|
217 |
|
218 |
#if [ $choice == 3 ]
|
219 |
#then
|
220 |
## --- loop over daily-skims ---
|
221 |
# cat $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName | grep -v "</body>"| grep -v "</html>" > tmp.html
|
222 |
|
223 |
### HERE YOU WANT TO PUT YOUR COMMENTS (BY HAND)
|
224 |
# cat >> tmp.html <<EOF
|
225 |
|
226 |
#EOF
|
227 |
# mv tmp.html $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName
|
228 |
#fi
|
229 |
|
230 |
#if [ $choice == 4 ]
|
231 |
#then
|
232 |
# echo "boh"
|
233 |
# cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName.BAK
|
234 |
# cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tmpName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName
|
235 |
#fi |