ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HiggsAnalysis/EarlyDataStudy/scripts/editFirstTable.sh
Revision: 1.2
Committed: Thu May 6 17:55:14 2010 UTC (14 years, 11 months ago) by mangano
Content type: application/x-sh
Branch: MAIN
Changes since 1.1: +24 -24 lines
Log Message:
change destination folder for WWW pages

File Contents

# Content
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 rm -r $HEDS_WWWAREA_TMP.tmp
29 cp -r $HEDS_WWWAREA_TMP $HEDS_WWWAREA_TMP.tmp
30 ;;
31
32 create)
33 echo "option $choice. Create the $pageName, $tableHeaderName and $tableBodyName from scratch"
34 cat > $tableHeaderName <<EOF
35 <table class='selectedEventsSummary'>
36 <tr>
37 <th> day of data taking </th> <th> run interval </th> <th> analyzed runs </th> <th> #events analyzed </th> <th> output on castor</th> <th> DBS entry</th> <th> #events output</th> <th>event type breaking</th>
38 </tr>
39
40 <!--
41 <tr>
42 <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>
43 </tr>
44 -->
45 EOF
46
47 cat > $tableBodyName <<EOF
48 EOF
49
50
51 revision=$(cat $HEDSPATH/python/CVS/Entries |grep early |awk -F/ '{print $3}')
52
53 cat > $pageName <<EOF
54 <html>
55 <head>
56 <!-- <title>First Summary Table</title>
57 <meta http-equiv="refresh" content="60" /> -->
58 <link rel="stylesheet" type="text/css" href="../fromGiovanni.css" />
59 </head>
60 <body>
61
62 <?php include("$tableHeaderName"); ?>
63 <?php include("$tableBodyName"); ?>
64 <!-- should I define a table footer??? -->
65 </table>
66
67
68 <p></p>
69 <p></p>
70 <big>
71 <b>Notes:</b>
72 <ul>
73 <li> All skimmed file are copied in the castor folder: <b> $HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION </b></li>
74 <li> All logs from CRAB jobs are compressed in tgz files and copied in the same castor folder.
75 <li> The events of the files listed in the table have been selected using the skim configuration version $HEDS_SKIMVERSION in: <a href="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/HiggsAnalysis/EarlyDataStudy/python/earlyDataInterestingEvents_cff.py?hideattic=1&revision=$revision&view=markup">link</a> </li>
76 </ul>
77 </big>
78 </body>
79 </html>
80
81 EOF
82 mv $pageName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
83 mv $tableHeaderName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
84 mv $tableBodyName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION
85 ;;
86
87 add)
88 echo "option $choice. Add entry to table"
89 cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
90 simpleSummaryFile=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.log
91 nInputEvts=`cat $simpleSummaryFile |grep "Skim_" | awk '{print $2}'|head -n 1`
92 mergedFileCastor="rfio:$HEDS_CASTORFOLDER/skimV$HEDS_SKIMVERSION/merged_$HEDS_LABEL.root"
93
94 nOutputEvents=`edmEventSize -v $mergedFileCastor |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.runinterval`
100
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
105 cat >> extension.html <<EOF
106 <tr>
107 <td> $HEDS_LABEL </td> <td> $runList </td> <td><a href="$HEDS_LABEL.runselection"> link </a></td> <td> $nInputEvts </td> <td> merged_$HEDS_LABEL.root</td>
108 <td><a href="$linkToDBS"> DBS entry </a> </td> <td> $nOutputEvents</td> <td><a href="$skimmedEventPath/summary.html"> link </a></td>
109 </tr>
110 EOF
111 case $2 in
112 below)
113 cat tmp.html extension.html >> new.html
114 ;;
115 above)
116 cat extension.html tmp.html >> new.html
117 ;;
118 *)
119 echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
120 exit
121 esac
122 rm extension.html
123 rm tmp.html
124
125 mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
126 ;;
127
128
129 addSpecial)
130 echo "option $choice. Add special entry to table"
131 cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
132 runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.runinterval`
133
134 cat >> extension.html <<EOF
135 <tr>
136 <td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> na </td> <td> na </td>
137 <td> na </td> <td> na </td> <td> na </td>
138 </tr>
139 EOF
140 case $2 in
141 below)
142 cat tmp.html extension.html >> new.html
143 ;;
144 above)
145 cat extension.html tmp.html >> new.html
146 ;;
147 *)
148 echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
149 exit
150 esac
151 rm extension.html
152 rm tmp.html
153
154 mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
155 ;;
156
157 addComment)
158 echo "option $choice. Add Comment entry to table"
159 cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
160 runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.runinterval`
161
162 cat >> extension.html <<EOF
163 <tr>
164 <td> $HEDS_LABEL </td> <td> $runList </td> <td> noGoodRuns</td> <td> na </td> <td> na </td>
165 <td> na </td> <td> na </td> <td> na </td>
166 </tr>
167 EOF
168 case $2 in
169 below)
170 cat tmp.html extension.html >> new.html
171 ;;
172 above)
173 cat extension.html tmp.html >> new.html
174 ;;
175 *)
176 echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
177 exit
178 esac
179 rm extension.html
180 rm tmp.html
181
182 mv new.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
183 ;;
184
185 remove)
186 echo "option $choice. Remove entry to table"
187 case $2 in
188 below)
189 head -n -4 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
190 mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
191 ;;
192 above)
193 tail -n +5 $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName > tmp.html
194 mv tmp.html $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tableBodyName
195 ;;
196 *)
197 echo 'ERROR: please specify with the third argument if you want to add the line "above" or "below"'
198 exit
199 esac
200 ;;
201
202 *)
203 echo "option not defined"
204 ;;
205 esac
206
207
208 #if [ $choice == 3 ]
209 #then
210 ## --- loop over daily-skims ---
211 # cat $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName | grep -v "</body>"| grep -v "</html>" > tmp.html
212
213 ### HERE YOU WANT TO PUT YOUR COMMENTS (BY HAND)
214 # cat >> tmp.html <<EOF
215
216 #EOF
217 # mv tmp.html $HEDS_WWWAREA_TMPTmp/logs.SkimV$HEDS_SKIMVERSION/$pageName
218 #fi
219
220 #if [ $choice == 4 ]
221 #then
222 # echo "boh"
223 # cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName.BAK
224 # cp $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$tmpName $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$finalName
225 #fi