Changeset 20104 for trunk/Mars/hawc/processing/DiskToDB/run-callisto2.sh
- Timestamp:
- 09/05/21 07:13:17 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/processing/DiskToDB/run-callisto2.sh
r20103 r20104 32 32 readonly STAR=star 33 33 # Directory to Mars environment (usually Mars/build) 34 readonly MARS="/home/ frankm/Dateien/Mars-6.24.00/build4/"34 readonly MARS="/home/hawc/Desktop/Mars/" 35 35 # Absolut path to macros 36 readonly MACROS="/home/ frankm/Dateien/Mars-6.24.00/hawc"36 readonly MACROS="/home/hawc/Desktop/Mars-src/hawc" 37 37 readonly PROGRAM=$0 38 38 REPLACE=false … … 139 139 --compress \ 140 140 | \ 141 while read -r -a LINE 142 do 143 # Extract night/runid for data file and calibration file 144 DATNIGHT=${LINE[0]} 145 DATRUNID=${LINE[1]} 146 DRSNIGHT=${LINE[2]} 147 DRSRUNID=${LINE[3]} 148 149 # Formatting of the file paths and names 150 DATPATH=${DATNIGHT:0:4}/${DATNIGHT:4:2}/${DATNIGHT:6:2} 151 DRSPATH=${DRSNIGHT:0:4}/${DRSNIGHT:4:2}/${DRSNIGHT:6:2} 152 153 PREFIX=`printf ${DATNIGHT}_%03d ${DATRUNID}` 154 155 DATNAME=`printf ${DATNIGHT}_%03d.fits.fz ${DATRUNID}` 156 DRSNAME=`printf ${DRSNIGHT}_%03d.drs.fits ${DRSRUNID}` 157 158 OUT="${DATA}"/../${CALLISTO}/${DATPATH} 159 160 echo DAT=${DATNAME} [${DATPATH}] 161 echo DRS=${DRSNAME} [${DRSPATH}] 162 163 164 if [ ${REPLACE} = true ] 165 then 166 echo "deleting ${OUT}/.${PREFIX}.succsess !!!" 167 rm -f "${OUT}"/.${PREFIX}.success 168 fi 169 170 # Check if not yet successfully processed 171 # Removing this file can be used to trigger a re-processing 172 # the next time this script is executed 173 if [ ! -f "${OUT}/.${PREFIX}.success" ] 174 then 175 176 cd ${MARS} 177 178 mkdir -p "${OUT}" 179 180 # Trigger reprocessing of the process-fils in the star directory 181 rm -f "${DATA}/${STAR}/${DATPATH}/.${PREFIX}.*" 182 183 # Flag that a process is running 184 rm -f "${OUT}"/.${PREFIX}.done 185 rm -f "${OUT}"/.${PREFIX}.success 186 187 touch "${OUT}"/.${PREFIX}.running 188 189 echo ${DATA} 190 191 # Execute the calibration and write output to log-file 192 root -b -q -l ${MACROS}/callisto.C'("'"${DATA}"/${DATPATH}/${DATNAME}'","'"${DATA}"/${DRSPATH}/${DRSNAME}'", 0 ,"'"${OUT}"'")' \ 193 2>&1 | tee "${OUT}"/${PREFIX}.log 194 195 RC=${PIPESTATUS[0]} 196 197 198 # Remember exit status of callisto 199 echo RC=${RC} | tee -a "${OUT}"/${PREFIX}.log 200 echo ${RC} > "${OUT}"/.${PREFIX}.done 201 # Processing is finished 202 rm -f "${OUT}"/.${PREFIX}.running 203 204 # If processing was successfull write corresponding flag 205 if [ "${RC}" == "0" ] 206 then 141 while read -r -a LINE 142 do 143 # Extract night/runid for data file and calibration file 144 DATNIGHT=${LINE[0]} 145 DATRUNID=${LINE[1]} 146 DRSNIGHT=${LINE[2]} 147 DRSRUNID=${LINE[3]} 148 149 # Formatting of the file paths and names 150 DATPATH=${DATNIGHT:0:4}/${DATNIGHT:4:2}/${DATNIGHT:6:2} 151 DRSPATH=${DRSNIGHT:0:4}/${DRSNIGHT:4:2}/${DRSNIGHT:6:2} 152 153 PREFIX=`printf ${DATNIGHT}_%03d ${DATRUNID}` 154 155 DATNAME=`printf ${DATNIGHT}_%03d.fits.fz ${DATRUNID}` 156 DRSNAME=`printf ${DRSNIGHT}_%03d.drs.fits ${DRSRUNID}` 157 158 OUT="${DATA}"/../${CALLISTO}/${DATPATH} 159 160 echo DAT=${DATNAME} [${DATPATH}] 161 echo DRS=${DRSNAME} [${DRSPATH}] 162 163 164 if [ ${REPLACE} = true ] 165 then 166 echo "deleting ${OUT}/.${PREFIX}.succsess !!!" 167 rm -f "${OUT}"/.${PREFIX}.success 168 fi 169 170 # Check if not yet successfully processed 171 # Removing this file can be used to trigger a re-processing 172 # the next time this script is executed 173 if [ ! -f "${OUT}/.${PREFIX}.success" ] 174 then 175 176 cd ${MARS} 177 178 mkdir -p "${OUT}" 179 180 # Trigger reprocessing of the process-fils in the star directory 181 rm -f "${DATA}/${STAR}/${DATPATH}/.${PREFIX}.*" 182 183 # Flag that a process is running 184 rm -f "${OUT}"/.${PREFIX}.done 185 rm -f "${OUT}"/.${PREFIX}.success 186 187 touch "${OUT}"/.${PREFIX}.running 188 189 echo ${DATA} 190 191 RC=0 192 # Execute the calibration and write output to log-file 193 root -b -q -l ${MACROS}/callisto.C'("'"${DATA}"/${DATPATH}/${DATNAME}'","'"${DATA}"/${DRSPATH}/${DRSNAME}'", 0 ,"'"${OUT}"'")' \ 194 2>&1 | tee "${OUT}"/${PREFIX}.log || RC=1 195 196 # Remember exit status of callisto 197 echo RC=${RC} | tee -a "${OUT}"/${PREFIX}.log 198 echo ${RC} > "${OUT}"/.${PREFIX}.done 199 # Processing is finished 200 rm -f "${OUT}"/.${PREFIX}.running 201 202 # If processing was successfull write corresponding flag 203 if [ "${RC}" == "0" ] 204 then 207 205 touch "${OUT}"/.${PREFIX}.success 208 else 209 UpdateStatus ${TEL} ${NIGHT} ${DATRUNID} 1 210 fi 211 212 cd - 213 214 echo "-----End of first iteration-----" 215 else 216 echo Skipped. 217 fi 218 219 done 206 fi 207 208 cd - 209 210 echo "-----End of first iteration-----" 211 else 212 echo Skipped. 213 fi 214 215 done
Note:
See TracChangeset
for help on using the changeset viewer.