ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HiggsAnalysis/EarlyDataStudy/scripts/editFirstTable.sh
Revision: 1.4
Committed: Fri May 7 14:27:01 2010 UTC (14 years, 11 months ago) by mangano
Content type: application/x-sh
Branch: MAIN
CVS Tags: V00-00-01
Changes since 1.3: +1 -2 lines
Log Message:
minor changes

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 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.
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
93 nOutputEvents=`edmEventSize -v $mergedFileCastor |grep Events |awk '{print $4}'`
94
95 listSkimmedEventsPath=$HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents
96 skimmedEventPath=$HEDS_LABEL.listSkimmedEvents
97
98 runList=`cat $HEDS_WWWAREA_TMP/logs.SkimV$HEDS_SKIMVERSION/$HEDS_LABEL.listSkimmedEvents/$HEDS_LABEL.runinterval`
99
100
101 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*"
102
103 fileRevision=$(cat $HEDSPATH/python/CVS/Entries |grep earlyDataInterestingEvents_cff|awk -F/ '{print $3}')
104 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>"
105 cat >> extension.html <<EOF
106 <tr>
107 <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>
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.listSkimmedEvents/$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.listSkimmedEvents/$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