File indexing completed on 2024-04-06 11:57:28
0001
0002
0003
0004 source /afs/cern.ch/cms/caf/setup.sh
0005 curdir=$( pwd )
0006
0007 workdir="<MYCMSSW>/src/"
0008 CASTOR_OUT="<CASTOROUT>"
0009
0010 DQM_OUT="${curdir}/MONITORING/DQM/CTF/"
0011
0012 ALCAFILELIST=$1
0013 MAXEVENTS=18000
0014
0015
0016 checkCorruptedFiles(){
0017
0018
0019 FOUND=4
0020 if [ $
0021 then
0022
0023 echo 3
0024 fi
0025
0026 LISTBADJOBS="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/HIP/bonato/CMSSW_3_8_4_patch2/src/Alignment/TrackerAlignment/scripts/badjobs_Run2010A-v4.lst"
0027
0028
0029 IND=$1
0030 while read myline
0031
0032 do
0033
0034
0035
0036 if [[ "$1" -eq "$myline" ]]
0037 then
0038
0039 FOUND=0
0040 break
0041
0042
0043 fi
0044 done < $LISTBADJOBS
0045
0046 echo $FOUND
0047
0048 }
0049
0050
0051
0052
0053
0054
0055
0056
0057 nsls -d /castor/cern.ch/cms/$CASTOR_OUT
0058 if [ $? -ne 0 ]
0059 then
0060 echo "Output directory: "
0061 echo $CASTOR_OUT
0062 echo "does not exist. Please check the scripts. Exiting."
0063 exit 1
0064 fi
0065
0066
0067 echo ""
0068 echo "I am in $curdir"
0069
0070 cnt=0;
0071
0072 if [ $
0073 then
0074 if [ $2 -gt 2 ]
0075 then
0076 echo "Cleaning from Prescaled files the output directory: /castor/cern.ch/cms/$CASTOR_OUT"
0077 for file in $(nsls /castor/cern.ch/cms/$CASTOR_OUT/ | grep 'Prescaled')
0078 do
0079
0080 rfrm /castor/cern.ch/cms/$CASTOR_OUT/$file
0081 let cnt=cnt+1
0082 done
0083 echo "Deleted $cnt files"
0084 fi
0085 fi
0086
0087
0088 cd $workdir
0089 eval `scramv1 runtime -sh`
0090 export STAGE_SVCCLASS=cmscaf
0091 cd -
0092
0093 for ALCATAG in $( cat $ALCAFILELIST )
0094 do
0095
0096 echo
0097 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
0098 echo "%%% Starting the ALCATAG: ${ALCATAG}"
0099 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
0100 echo
0101
0102 DAT_FILE="${curdir}/../data/${ALCATAG}.dat"
0103 TPL_FILE="TkAlCaRecoPrescaling.${ALCATAG}.tpl"
0104 BASE_TPL=$(basename "$TPL_FILE" .tpl)
0105 TAG=$ALCATAG
0106 JOBTAG="ALCAPresc_"${TAG}
0107
0108
0109 cd $DQM_OUT
0110 dqmlist=${DQM_OUT}"/AlignmentDQMHitMaps_CTF_${TAG}.txt"
0111 rm -f $dqmlist
0112 for dqmfile in $(ls TkAl*Skim*${TAG}*HitMaps*.root)
0113 do
0114 echo $(pwd)/$dqmfile >> $dqmlist
0115 done
0116
0117
0118
0119 cd $curdir
0120 dqmtotfile="${curdir}/TkAlDQMHitMaps_CTF_${TAG}.root"
0121
0122 sed -e "s|<DQMLIST>|${dqmlist}|g" -e "s|<DQMTOTFILE>|${dqmtotfile}|g" < mergemytree_cfg.tpl > mergemytree_${TAG}_cfg.py
0123 echo "Merging DQM into $dqmtotfile"
0124 time cmsRun mergemytree_${TAG}_cfg.py
0125
0126
0127
0128
0129 TOTFILES=0
0130 INDEX=1
0131 for i in $( cat $DAT_FILE )
0132 do
0133
0134
0135 let TOTFILES=TOTFILES+1
0136 TOTEVTS=$(sed -n $TOTFILES'p' ../data/nevents${TAG}.out)
0137
0138 if [ $TOTEVTS == 0 ]
0139 then
0140
0141 continue
0142 fi
0143 TOTSPLITS=$(( ( $TOTEVTS / $MAXEVENTS ) +1 ))
0144 firstev=0
0145 lastev=-1
0146
0147
0148 if [ $TOTSPLITS > 1 ]
0149 then
0150 nsplits=1
0151
0152
0153 while [ $nsplits -le $TOTSPLITS ]
0154 do
0155
0156 firstev=$(( $MAXEVENTS*$(( $nsplits-1 ))+1 ))
0157 lastev=$MAXEVENTS
0158 JOB=$JOBTAG"_file"$INDEX
0159 CFG_FILE=$BASE_TPL"."$TAG"_cfg."$INDEX".py"
0160 sed -e "s|<JOB>|${JOB}|g" -e "s|<INPATH>|${i}|g" -e "s|<INIEVT>|${firstev}|g" -e "s|<FINEVT>|${lastev}|g" -e "s|<ALCATAG>|${ALCATAG}|g" -e "s|<MERGEDHITMAP>|${dqmtotfile}|g" < $TPL_FILE > $CFG_FILE
0161 let INDEX=INDEX+1
0162 let nsplits=nsplits+1
0163
0164
0165
0166
0167
0168
0169 done
0170
0171 else
0172 firstev=0
0173 lastev=-1
0174 JOB=$JOBTAG"_file"$INDEX
0175 CFG_FILE=$BASE_TPL"."$TAG"_cfg."$INDEX".py"
0176 sed -e "s|<JOB>|${JOB}|g" -e "s|<INPATH>|${i}|g" -e "s|<INIEVT>|${firstev}|g" -e "s|<FINEVT>|${lastev}|g" -e "s|<ALCATAG>|${ALCATAG}|g" -e "s|<MERGEDHITMAP>|$dqmtotfile|g" < $TPL_FILE > $CFG_FILE
0177 let INDEX=INDEX+1
0178
0179
0180
0181
0182
0183
0184 fi
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 done
0195
0196
0197
0198 TOTPRESCALEDJOBS=$(( $INDEX -1 ))
0199 echo
0200 echo "TOTPRESCALEDJOBS = $TOTPRESCALEDJOBS"
0201
0202
0203
0204 echo
0205 echo
0206 echo "@@@@@@@@@@@@@@@@@@@@@"
0207 echo
0208 INDEX=1
0209 while [ $INDEX -le $TOTPRESCALEDJOBS ]
0210 do
0211 JOBNAME="ALCAPresc"$TAG"_"$INDEX
0212 LOGFILE="${JOBNAME}.log"
0213 CFG_FILE=$BASE_TPL"."$TAG"_cfg."$INDEX".py"
0214
0215
0216 CHECKCORRUPTED=1
0217 FILECORRUPTED=$( checkCorruptedFiles $INDEX )
0218
0219
0220 if [[ $FILECORRUPTED == 0 || CHECKCORRUPTED -gt 0 ]]
0221 then
0222 echo "Submitting $JOBNAME with config file $CFG_FILE"
0223 REM=0
0224 let "REM=$INDEX % 300"
0225 if [ $REM -lt 100 ]
0226 then
0227
0228 bsub -q cmscaf1nd -J $JOBNAME -oo $LOGFILE presc_exec.sh "$curdir/$CFG_FILE" "$CASTOR_OUT" "$DQM_OUT"
0229 elif [ $REM -lt 200 ]
0230 then
0231
0232 bsub -q cmsexpress -J $JOBNAME -oo $LOGFILE presc_exec.sh "$curdir/$CFG_FILE" "$CASTOR_OUT" "$DQM_OUT"
0233 else
0234
0235 bsub -q cmscaf1nd -J $JOBNAME -oo $LOGFILE presc_exec.sh "$curdir/$CFG_FILE" "$CASTOR_OUT" "$DQM_OUT"
0236 fi
0237
0238 fi
0239
0240 let INDEX=INDEX+1
0241 done
0242
0243
0244 done