Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:40:48

0001 #! /bin/bash
0002 source /afs/cern.ch/cms/caf/setup.sh
0003 
0004 echo ""
0005 echo "#############################################################################"
0006 echo "#####                                                                   #####"
0007 echo "#####      Starting the TK Alignment Skim&Prescale workflow!!!          #####"
0008 echo "#####                                                                   #####"
0009 echo "#####                                                                   #####"
0010 echo "#####                                                                   #####"
0011 echo "#############################################################################"
0012 echo
0013 echo
0014 echo "Program launched from $(hostname) at $(date) "
0015 echo
0016 echo
0017 
0018 ##########CASTOR_OUT="/castor/cern.ch/cms/store/caf/user/bonato/Collisions2010/Oct2010/"
0019 CASTOR_OUT="/store/caf/user/bonato/Collisions2010/Run2010B/Sept2010/"
0020 ###CASTOR_OUT="/store/caf/user/bonato/Collisions2010/Run2010A-v2/"
0021 MYCMSSW_RELEASE="$CMSSW_BASE"
0022 
0023 ###prepare the scripts
0024 sed -e "s|<CASTOROUT>|${CASTOR_OUT}|g" < SkimLooper.tpl > SkimLooper.sh
0025 sed -e "s|<CASTOROUT>|${CASTOR_OUT}|g" -e "s|<MYCMSSW>|$MYCMSSW_RELEASE|g"  < PrescaleLooper.tpl > PrescaleLooper.sh
0026 sed -e "s|<MYCMSSW>|$MYCMSSW_RELEASE|g"  < skim_exec.tpl > skim_exec.sh
0027 sed -e  "s|<MYCMSSW>|$MYCMSSW_RELEASE|g" < presc_exec.tpl > presc_exec.sh
0028 
0029 
0030 #prepare list of files counting the eevents from DBS
0031 for ALCATAG in  $( cat "taglist.txt" )
0032 do
0033 echo ""
0034 echo "Counting events for ${ALCATAG} ; Log in ./log_nevents_${ALCATAG}.out"
0035 #time ./cntevts_in_file.sh  "../data/${ALCATAG}.dat" $ALCATAG &> log_nevents_${ALCATAG}.out
0036 done
0037 ########exit 0
0038 
0039 #first loop: SKIMMING
0040 echo ""
0041 echo "~~~ Starting SkimLooper at $(date)"
0042 echo
0043 chmod 711 SkimLooper.sh
0044 chmod 711 skim_exec.sh
0045 ./SkimLooper.sh "taglist.txt" 3
0046 if [ $? != 0 ]
0047     then
0048     exit 2
0049 fi
0050 
0051 sleep 1800 #wait for half an hour
0052 
0053 #check that all the files from SkimLooper are done
0054 SKIM_DONE=1
0055 echo ""
0056 echo "Checking the status of SkimLooper: "
0057 while [ $SKIM_DONE == 1 ]
0058 do
0059 
0060 node=$(basename $(hostname) .cern.ch)
0061 bjobs -u $USER | grep $USER | grep $node > tmpskimjobs.tmp
0062 if [ $(wc -l tmpskimjobs.tmp | awk '{print $1}') == 0 ]
0063 then
0064 SKIM_DONE=0
0065 else
0066 sleep 600 #wait for ten minutes before checking again
0067 fi
0068 
0069 rm -f  tmpskimjobs
0070 echo "Status is ${SKIM_DONE}"
0071 done
0072 
0073 #SkimLooper has finished, go to the prescaling phase
0074 #second loop: PRESCALING
0075 echo ""
0076 echo "~~~ Starting PrescaleLooper at $(date)"
0077 echo
0078 chmod 711 PrescaleLooper.sh
0079 chmod 711 presc_exec.sh
0080 ./PrescaleLooper.sh "taglist.txt" 3
0081 if [ $? != 0 ]
0082     then
0083     exit 3
0084 fi
0085 echo
0086 echo
0087 echo "Finished operations at $(date)"