Changeset 17587 for trunk/DataCheck
- Timestamp:
- 03/02/14 00:20:58 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/Step1.sh
r17153 r17587 5 5 6 6 # get date (before 18h there is no new data to be processed) 7 datepath=`date --date="-19HOUR" +%Y/%m/%d` 8 date=`date --date="-19HOUR" +%Y%m%d` 9 # for processing by hand 10 #datepath="2013/08/11" 11 #date="20130811" 7 if [ "$certaindate" != "" ] 8 then 9 checkstring=`echo $certaindate | grep -E -o '20[0-9][0-9]\/[01][0-9]\/[0-3][0-9]'` 10 if [ "$checkstring" = "" ] 11 then 12 echo "Please give the variable certaindate in the correct format (YYYY/MM/DD)" 13 finish 14 fi 15 datepath=$certaindate 16 else 17 datepath=`date --date="-19HOUR" +%Y/%m/%d` 18 fi 19 date=`echo $datepath | sed -e 's/\///g'` 12 20 printprocesslog "INFO processing "$datepath 13 night=`echo $datepath | sed -e 's/\///g'`14 21 15 22 auxpathnewdaq=/newdaq/aux/$datepath … … 29 36 # needed auxiliary files: 30 37 # drive file with information about current source position 31 drivefile=$auxpath/${ night}.DRIVE_CONTROL_SOURCE_POSITION.fits32 drivefilenewdaq=$auxpathnewdaq/${ night}.DRIVE_CONTROL_SOURCE_POSITION.fits38 drivefile=$auxpath/${date}.DRIVE_CONTROL_SOURCE_POSITION.fits 39 drivefilenewdaq=$auxpathnewdaq/${date}.DRIVE_CONTROL_SOURCE_POSITION.fits 33 40 # drive file with information about tracking position 34 drivefile2=$auxpath/${ night}.DRIVE_CONTROL_TRACKING_POSITION.fits35 drivefilenewdaq2=$auxpathnewdaq/${ night}.DRIVE_CONTROL_TRACKING_POSITION.fits41 drivefile2=$auxpath/${date}.DRIVE_CONTROL_TRACKING_POSITION.fits 42 drivefilenewdaq2=$auxpathnewdaq/${date}.DRIVE_CONTROL_TRACKING_POSITION.fits 36 43 # file with magic weather information 37 mweatherfile=$auxpath/${ night}.MAGIC_WEATHER_DATA.fits38 mweatherfilenewdaq=$auxpathnewdaq/${ night}.MAGIC_WEATHER_DATA.fits44 mweatherfile=$auxpath/${date}.MAGIC_WEATHER_DATA.fits 45 mweatherfilenewdaq=$auxpathnewdaq/${date}.MAGIC_WEATHER_DATA.fits 39 46 # file with trigger rates 40 ratesfile=$auxpath/${ night}.FTM_CONTROL_TRIGGER_RATES.fits41 ratesfilenewdaq=$auxpathnewdaq/${ night}.FTM_CONTROL_TRIGGER_RATES.fits47 ratesfile=$auxpath/${date}.FTM_CONTROL_TRIGGER_RATES.fits 48 ratesfilenewdaq=$auxpathnewdaq/${date}.FTM_CONTROL_TRIGGER_RATES.fits 42 49 # file with trigger rates 43 tempfile=$auxpath/${ night}.FSC_CONTROL_TEMPERATURE.fits44 tempfilenewdaq=$auxpathnewdaq/${ night}.FSC_CONTROL_TEMPERATURE.fits50 tempfile=$auxpath/${date}.FSC_CONTROL_TEMPERATURE.fits 51 tempfilenewdaq=$auxpathnewdaq/${date}.FSC_CONTROL_TEMPERATURE.fits 45 52 # file with trigger rates 46 humfile=$auxpath/${ night}.FSC_CONTROL_HUMIDITY.fits47 humfilenewdaq=$auxpathnewdaq/${ night}.FSC_CONTROL_HUMIDITY.fits53 humfile=$auxpath/${date}.FSC_CONTROL_HUMIDITY.fits 54 humfilenewdaq=$auxpathnewdaq/${date}.FSC_CONTROL_HUMIDITY.fits 48 55 49 56 function rsync_aux_file() … … 84 91 85 92 printprocesslog "INFO get lists of raw files on newdaq and daq" 86 files=( `find $rawpathnewdaq -type f 2>/dev/null | sort` ) 93 files=( `find $rawpathnewdaq -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` ) 94 # to treat links use: 95 #files=( `find -L $rawpathnewdaq -regex '.*[.]fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` ) 96 87 97 if [ ${#files[@]} -eq 0 ] 88 98 then … … 90 100 finish 91 101 fi 92 fileslocal=( `find $rawpath -type f | sort` )102 fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` ) 93 103 callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` ) 94 numdataruns=0 104 # get number of dataruns from DB 105 query="SELECT Count(*) FROM RunInfo WHERE fNight="$date" AND fRunTypeKey=1" 106 numdataruns=`sendquery` 95 107 96 108 # create raw directory on daq, if not yet there … … 100 112 printprocesslog "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns 101 113 102 while [ ${#fileslocal[@]} -ne ${#files[@]} ] || [ $numdataruns -ne ${#callistofiles[@]} ] || [ ${#callistofiles[@]} -eq 0 ]114 while [ ${#fileslocal[@]} -ne ${#files[@]} ] || [ $numdataruns -ne ${#callistofiles[@]} ] # || [ $numdataruns -ne 0 ] # FIXME: Logik ueberdenken u ueberarb 103 115 do 104 116 # only continue with script … … 117 129 do 118 130 printprocesslog "processing "$file 131 #echo "processing "$file 119 132 localfile=`echo $file | sed -e 's/newdaq/loc_data/'` 120 133 … … 127 140 if [ "`echo $file | grep -o drs`" == "drs" ] 128 141 then 129 nondrsfile=`echo $file | sed -e 's/[.]drs//g'` 142 nondrs=`basename $file | sed -e 's/[.]drs//g'` 143 nondrsfile=`find $rawpath -name $nondrs.*z` 144 #echo "nondrs: "$nondrsfile 130 145 tstop=`$factpath/fitsdump -h $nondrsfile 2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'` 131 146 else 132 147 tstop=`$factpath/fitsdump -h $file 2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'` 133 148 fi 149 #echo "tstop -"$tstop"-" 134 150 # when stop time is 0, file is not closed 135 if [ "$tstop" == "0" ] 151 # when an error is returned the tstop is empty 152 if [ "$tstop" == "0" ] || [ "$tstop" == "" ] 136 153 then 137 154 printprocesslog "WARN "$file" not yet closed." … … 168 185 fi 169 186 170 171 187 if [ "`echo $localfile | grep -o drs`" != "drs" ] 172 188 then … … 190 206 continue 191 207 fi 192 seqfile=$seqpath/${ night}_${runnum}.seq208 seqfile=$seqpath/${date}_${runnum}.seq 193 209 printprocesslog "INFO write data-seq "$seqfile 194 210 echo "# written by automatic analysis in LP" >$seqfile 195 211 echo "" >> $seqfile 196 echo "Sequence: "`echo $ night| cut -c3-8`$runnum >> $seqfile212 echo "Sequence: "`echo $date | cut -c3-8`$runnum >> $seqfile 197 213 echo "Night: "`echo $datepath | sed -e 's/\//-/g'` >> $seqfile 198 214 echo "" >> $seqfile … … 253 269 continue 254 270 fi 255 callistolog=`dirname $seqfile | sed -e "s/sequences/callisto/"`"/"$ night"_"$runnum"-calibration.log"271 callistolog=`dirname $seqfile | sed -e "s/sequences/callisto/"`"/"$date"_"$runnum"-calibration.log" 256 272 if ! [ -e $callistolog ] 257 273 then … … 274 290 if [ $numevts -ne 1000 ] 275 291 then 276 printprocesslog "INFO file "$file" is a non-data file ("$runtype") and has not 1000 events ("$n mevts")"292 printprocesslog "INFO file "$file" is a non-data file ("$runtype") and has not 1000 events ("$numevts")" 277 293 continue 278 294 fi … … 293 309 run6=`echo $runrow2 | cut -d_ -f6 | sed -e 's/pedestal300//g'` 294 310 run7=`echo $runrow2 | cut -d_ -f7 | sed -e 's/pedestal300//g'` 295 seqfile=$seqpath/${ night}_${run1}.drs.seq311 seqfile=$seqpath/${date}_${run1}.drs.seq 296 312 printprocesslog "INFO write drs-seq "$seqfile 297 313 echo "# written by automatic analysis in LP" > $seqfile 298 314 echo "" >> $seqfile 299 echo "Sequence: "`echo $ night| cut -c3-8`$run1 >> $seqfile315 echo "Sequence: "`echo $date | cut -c3-8`$run1 >> $seqfile 300 316 echo "Night: "`echo $datepath | sed -e 's/\//-/g'` >> $seqfile 301 317 echo "" >> $seqfile … … 322 338 # get new file lists 323 339 printprocesslog "INFO get new file lists for "$datepath 324 files=( `find $rawpathnewdaq -type f | sort` )325 fileslocal=( `find $rawpath -type f | sort` )340 files=( `find $rawpathnewdaq -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` ) 341 fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` ) 326 342 callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` ) 327 343 #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns … … 336 352 #echo "sleep 60..." 337 353 printprocesslog "INFO get new file lists for "$datepath 338 files=( `find $rawpathnewdaq -type f | sort` )339 fileslocal=( `find $rawpath -type f | sort` )354 files=( `find $rawpathnewdaq -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` ) 355 fileslocal=( `find $rawpath -type f -regex '.*[.]fits[.]?[g]?[f]?[z]?' | sort` ) 340 356 callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` ) 341 357 fi 342 358 #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns 343 359 printprocesslog "INFO status after wait end of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns 360 361 # this should not happen, but may in rare cases if data are deleted in the wrong order 362 if [ ${#files[@]} -lt ${#fileslocal[@]} ] 363 then 364 printprocesslog "ERROR numfiles on newdaq("${#files[@]}") < #files on daq ("${#fileslocal[@]}") - maybe deleting data in the wrong order?" 365 echo "ERROR numfiles on newdaq("${#files[@]}") < #files on daq ("${#fileslocal[@]}") - maybe deleting data in the wrong order?" 366 finish 367 fi 344 368 done 345 369
Note:
See TracChangeset
for help on using the changeset viewer.