Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:46

0001 #!/bin/csh
0002 
0003 set runnumber=${1}
0004 set refnumber=${3}
0005 set runNevents=${4}
0006 set CALIB=${5}
0007 set ERA=${6}
0008 
0009 set RELEASE=CMSSW_10_4_0
0010 
0011 set fullSrc0='/store/group/dpg_hcal/comm_hcal/USC'
0012 set fullSrc='NO'
0013 set WebDir='/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb'
0014 set WebSite='https://cms-cpt-software.web.cern.ch/cms-cpt-software/General/Validation/SVSuite/HcalRemoteMonitoring/RMT'
0015 set HistoDir='/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/histos'
0016 set WD="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test/RDM"
0017 
0018 echo ${runnumber} >> ${WD}/LOG/batchlog
0019 grep -q ${runnumber} ${WD}/${CALIB}_LIST/fullSrc0_list_${2}
0020 if( ${status} == "0" ) then
0021 set namef0=`grep ${runnumber} ${WD}/${CALIB}_LIST/fullSrc0_list_${2}`
0022 set namef=`echo ${namef0} | awk '{print $1}'`
0023 echo ${namef}
0024 if( ${namef} == "run${runnumber}" ) then
0025 set fullSrc=${fullSrc0}/run${runnumber}
0026 else
0027 set fullSrc=${fullSrc0}
0028 endif
0029 
0030 echo "here"
0031 endif
0032 
0033 echo ${fullSrc} >> ${WD}/LOG/batchlog
0034 
0035 if( ${fullSrc} == "NO" ) then
0036 echo "No Batch submission" ${runnumber} >> ${WD}/LOG/batchlog
0037 exit
0038 endif
0039 
0040 echo "Batch submission" ${fullSrc} " " ${runnumber} >> ${WD}/LOG/batchlog
0041 
0042 ###exit
0043 
0044 ### We are at working node
0045 mkdir ${runnumber}
0046 setenv WORK `pwd`/${runnumber}
0047 source /cvmfs/cms.cern.ch/cmsset_default.csh
0048 which cmsenv
0049 
0050 cd /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test
0051 cmsenv
0052  
0053 cp ${WD}/remoteMonitoring_${CALIB}_${ERA}_cfg.py ${WORK}/remoteMonitoring_cfg.py
0054 cp ${WD}/RemoteMonitoringMAP.cc ${WORK}
0055 cp ${WD}/compile.csh ${WORK}
0056 cp ${WD}/LogEleMapdb.h ${WORK}
0057 cp ${WD}/${CALIB}_LIST/runlist.tmp.${2} ${WORK}/runlist.tmp
0058 
0059 cd ${WORK}
0060 chmod a+x cmsRun
0061 
0062 #### cmsRun Start
0063 ### Temporarily
0064 #rm LOG/log_${runnumber}
0065 #rm ${HistoDir}/${CALIB}_${runnumber}.root
0066 
0067 echo " Start CMS run " > ${WD}/LOG/log_${runnumber}
0068 echo ${LD_LIBRARY_PATH} >> ${WD}/LOG/log_${runnumber}
0069 echo ${HistoDir} >> ${WD}/LOG/log_${runnumber} 
0070 echo ${CMSSW_BASE} >> ${WD}/LOG/log_${runnumber}
0071 pwd >> ${WD}/LOG/log_${runnumber}
0072 ls ${WORK} >> ${WD}/LOG/log_${runnumber}
0073 ls /cvmfs >> ${WD}/LOG/log_${runnumber}
0074 ls /cvmfs/cms.cern.ch >> ${WD}/LOG/log_${runnumber}
0075 
0076 which cmsRun >> ${WD}/LOG/log_${runnumber} 
0077 
0078 cmsRun remoteMonitoring_cfg.py ${runnumber} ${fullSrc} ${HistoDir} >> & ${WD}/LOG/log_${runnumber}
0079 
0080 ls >> ${WD}/LOG/log_${runnumber}
0081 
0082 mv ${HistoDir}/LED_${runnumber}.root ${HistoDir}/${CALIB}_${runnumber}.root
0083 
0084 echo " After CMS run ">>${WD}/LOG/log_${runnumber}
0085 rm -rf ${WebDir}/${CALIB}_${runnumber} 
0086 mkdir ${WebDir}/${CALIB}_${runnumber} >> & ${WD}/LOG/log_${runnumber}
0087 ./compile.csh RemoteMonitoringMAP.cc  >> & ${WD}/LOG/log_${runnumber}
0088 
0089 ###!!!! for the time being use refnumber=runnumber
0090 set refnumber=${runnumber}
0091 echo "ATTENTION: we put refnumber=${runnumber}">>& ${WD}/LOG/log_${runnumber}
0092 ./RemoteMonitoringMAP.cc.exe "${HistoDir}/${CALIB}_${runnumber}.root" "${HistoDir}/${CALIB}_${refnumber}.root" ${CALIB} >> & ${WD}/LOG/log_${runnumber}
0093 
0094 ##root -b -q -l 'RemoteMonitoringMAP.C+("'${HistoDir}'/${CALIB}_'${runnumber}'.root","'${HistoDir}'/${CALIB}_'${refnumber}'.root")'
0095 ls -l >> ${WD}/LOG/log_${runnumber}
0096 #echo " Start copy png " >> & ${WD}/LOG/log_${runnumber}
0097 #ls $WebDir/${CALIB}_$runnumber  >> & ${WD}/LOG/log_${runnumber}
0098 #cp *.html $WebDir/${CALIB}_$runnumber  >> & ${WD}/LOG/log_${runnumber}
0099 #cp *.png $WebDir/${CALIB}_$runnumber  >> & ${WD}/LOG/log_${runnumber}
0100 
0101 #### CmsRun end
0102 ### extract the date of file
0103 ### set rundate=`cmsLs $fullSrc | grep ${1} | awk '{print $3}'`
0104 
0105 set j=`cat runlist.tmp | grep ${runnumber}`
0106 echo ${j} >> ${WD}/LOG/batchlog    
0107 setenv runtype ${CALIB} 
0108 setenv runHTML NO
0109 #setenv runday `echo $j | awk -F - '{print $19}'`
0110 #setenv runmonth `echo $j | awk -F - '{print $18}'`
0111 #setenv runyear `echo $j | awk -F - '{print $17}'`
0112 setenv runtime `echo $j | awk -F _ '{print $4}'`
0113 setenv rundate `echo $j | awk -F _ '{print $3}'` 
0114 #wget ${runHTML} >> ${WD}/LOG/batchlog
0115 #setenv runNevents `cat index.html | tail -n +14 | head -n 1 | awk -F '>' '{print $2}' | awk -F '<' '{print $1}'`
0116 #rm index.html
0117 
0118 echo 'RUN Date = '${rundate} ${runtime} >> ${WD}/LOG/batchlog    
0119 echo 'RUN Type = '${runtype} >> ${WD}/LOG/batchlog    
0120 echo 'Reference RUN number ='${refnumber} >> ${WD}/LOG/batchlog    
0121 
0122 touch index_draft.html
0123 
0124 #adding entry to list of file index_draft.html
0125 
0126 ####sed '$d' < /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMweb/index.html > index.html.tmp
0127 
0128 set raw=3
0129 echo '<tr>'>> index_draft.html
0130 echo '<td class="s1" align="center">'ktemp'</td>'>> index_draft.html
0131 echo '<td class="s'$raw'" align="center">'$runnumber'</td>'>> index_draft.html
0132 echo '<td class="s'$raw'" align="center">'$runtype'</td>'>> index_draft.html
0133 echo '<td class="s'$raw'" align="center">'$runNevents'</td>'>> index_draft.html
0134 echo '<td class="s'$raw'" align="center">'$rundate'</td>'>> index_draft.html
0135 echo '<td class="s'$raw'" align="center">'$runtime'</td>'>> index_draft.html
0136 echo '<td class="s'$raw'" align="center">'$refnumber'</td>'>> index_draft.html
0137 echo '<td class="s'$raw'" align="center"><a href="'$WebSite'/'${CALIB}'_'$runnumber'/MAP.html">'${CALIB}'_'$runnumber'</a></td>'>> index_draft.html
0138 echo '<td class="s'$raw'" align="center">NO</td>'>> index_draft.html
0139 echo '<td class="s'$raw'" align="center">OK</td>'>> index_draft.html
0140 echo '</tr>'>> index_draft.html
0141 
0142 #### PUT Corresponding calib type to html
0143 
0144 foreach i (`ls *.html`)
0145 cat ${i} | sed s/LED/${CALIB}/g > ${i}_t
0146 mv ${i}_t ${i} 
0147 end
0148 
0149 #######touch $WebDir/${CALIB}_$runnumber/new
0150 ####### Copy to the new site in parallel
0151 ls *.png
0152 if(${status} == "0") then
0153 #### Copy to the old site
0154 echo " Start copy png " >> & ${WD}/LOG/log_${runnumber}
0155 cp *.html $WebDir/${CALIB}_$runnumber  >> & ${WD}/LOG/log_${runnumber}
0156 cp *.png $WebDir/${CALIB}_$runnumber  >> & ${WD}/LOG/log_${runnumber}
0157 
0158 mv $WebDir/${CALIB}_$runnumber/index_draft.html $WebDir/${CALIB}_$runnumber/index_draft.html.orig
0159 cp index_draft.html $WebDir/${CALIB}_$runnumber
0160 #### Copy to the new site
0161 eos mkdir /eos/cms/store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/RMT/${CALIB}_$runnumber
0162 foreach i (`ls *.html`)
0163 cat ${i} | sed 's#cms-cpt-software.web.cern.ch\/cms-cpt-software\/General\/Validation\/SVSuite#cms-conddb-dev.cern.ch\/eosweb\/hcal#g'> ${i}.n
0164 xrdcp ${i}.n /eos/cms/store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/RMT/${CALIB}_$runnumber/${i}
0165 end
0166 foreach k (`ls *.png`)
0167 xrdcp ${k} /eos/cms/store/group/dpg_hcal/comm_hcal/www/HcalRemoteMonitoring/RMT/${CALIB}_$runnumber
0168 end
0169 endif
0170 
0171 
0172