File indexing completed on 2024-04-06 12:06:27
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/GlobalPSM/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
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 xrdcp -f root://eoscms//eos/cms/$HistoDir/Global_$runnumber.root Global_$runnumber.root
0147 status="$?"
0148 if [ ! ${status} -eq 0 ] ; then
0149 echo "failed to get file Global_${runnumber}.root"
0150 exit 2
0151 fi
0152
0153
0154
0155 echo -e "\nRemoteMonitoringPSM\n" >> ${logFile}
0156
0157 ./../../macros/psm/RemoteMonitoringPSM.cc.exe Global_$runnumber.root Global_$runnumber.root Global 2>&1 | tee -a ${logFile}
0158
0159 if [ ! $? -eq 0 ] ; then
0160 echo "PSM processing failed"
0161 exit 2
0162 fi
0163
0164
0165
0166
0167
0168
0169
0170 local_WebDir=dir-GlobalPSM-GLOBAL_${runnumber}
0171 rm -rf ${local_WebDir}
0172 if [ ! -d ${local_WebDir} ] ; then mkdir ${local_WebDir}; fi
0173 for j in $(ls -r *.html); do
0174 cat $j | sed 's#cms-cpt-software.web.cern.ch\/cms-cpt-software\/General\/Validation\/SVSuite#cms-conddb.cern.ch\/eosweb\/hcal#g' \
0175 > ${local_WebDir}/$j
0176 done
0177 cp *.png ${local_WebDir}
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187 mkdir $WebDir/GlobalPSM/GLOBAL_$runnumber
0188 cp *.png $WebDir/GlobalPSM/GLOBAL_$runnumber/.
0189 cp *.html $WebDir/GlobalPSM/GLOBAL_$runnumber/.
0190 echo "cp png and html file done"
0191
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 rm *.html
0230 rm *.png
0231
0232
0233
0234
0235
0236
0237
0238
0239 done
0240
0241 if [ ${debug} -eq 2 ] ; then
0242 echo "debug=2 skipping web page creation"
0243 exit 2
0244 fi
0245
0246
0247
0248
0249 echo "GlobalPSM script done"
0250