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.cern.ch/eosweb/hcal/HcalRemoteMonitoring'
0005 HistoDir='/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 LOG_DIR="dir-Logs"
0037 if [ ! -d ${LOG_DIR} ] ; then mkdir ${LOG_DIR}; fi
0038 rm -f ${LOG_DIR}/*
0039
0040
0041
0042 fileName=$1
0043 comment=$2
0044 if [ ${
0045 ignoreFile=0
0046 debug=0
0047 dasCache=0
0048 DAS_DIR="d-DAS-info"
0049
0050 for a in $@ ; do
0051 if [ "$a" == "-ignore-file" ] ; then
0052 echo " ** file will be ignored"
0053 fileName=""
0054 ignoreFile=1
0055 elif [ "$a" == "-das-cache" ] ; then
0056 echo " ** DAS cache ${DAS_DIR} enabled"
0057 dasCache=1
0058 if [ ! -d ${DAS_DIR} ] ; then mkdir ${DAS_DIR}; fi
0059 else
0060 temp_var=${a/-debug/}
0061 if [ ${
0062 debug=${temp_var}
0063 echo " ** debug detected (debug=${debug})"
0064 fi
0065 fi
0066 done
0067
0068
0069 runList=""
0070 if [ ${
0071 if [ -s ${fileName} ] ; then
0072 runList=`cat ${fileName}`
0073 else
0074 echo "<${fileName}> does not seem to be a valid file"
0075 exit 2
0076 fi
0077 else
0078 if [ ${ignoreFile} -eq 0 ] ; then
0079 echo " ! no file provided"
0080 fi
0081 echo " ! will produce only the global html page"
0082 fi
0083
0084
0085
0086
0087 runList=`echo "${runList}" | sed 'sk,k\ kg' | sed 'sk;k\ kg'`
0088 ok=1
0089 for r in ${runList} ; do
0090 if [ ! ${
0091 echo "run numbers are expected to be of length 6. Check <$r>"
0092 ok=0
0093 fi
0094 debug_loc=0
0095 if [ "$r" -eq "$r" ] 2>/dev/null ; then
0096 if [ ${debug_loc} -eq 1 ] ; then echo "run variable <$r> is a number (ok)"; fi
0097 else
0098 echo "error: run variable <$r> is not an integer number"
0099 ok=0
0100 fi
0101 done
0102
0103 echo "Tested `wc -w <<< "${runList}"` runs from file ${fileName}"
0104 if [ ${ok} -eq 0 ] ; then
0105 echo "errors in the file ${fileName} with run numbers"
0106 exit 3
0107 else
0108 if [ ${
0109 echo "run numbers in ${fileName} verified ok"
0110 fi
0111 fi
0112
0113 comment=`echo ${comment} | sed sk\_k\ kg`
0114 if [ ${
0115 echo "comment \"${comment}\" will be added to the pages"
0116 fi
0117
0118 if [ ${debug} -eq 3 ] ; then exit; fi
0119
0120
0121 echo
0122 echo
0123 echo
0124 echo 'Run numbers for processing'
0125 echo "${runList}"
0126 echo -e "list complete\n"
0127
0128 echo 'processing'
0129
0130 for i in ${runList} ; do
0131 runnumber=$i
0132
0133 logFile="${LOG_DIR}/log_${runnumber}.out"
0134 rm -f ${logFile}
0135
0136
0137 echo
0138 echo
0139 echo
0140 echo "Run for processing $runnumber"
0141 echo "always copy root file from /eos !!!"
0142 echo "file=root://eoscms//cms/$HistoDir/Global_$runnumber.root"
0143
0144
0145
0146
0147 cp /eos/cms/$HistoDir/Global_$runnumber.root Global_$runnumber.root
0148 status="$?"
0149 if [ ! ${status} -eq 0 ] ; then
0150 echo "failed to get file Global_${runnumber}.root"
0151 exit 2
0152 fi
0153
0154
0155
0156 echo 'CMT processing'
0157
0158 echo -e "\nRemoteMonitoringGLOBAL\n" >> ${logFile}
0159 ./../../macros/cmt/RemoteMonitoringGLOBAL.cc.exe Global_$runnumber.root 2>&1 | tee -a ${logFile}
0160 if [ ! $? -eq 0 ] ; then
0161 echo "GLOBAL processing failed"
0162 exit 2
0163 fi
0164
0165
0166
0167
0168
0169
0170
0171 local_WebDir=dir-CMT-GLOBAL_${runnumber}
0172 rm -rf ${local_WebDir}
0173 if [ ! -d ${local_WebDir} ] ; then mkdir ${local_WebDir}; fi
0174 for j in $(ls -r *.html); do
0175 cat $j | sed 's#cms-cpt-software.web.cern.ch\/cms-cpt-software\/General\/Validation\/SVSuite#cms-conddb.cern.ch\/eosweb\/hcal#g' \
0176 > ${local_WebDir}/$j
0177 done
0178 cp *.png ${local_WebDir}
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 mkdir $WebDir/CMT/GLOBAL_$runnumber
0189 cp *.png $WebDir/CMT/GLOBAL_$runnumber/.
0190 cp *.html $WebDir/CMT/GLOBAL_$runnumber/.
0191 echo "cp png and html file done"
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230 rm *.html
0231 rm *.png
0232 rm -rf dir-CMT-GLOBAL_*
0233
0234
0235
0236
0237
0238
0239
0240 done
0241
0242 if [ ${debug} -eq 2 ] ; then
0243 echo "debug=2 skipping web page creation"
0244 exit 2
0245 fi
0246
0247
0248
0249
0250 echo "CMT script done"
0251