File indexing completed on 2024-04-06 12:06:26
0001
0002
0003 WebDir='/eos/cms/store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring'
0004 WebSite='https://cms-conddb-dev.cern.ch/eosweb/hcal/HcalRemoteMonitoring'
0005 HistoDir='/eos/cms/store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/CMT/histos'
0006 eos='/afs/cern.ch/project/eos/installation/0.3.15/bin/eos.select'
0007
0008
0009 if [[ "$1" == "" ]]; then
0010 echo "Usage:"
0011 echo " $0 file [comment] [-ignore-file] [-das-cache]"
0012 echo " file -- a file with run numbers"
0013 echo " comment -- add a comment line (instead of spaces use '_')"
0014 echo " -ignore-file -- skips production of run html pages. Produces"
0015 echo " only the global page. File name is not needed."
0016 echo " -das-cache -- whether to save DAS information locally for a reuse"
0017 echo
0018 echo "example: ./GLOBAL.sh Run_List.txt"
0019 exit 1
0020 fi
0021
0022 cmsenv 2>/dev/null
0023 if [ $? == 0 ] ; then
0024 eval `scramv1 runtime -sh`
0025 fi
0026 temp_var=`ls ${eos}`
0027 status="$?"
0028 echo "using eos command <${temp_var}>"
0029 if [ ! ${status} -eq 0 ] ; then
0030 echo "failed to find eos command"
0031
0032 fi
0033
0034
0035
0036 fileName=$1
0037 comment=$2
0038 if [ ${
0039 ignoreFile=0
0040 debug=0
0041 dasCache=0
0042 DAS_DIR="d-DAS-info"
0043
0044 for a in $@ ; do
0045 if [ "$a" == "-ignore-file" ] ; then
0046 echo " ** file will be ignored"
0047 fileName=""
0048 ignoreFile=1
0049 elif [ "$a" == "-das-cache" ] ; then
0050 echo " ** DAS cache ${DAS_DIR} enabled"
0051 dasCache=1
0052 if [ ! -d ${DAS_DIR} ] ; then mkdir ${DAS_DIR}; fi
0053 else
0054 temp_var=${a/-debug/}
0055 if [ ${
0056 debug=${temp_var}
0057 echo " ** debug detected (debug=${debug})"
0058 fi
0059 fi
0060 done
0061
0062
0063 runList=""
0064 if [ ${
0065 if [ -s ${fileName} ] ; then
0066 runList=`cat ${fileName}`
0067 else
0068 echo "<${fileName}> does not seem to be a valid file"
0069 exit 2
0070 fi
0071 else
0072 if [ ${ignoreFile} -eq 0 ] ; then
0073 echo " ! no file provided"
0074 fi
0075 echo " ! will produce only the global html page"
0076 fi
0077
0078
0079
0080
0081 runList=`echo "${runList}" | sed 'sk,k\ kg' | sed 'sk;k\ kg'`
0082 ok=1
0083 for r in ${runList} ; do
0084 if [ ! ${
0085 echo "run numbers are expected to be of length 6. Check <$r>"
0086 ok=0
0087 fi
0088 debug_loc=0
0089 if [ "$r" -eq "$r" ] 2>/dev/null ; then
0090 if [ ${debug_loc} -eq 1 ] ; then echo "run variable <$r> is a number (ok)"; fi
0091 else
0092 echo "error: run variable <$r> is not an integer number"
0093 ok=0
0094 fi
0095 done
0096
0097 echo "Tested `wc -w <<< "${runList}"` runs from file ${fileName}"
0098 if [ ${ok} -eq 0 ] ; then
0099 echo "errors in the file ${fileName} with run numbers"
0100 exit 3
0101 else
0102 if [ ${
0103 echo "run numbers in ${fileName} verified ok"
0104 fi
0105 fi
0106
0107 comment=`echo ${comment} | sed sk\_k\ kg`
0108 if [ ${
0109 echo "comment \"${comment}\" will be added to the pages"
0110 fi
0111
0112 if [ ${debug} -eq 3 ] ; then exit; fi
0113
0114
0115 echo
0116 echo
0117 echo
0118 echo 'Numbers of NEW runs for processing'
0119 echo "${runList}"
0120 echo -e "runList complete\n"
0121
0122
0123
0124
0125
0126
0127
0128
0129 echo "Get list of runss in ${HistoDir}"
0130
0131
0132
0133 histoFiles=`${eos} ls $HistoDir | grep root | awk -F '_' '{print $2}' | awk -F '.' '{print $1}'`
0134 echo -e '\n\nRun numbers on EOS:'
0135 runListEOSall=`echo $histoFiles | tee _runlistEOSall_`
0136 echo "Got `wc -w <<< "${runListEOSall}"` runs from HistDir ${HistoDir}"
0137
0138 echo -e '\n\nRun numbers:'
0139 runListEOS=`echo $runList | tee _runlist_`
0140 echo "${runListEOS}"
0141 echo -e "Full runList for EOS complete\n"
0142
0143
0144
0145
0146
0147
0148 echo "Get OLD list of runs in ${HistoDir}"
0149 echo -e '\n\nRun numbers to be on EOS:'
0150 runListEOS=`echo $histoFiles `
0151 echo "${runListEOS}"
0152 echo -e "OLD list complete\n"
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 echo 'next message is Fine: '
0169 rm index.html
0170
0171 eoscp $WebDir/CMT/index.html index.html
0172 cp index.html OLDindex.html
0173
0174
0175 cat index.html | head -n -1 > index_draft.html
0176
0177
0178
0179
0180
0181
0182 k=1429
0183
0184
0185 echo ' ================>>> k in old list = '$k
0186
0187 for i in ${runListEOS} ; do
0188
0189
0190
0191 runnumber=${i}
0192
0193 let "k = k + 1"
0194 echo
0195 echo ' ================>>> new k in loop = '$k
0196 echo
0197 echo
0198 echo 'RUN number = '$runnumber
0199
0200
0201 dasInfo=${DAS_DIR}/das_${runnumber}.txt
0202 got=0
0203 if [ ${dasCache} -eq 1 ] ; then
0204 rm -f tmp
0205 if [ -s ${dasInfo} ] ; then
0206 cp ${dasInfo} tmp
0207 got=1
0208 else
0209 echo "no ${dasInfo} found. Will use dasgoclient"
0210 fi
0211 fi
0212
0213 if [ ${got} -eq 0 ] ; then
0214
0215
0216
0217 dasgoclient --query="run=${i} | grep run.lhcEnergy ,run.bfield ,run.lsCount ,run.lhcFill , run.lsRanges , run.runClassName ,run.startTime ,run.stopTime " > tmp
0218
0219
0220
0221
0222 fi
0223
0224
0225
0226
0227 cat tmp | head -n -1 > ztmp
0228 rm tmp
0229
0230
0231
0232 date=`cat ztmp | awk '{print $7" "$8" "$9}'`
0233 date_end=`cat ztmp | awk '{print $10" "$11" "$12}'`
0234
0235
0236
0237 E=`cat ztmp | awk '{print $1}'`
0238 B=`cat ztmp | awk '{print $2}'`
0239 nL=`cat ztmp | awk '{print $3}'`
0240 Fill=`cat ztmp | awk '{print $4}'`
0241 dLumi=`cat ztmp | awk '{print $5}'`
0242 D=`cat ztmp | awk '{print $6}'`
0243
0244
0245 rm ztmp
0246
0247
0248
0249
0250
0251
0252
0253 fileinfo=`${eos} ls -l $HistoDir/Global_$i.root`
0254 Date_obr=`echo ${fileinfo} | awk '{print $6" "$7" "$8}'`
0255
0256
0257
0258 type='Cosmic'
0259 commentariy=''
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272 echo 'RUN Start Date = '$date
0273 echo 'RUN Duration = '$D
0274 echo 'RUN End Date = '$date_end
0275 echo 'RUN Energy = '$E
0276 echo 'RUN Magnet field = '$B
0277 echo 'RUN LS number = '$nL
0278 echo 'RUN LHC Fill = '$Fill
0279 echo 'RUN Delivered Luminosity = '$dLumi
0280 echo 'RUN Date processing = '$Date_obr
0281
0282
0283
0284 let "raw = (k % 2) + 2"
0285 echo '<tr>'>> index_draft.html
0286 echo '<td class="s1" align="center">'$k'</td>'>> index_draft.html
0287 echo '<td class="s'$raw'" align="center">'$runnumber'</td>'>> index_draft.html
0288
0289 echo '<td class="s'$raw'" align="center">'$nL'</td>'>> index_draft.html
0290 echo '<td class="s'$raw'" align="center">'$Fill'</td>'>> index_draft.html
0291 echo '<td class="s'$raw'" align="center">'$date'</td>'>> index_draft.html
0292 echo '<td class="s'$raw'" align="center">'$D'</td>'>> index_draft.html
0293 echo '<td class="s'$raw'" align="center">'$date_end'</td>'>> index_draft.html
0294 echo '<td class="s'$raw'" align="center"><a href="'$WebSite'/CMT/GLOBAL_'$runnumber'/LumiList.html">CMT_'$runnumber'</a></td>'>> index_draft.html
0295 echo '<td class="s'$raw'" align="center"><a href="'$WebSite'/GlobalRMT/GLOBAL_'$runnumber'/MAP.html">RMT_'$runnumber'</a></td>'>> index_draft.html
0296 echo '<td class="s'$raw'" align="center">'$B' T</td>'>> index_draft.html
0297 echo '<td class="s'$raw'" align="center">'$E' GeV</td>'>> index_draft.html
0298
0299 echo '<td class="s'$raw'" align="center">'$Date_obr'</td>'>> index_draft.html
0300 if [ ${
0301
0302 temp_var=${runList/${runnumber}/}
0303 if [ ${
0304 echo "adding a commentary for this run"
0305 echo "<td class=\"s${raw}\" align=\"center\">${comment}</td>" >> index_draft.html
0306 fi
0307 fi
0308 echo '</tr>'>> index_draft.html
0309 prev=$i
0310
0311
0312 done
0313
0314
0315
0316 echo `cat footer.txt`>> index_draft.html
0317
0318
0319 status=0
0320 if [ ${debug} -gt 0 ] ; then
0321 echo "debug=${debug}. No upload to eos"
0322 status=-1
0323 else
0324
0325
0326
0327
0328
0329 status="$?"
0330
0331 fi
0332
0333
0334
0335 if [ ${debug} -eq 0 ] ; then
0336
0337 rm -f _runlist_
0338 rm -f _runlistEOSall_
0339 fi
0340
0341
0342 if [[ "${status}" == "0" ]]; then
0343 echo "Successfully uploaded!"
0344 else
0345 echo "ERROR: Uploading failed"
0346 exit 1
0347 fi
0348
0349 echo "index script done"