| 1 | #!/bin/bash
|
|---|
| 2 | #
|
|---|
| 3 | source `dirname $0`/../Sourcefile.sh
|
|---|
| 4 | printprocesslog "INFO starting $0 $1"
|
|---|
| 5 |
|
|---|
| 6 | #root=/opt/root_svn/bin/thisroot.sh
|
|---|
| 7 | #source $root
|
|---|
| 8 | #factpath=/home/fact/FACT++.in-run-fad-loss
|
|---|
| 9 | #export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
|
|---|
| 10 |
|
|---|
| 11 | mars=/home/fact/Mars
|
|---|
| 12 | cd $mars
|
|---|
| 13 | pwd
|
|---|
| 14 | # use macro from different mars version until versions are sorted out
|
|---|
| 15 | mars2=/home/fact/SW.automatic.processing/Mars.svn.2013.04.12
|
|---|
| 16 |
|
|---|
| 17 | if ! [ "$1" = "run" ] && ! [ "$1" = "night" ]
|
|---|
| 18 | then
|
|---|
| 19 | #echo "wrong option "$1" (only min and nights valid)."
|
|---|
| 20 | echo "wrong option "$1" (only run and night valid)."
|
|---|
| 21 | finish
|
|---|
| 22 | fi
|
|---|
| 23 |
|
|---|
| 24 | if [ "$1" = "run" ]
|
|---|
| 25 | then
|
|---|
| 26 | tablenam=$resulttable1
|
|---|
| 27 | fi
|
|---|
| 28 |
|
|---|
| 29 | if [ "$1" = "night" ]
|
|---|
| 30 | then
|
|---|
| 31 | tablenam=$resulttable2
|
|---|
| 32 | fi
|
|---|
| 33 |
|
|---|
| 34 | # get last 3, 6 or 9 nights
|
|---|
| 35 | dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
|
|---|
| 36 | # `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
|
|---|
| 37 | # `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
|
|---|
| 38 | )
|
|---|
| 39 | #dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
|
|---|
| 40 |
|
|---|
| 41 | dates=( "2013/04/19" )
|
|---|
| 42 |
|
|---|
| 43 | # source info on daq in /loc_data/analysis/sources.txt
|
|---|
| 44 | # (dump of DB scheduling.sources)
|
|---|
| 45 |
|
|---|
| 46 | timebins=( 5 10 20 30 40 60 90 120 180 240 300 360 )
|
|---|
| 47 |
|
|---|
| 48 | for date in ${dates[@]}
|
|---|
| 49 | do
|
|---|
| 50 | date2=`echo $date | sed -e 's/\///g'`
|
|---|
| 51 | query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$date2" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
|
|---|
| 52 | sources=( `sendquery` )
|
|---|
| 53 | for source in ${sources[@]}
|
|---|
| 54 | do
|
|---|
| 55 | echo $source
|
|---|
| 56 | printprocesslog "INFO processing files for source "$source
|
|---|
| 57 | outpath=$anapath/lightcurves/$date
|
|---|
| 58 | makedir $outpath
|
|---|
| 59 |
|
|---|
| 60 | for timebin in ${timebins[@]}
|
|---|
| 61 | do
|
|---|
| 62 | # doing the plots for one night
|
|---|
| 63 | logfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".log"
|
|---|
| 64 | outfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".root"
|
|---|
| 65 | echo $outfile
|
|---|
| 66 | printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2
|
|---|
| 67 |
|
|---|
| 68 | check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$date2\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
|
|---|
| 69 |
|
|---|
| 70 | case $check1 in
|
|---|
| 71 | 0) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
|
|---|
| 72 | ./showplot -b --save-as-png $outfile
|
|---|
| 73 | ;;
|
|---|
| 74 | 1) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2", but nothing to plot (check1=$check1)"
|
|---|
| 75 | ;;
|
|---|
| 76 | *) printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
|
|---|
| 77 | ;;
|
|---|
| 78 | esac
|
|---|
| 79 |
|
|---|
| 80 | # doing the plots for all nights
|
|---|
| 81 | logfile=$outpath"/lightcurve"$source"_"$timebin"min_all.log"
|
|---|
| 82 | outfile=$outpath"/lightcurve"$source"_"$timebin"min_all.root"
|
|---|
| 83 | echo $outfile
|
|---|
| 84 | printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2" all nights"
|
|---|
| 85 |
|
|---|
| 86 | check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$firstnight\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
|
|---|
| 87 |
|
|---|
| 88 | case $check1 in
|
|---|
| 89 | 0) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
|
|---|
| 90 | ./showplot -b --save-as-png $outfile
|
|---|
| 91 | ;;
|
|---|
| 92 | 1) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights, but nothing to plot (check1=$check1)"
|
|---|
| 93 | ;;
|
|---|
| 94 | *) printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
|
|---|
| 95 | ;;
|
|---|
| 96 | esac
|
|---|
| 97 | done
|
|---|
| 98 | done
|
|---|
| 99 | printprocesslog "INFO rsync output of source "$source" to gate."
|
|---|
| 100 | rsync -av $anapath/lightcurves/ gate:/home/factwww/lightcurves
|
|---|
| 101 | done
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | finish
|
|---|
| 105 |
|
|---|